Submission #222473

#TimeUsernameProblemLanguageResultExecution timeMemory
222473rainyGrudanje (COCI19_grudanje)C++14
0 / 70
30 ms1272 KiB
#include<bits/stdc++.h> #define MAXN 112345 #define MAXQ 112345 using namespace std; char wd[MAXN]; int N; int Q,A[MAXQ],B[MAXQ]; int P[MAXN]; bool st3=true; int main(){ scanf("%s",&wd); for(int i=0;i<10;i++){ if(wd[i]!='a'&&wd[i]!='\0')st3=false; if(wd[i]=='\0'){N=i;break;} } scanf("%d",&Q); for(int i=0;i<Q;i++){scanf("%d%d",&A[i],&B[i]);A[i]--;B[i]--;} for(int i=1;i<N+1;i++){ scanf("%d",&P[i]); P[i]--; } for(int i=0;i<N+1;i++){ bool p=true; if(i!=0){ wd[P[i]]='*'; } //for(int i=0;i<N;i++)printf("%c",wd[i]);; //printf("\n"); for(int j=0;j<Q;j++){ set<char>sc; for(int k=A[j];k<=B[j];k++){ char cc=wd[k]; if(cc=='*')continue; if(sc.count(cc)==1){ p=false;break; } sc.insert(cc); } if(!p)break; } if(p){ printf("%d\n",i); return 0; } } return 0; }

Compilation message (stderr)

grudanje.cpp: In function 'int main()':
grudanje.cpp:12:19: warning: format '%s' expects argument of type 'char*', but argument 2 has type 'char (*)[112345]' [-Wformat=]
     scanf("%s",&wd);
                ~~~^
grudanje.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%s",&wd);
     ~~~~~^~~~~~~~~~
grudanje.cpp:17:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&Q);
     ~~~~~^~~~~~~~~
grudanje.cpp:18:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=0;i<Q;i++){scanf("%d%d",&A[i],&B[i]);A[i]--;B[i]--;}
                          ~~~~~^~~~~~~~~~~~~~~~~~~~
grudanje.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&P[i]);
         ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...