제출 #222513

#제출 시각아이디문제언어결과실행 시간메모리
222513rainyGrudanje (COCI19_grudanje)C++14
14 / 70
2097 ms77560 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; multiset<char>ss[MAXQ]; int no[MAXQ],tno=0; 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]--; } memset(no,0,sizeof(no)); for(int j=0;j<Q;j++){ for(int k=A[j];k<=B[j];k++){ char cc=wd[k]; ss[j].insert(cc); if(ss[j].count(cc)==2){ no[j]++; if(no[j]==1)tno++; } } } for(int i=0;i<N+1;i++){ bool p=true; //for(int i=0;i<N;i++)printf("%c",wd[i]);; //printf("\n"); if(i!=0){ for(int j=0;j<Q;j++){ if(A[j]<=P[i]&&P[i]<=B[j]){ ss[j].erase(ss[j].find(wd[P[i]])); if(ss[j].count(wd[P[i]])==1){ //printf("(%d %d %d %d)\n",i,j,P[i],wd[P[i]]); no[j]--; if(no[j]==0)tno--; } } } } if(tno==0){ printf("%d\n",i); return 0; } } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

grudanje.cpp: In function 'int main()':
grudanje.cpp:14:17: warning: format '%s' expects argument of type 'char*', but argument 2 has type 'char (*)[112345]' [-Wformat=]
   scanf("%s",&wd);
              ~~~^
grudanje.cpp:38:10: warning: unused variable 'p' [-Wunused-variable]
     bool p=true;
          ^
grudanje.cpp:14:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s",&wd);
   ~~~~~^~~~~~~~~~
grudanje.cpp:19:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&Q);
   ~~~~~^~~~~~~~~
grudanje.cpp:20: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:22: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...