# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
222493 | rainy | Grudanje (COCI19_grudanje) | C++14 | 2094 ms | 1784 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;
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)
# | 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... |