Submission #222372

# Submission time Handle Problem Language Result Execution time Memory
222372 2020-04-13T05:41:37 Z jamielim ACM (COCI19_acm) C++14
20 / 50
7 ms 640 KB
#include<bits/stdc++.h>
using namespace std;

char team[]="NijeZivotJedanACM\0";
long long t[2][1005][20];

int main(){
	int n,m;
	scanf(" %d%d",&n,&m);
	char str[n][25]; int hr,mi,sec;
	int ours=-1;
	for(int i=0;i<n;i++){
		scanf(" %s",str[i]);
		for(int j=0;j<m;j++){
			char parse[15];
			scanf(" %s",parse);
			if(parse[0]=='-'){
				t[0][i][j]=t[1][i][j]=0;continue;
			}
			t[0][i][j]=parse[1]-'0';
			hr=10*(parse[3]-'0')+(parse[4]-'0');
			mi=10*(parse[6]-'0')+(parse[7]-'0');
			sec=10*(parse[9]-'0')+(parse[10]-'0');
			t[1][i][j]=hr*3600+mi*60+sec;
		}
		if(strcmp(str[i],team)==0)ours=i;
	}
	scanf(" %s",team);
	for(int j=0;j<m;j++){
		char parse[15];
		scanf(" %s",parse);
		if(parse[0]=='-'){
			t[0][ours][j]=t[1][ours][j]=0;continue;
		}
		t[0][ours][j]=parse[1]-'0';
		hr=10*(parse[3]-'0')+(parse[4]-'0');
		mi=10*(parse[6]-'0')+(parse[7]-'0');
		sec=10*(parse[9]-'0')+(parse[10]-'0');
		t[1][ours][j]=hr*3600+mi*60+sec;
	}
	int maxprob[n];
	for(int i=0;i<n;i++){
		maxprob[i]=0;
		for(int j=0;j<m;j++){
			if(t[0][i][j]==0)continue;
			maxprob[i]++;
		}
	}
	int prob=0;
	for(int j=0;j<m;j++){
		if(t[0][ours][j]!=0)prob++;
	}
	long long ourtime=0;
	for(int i=0;i<m;i++){
		if(t[0][ours][i]==0)continue;
		ourtime+=20*(t[0][ours][i]-1)+t[1][ours][i];
	}
	int ans=1;
	for(int i=0;i<n;i++){
		if(i==ours)continue;
		if(maxprob[i]>prob){
			//printf("a%d\n",i);
			ans++;
		}else if(maxprob[i]==prob){
			long long theirtime=0;
			for(int j=0;j<m;j++){
				if(t[0][i][j]==0)continue;
				theirtime+=20*(t[0][i][j]-1)+t[1][i][j];
				//printf("%lld %lld\n",t[0][i][j],t[1][i][j]);
			}
			//printf("b%lld\n",theirtime);
			if(theirtime<ourtime){ans++;}
			else if(theirtime==ourtime){
				if(strcmp(team,str[i])>0){ans++;}
			}
		}
	}
	printf("%d",ans);
}
/*
7 4
NisamSadaNistaDonio +1/03:59:59 +3/03:42:02 +2/00:14:59 ?1/04:56:12
JeLiMojKockaSeUmio ?4/04:00:00 -3 +1/00:10:01 +9/03:04:42
OstaviDobroJe ?4/04:59:59 -1 +2/00:24:15 +8/03:24:45
DobroJeOstavi +1/01:42:53 - ?9/04:58:23 ?1/04:34:43
NijeZivotJedanACM ?2/04:50:05 ?4/04:32:12 +2/01:32:45 ?1/04:59:59
KoSeToSeta ?1/04:23:32 - +9/01:00:00 -9
SipSipSipSipSipSip - - - ?9/04:00:00
NijeZivotJedanACM -2 +4/04:32:12 +2/01:32:45 +1/04:59:59

 */

Compilation message

acm.cpp: In function 'int main()':
acm.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf(" %d%d",&n,&m);
  ~~~~~^~~~~~~~~~~~~~~
acm.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf(" %s",str[i]);
   ~~~~~^~~~~~~~~~~~~~
acm.cpp:16:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf(" %s",parse);
    ~~~~~^~~~~~~~~~~~~
acm.cpp:28:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf(" %s",team);
  ~~~~~^~~~~~~~~~~~
acm.cpp:31:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf(" %s",parse);
   ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB Output is correct
2 Incorrect 6 ms 640 KB Output isn't correct
3 Correct 4 ms 384 KB Output is correct
4 Incorrect 7 ms 640 KB Output isn't correct
5 Incorrect 6 ms 640 KB Output isn't correct