记录编号 118205 评测结果 WWWWWWWWWW
题目名称 [USACO Mar08] 珍珠分对 最终得分 0
用户昵称 GravatarHouJikan 是否通过 未通过
代码语言 C++ 运行时间 0.000 s
提交时间 2014-09-04 20:57:06 内存使用 0.00 MiB
显示代码纯文本
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <list>
#include <vector>
#include <ctime>
#include <iterator>
#include <functional>
#define pritnf printf
#define scafn scanf
#define For(i,j,k) for(int i=(j);i<=(k);(i)++)
using namespace std;
typedef long long LL;
typedef unsigned int Uint; 
const int INF=0x7ffffff;
//==============struct declaration==============
struct stones
{
  int color;int left;
  bool operator <(const stones &rhs) const
  {
    return left<rhs.left;
  }
  stones(int color=0,int left=0):color(color),left(left){}
};
//==============var declaration=================
int sum,n;

//==============function declaration============

//==============main code=======================
int main()
{  
  string FileName="ppairing";//程序名 
  string FloderName="COGS";//文件夹名 
  freopen((FileName+".in").c_str(),"r",stdin);
  freopen((FileName+".out").c_str(),"w",stdout);
#ifdef DEBUG  
  system(("cp C:\\Users\\Administrator\\Desktop\\"+FloderName+"\\standard.cpp C:\\Users\\Administrator\\Desktop\\"+FloderName+"\\submit.txt").c_str());
  clock_t Start_Time=clock();
#endif    
  scanf("%d%d",&sum,&n);
  priority_queue<stones> Q;
  For(i,1,n)
  {
     int s;
     scanf("%d",&s);
     Q.push(stones(i,s));
  }
  stones e,x;
  For(i,1,sum/2)
  {
    e=Q.top();Q.pop();
    x=Q.top();Q.pop();
    printf("%d %d\n",e.color,x.color);
    e.left--;x.left--;
    Q.push(e);Q.push(x);
  }
#ifdef DEBUG  
  clock_t End_Time=clock();
  cout<<endl<<endl<<"Time Used: "<<double(End_Time-Start_Time)/CLOCKS_PER_SEC<<endl;
#endif    
  return 0;
}
//================fuction code====================