# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
76730 | 2018-09-16T17:41:09 Z | farukkastamonuda | Lollipop (POI11_liz) | C++14 | 549 ms | 81652 KB |
#include <bits/stdc++.h> #define li 1000005 using namespace std; int n,m,lol[li*2],p,fk=-1,k; char s[li]; vector<int> v; bool naive(int k){ if(fk<0) return false; if(~lol[fk]&&~lol[fk+k]){ printf("%d %d\n",lol[fk]+1,lol[fk+k]); return true; } int bul=upper_bound(v.begin(),v.end(),k)-v.begin(); if(bul==(int)v.size()){ return false; } int l=v[bul]; if(~lol[l-k]&&lol[l]){ printf("%d %d\n",lol[l-k]+1,lol[l]); return true; } return false; } int main(){ scanf("%d %d",&n,&m); scanf("%s",s); memset(lol,-1,sizeof(lol)); lol[0]=0; for(int i=0;i<n;i++){ if(s[i]=='T'){ p+=2; lol[p]=i+1; } else{ p+=1; lol[p]=i+1; v.push_back(p); if(fk<0) fk=p; } } for(int i=1;i<=m;i++){ scanf("%d",&k); if(~lol[k]){ printf("1 %d\n",lol[k]); } else{ if(!naive(k)) printf("NIE\n"); } } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 8184 KB | Output is correct |
2 | Correct | 9 ms | 8312 KB | Output is correct |
3 | Correct | 9 ms | 8312 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 8340 KB | Output is correct |
2 | Correct | 11 ms | 8688 KB | Output is correct |
3 | Correct | 9 ms | 8876 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 8876 KB | Output is correct |
2 | Correct | 9 ms | 8876 KB | Output is correct |
3 | Correct | 16 ms | 9156 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 18 ms | 9156 KB | Output is correct |
2 | Correct | 12 ms | 9156 KB | Output is correct |
3 | Correct | 12 ms | 9156 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 9352 KB | Output is correct |
2 | Correct | 19 ms | 9612 KB | Output is correct |
3 | Correct | 45 ms | 10776 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 38 ms | 11212 KB | Output is correct |
2 | Correct | 162 ms | 16232 KB | Output is correct |
3 | Correct | 84 ms | 16232 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 38 ms | 16232 KB | Output is correct |
2 | Correct | 47 ms | 16260 KB | Output is correct |
3 | Correct | 83 ms | 18420 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 155 ms | 21068 KB | Output is correct |
2 | Correct | 121 ms | 23020 KB | Output is correct |
3 | Correct | 180 ms | 27460 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 308 ms | 33460 KB | Output is correct |
2 | Correct | 352 ms | 37744 KB | Output is correct |
3 | Correct | 332 ms | 44616 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 273 ms | 46180 KB | Output is correct |
2 | Correct | 325 ms | 53708 KB | Output is correct |
3 | Correct | 393 ms | 60268 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 549 ms | 70656 KB | Output is correct |
2 | Correct | 489 ms | 79588 KB | Output is correct |
3 | Runtime error | 27 ms | 79588 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 30 ms | 81652 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |