(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #222493

#TimeUsernameProblemLanguageResultExecution timeMemory
222493rainyGrudanje (COCI19_grudanje)C++14
35 / 70
2094 ms1784 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<MAXN;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:17: warning: format '%s' expects argument of type 'char*', but argument 2 has type 'char (*)[112345]' [-Wformat=]
   scanf("%s",&wd);
              ~~~^
grudanje.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s",&wd);
   ~~~~~^~~~~~~~~~
grudanje.cpp:17:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&Q);
   ~~~~~^~~~~~~~~
grudanje.cpp:18:29: 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:10: 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...