# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
222513 | rainy | Grudanje (COCI19_grudanje) | C++14 | 2097 ms | 77560 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |