# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
222445 | rainy | ACM (COCI19_acm) | C++14 | 11 ms | 384 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define MAXN 1123
#define fr first
#define sc second
using namespace std;
typedef pair<int,int>ii;
typedef pair<ii,char*>atm;
int N,M;
char tn[MAXN][25];
char mt[25]="NijeZivotJedanACM";
char S,X;int HH,MM,SS;
int ts[MAXN];
int pt[MAXN];
int mi;
atm AT[MAXN];
int cmp(atm t1, atm t2){
if(t1.fr.fr==t2.fr.fr&&t1.fr.sc==t2.fr.sc)return t1.sc<t2.sc;
if(t1.fr.fr==t2.fr.fr)return t1.fr.sc<t2.fr.sc;
return t2.fr.fr<t1.fr.fr;
}
int main(){
scanf("%d%d",&N,&M);
memset(ts,0,sizeof(ts));
memset(pt,0,sizeof(pt));
for(int i=0;i<N+1;i++){
scanf(" %s",&tn[i]);
//printf("tn[i]=[%s]\n",tn[i]);
if(strcmp(tn[i],mt)==0&&i!=N){
mi=i;
char t='a';
while(t!='\n'){
scanf("%c",&t);
}
}
else if(strcmp(tn[i],mt)){
for(int j=0;j<M;j++){
scanf(" %c",&S);
assert(S=='+'||S=='-'||S=='?');
if(S=='-'){
char t='a';
while(t!='\n'&&t!=' '){
scanf("%c",&t);
}
continue;
// pt[i]+=(t-'1')*20*60+HH*60*60+MM*60+SS;
}
ts[i]++;
scanf("%d/%d:%d:%d",&X,&HH,&MM,&SS);
pt[i]+=(X-1)*20*60+HH*60*60+MM*60+SS;
}
}
else if(i==N){
for(int j=0;j<M;j++){
//printf("j=%d\n",j);
scanf(" %c",&S);
assert(S=='+'||S=='-'||S=='?');
//printf("S=%c\n",S);
if(S=='-'){
char t='a';
while(t!='\n'&&t!=' '){
scanf("%c",&t);
}
continue;
// pt[mi]+=(t-'0')*20*60+HH*60*60+MM*60+SS;
}
ts[mi]++;
scanf("%d/%d:%d:%d",&X,&HH,&MM,&SS);
pt[mi]+=(X-1)*20*60+HH*60*60+MM*60+SS;
}
}
}
for(int i=0;i<N;i++){
AT[i]=make_pair(ii(ts[i],pt[i]),tn[i]);
}
sort(AT,AT+N,cmp);
for(int i=0;i<N;i++){
// printf("%s\t%d\t%d\n",AT[i].sc,AT[i].fr.fr,AT[i].fr.sc);
if(strcmp(AT[i].sc,mt)==0){
printf("%d\n",i+1);
return 0;
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |