记录编号 120832 评测结果 AAAAAAAAAA
题目名称 歌词 最终得分 100
用户昵称 GravatarHouJikan 是否通过 通过
代码语言 C++ 运行时间 0.131 s
提交时间 2014-09-16 21:24:30 内存使用 0.32 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 node
{
  string s;
  bool operator <(const node &rhs) const
  {
    if (s.length()!=rhs.s.length())
      return s.length()<rhs.s.length();
    return s<rhs.s;
  }
};
//==============var declaration=================
multimap <int,node> Lyric;
string str;
//==============function declaration============

//==============main code=======================
int main()
{  
  string FileName="lyric";//程序名 
  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    
  Lyric.clear();
  while (getline(cin,str))
  {
    int len=str.length();
    if (str[1]=='n')
      cout<<"        "<<str.substr(6,len-6)<<endl;
    else
    {
      int t=(str[1]*10+str[2]-'0'*11)*60+str[4]*10+str[5]-'0'*11;
      node ins;
      ins.s=str.substr(7,len-7);
      Lyric.insert(pair<int,node>(t,ins));
    }
  }
  multimap <int,node>::iterator it=Lyric.begin(),endit=Lyric.end(),temp;
  vector <node> s;
  while (it!=endit)
  {
     s.clear();
     temp=it; 
     s.push_back(it->second);
     ++it;
     while (it!=endit&&it->first==temp->first)
     {
       temp=it;
       s.push_back(it->second);
       ++it;
     }
     sort(s.begin(),s.end());
     int siz=s.size()-1;
     For(i,0,siz)
       cout<<s[i].s;
     cout<<endl;
  }
#ifdef DEBUG  
  clock_t End_Time=clock();
  printf("\n\nTime Used: %.4lf Ms\n",double(End_Time-Start_Time)/CLOCKS_PER_SEC);
#endif    
  return 0;
}
//================fuction code====================