답안 #222381

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
222381 2020-04-13T05:59:50 Z rainy ACM (COCI19_acm) C++14
0 / 50
11 ms 384 KB
#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);
                if(S=='-'){
                    char t;
                    scanf("%c",&t);
                    if(t==' '||t=='\n')continue;
                    scanf("/%d:%d:%d ",&HH,&MM,&SS);
                    // 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);
                //printf("S=%c\n",S);
                if(S=='-'){
                    char t;
                    scanf("%c",&t);
                    if(t==' '||t=='\n')continue;
                    scanf("/%d:%d:%d",&HH,&MM,&SS);
                    // 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

acm.cpp: In function 'int main()':
acm.cpp:28:27: warning: format '%s' expects argument of type 'char*', but argument 2 has type 'char (*)[25]' [-Wformat=]
         scanf(" %s",&tn[i]);
                     ~~~~~~^
acm.cpp:48:51: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'char*' [-Wformat=]
                 scanf("%d/%d:%d:%d",&X,&HH,&MM,&SS);
                                     ~~            ^
acm.cpp:65:51: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'char*' [-Wformat=]
                 scanf("%d/%d:%d:%d",&X,&HH,&MM,&SS);
                                     ~~            ^
acm.cpp:24:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&N,&M);
     ~~~~~^~~~~~~~~~~~~~
acm.cpp:28:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf(" %s",&tn[i]);
         ~~~~~^~~~~~~~~~~~~~
acm.cpp:34:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
                 scanf("%c",&t);
                 ~~~~~^~~~~~~~~
acm.cpp:39:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
                 scanf(" %c",&S);
                 ~~~~~^~~~~~~~~~
acm.cpp:42:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
                     scanf("%c",&t);
                     ~~~~~^~~~~~~~~
acm.cpp:44:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
                     scanf("/%d:%d:%d ",&HH,&MM,&SS);
                     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
acm.cpp:48:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
                 scanf("%d/%d:%d:%d",&X,&HH,&MM,&SS);
                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
acm.cpp:55:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
                 scanf(" %c",&S);
                 ~~~~~^~~~~~~~~~
acm.cpp:59:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
                     scanf("%c",&t);
                     ~~~~~^~~~~~~~~
acm.cpp:61:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
                     scanf("/%d:%d:%d",&HH,&MM,&SS);
                     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
acm.cpp:65:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
                 scanf("%d/%d:%d:%d",&X,&HH,&MM,&SS);
                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Incorrect 9 ms 384 KB Output isn't correct
3 Incorrect 4 ms 256 KB Output isn't correct
4 Incorrect 11 ms 384 KB Output isn't correct
5 Incorrect 10 ms 384 KB Output isn't correct