# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
29559 | 2017-07-20T06:08:31 Z | 시제연(#1241) | Lollipop (POI11_liz) | C++11 | 613 ms | 13964 KB |
#include <bits/stdc++.h> using namespace std; int n, m, p, fk = -1; int lol[2000100]; vector<int> loc; char str[1000100]; bool good(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 idx = upper_bound(loc.begin(),loc.end(),k)-loc.begin(); if (idx==loc.size()) return false; int l = loc[idx]; if (~lol[l-k]&&lol[l]) { printf("%d %d\n",lol[l-k]+1,lol[l]); return true; } return false; } int main() { int i, t = 1; scanf("%d%d",&n,&m); scanf("%s",str); memset(lol,-1,sizeof(lol)); lol[0] = 0; for (i=0;i<n;i++) { if (str[i]=='T') {p+=2; lol[p] = i+1;} else {p++; lol[p] = i+1; loc.push_back(p); if (fk<0) fk = p;} } for (i=0;i<m;i++) { int k; scanf("%d",&k); if (~lol[k]) { printf("%d %d\n",1,lol[k]); continue; } if (!good(k)) { printf("NIE\n"); } } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 10808 KB | Output is correct |
2 | Correct | 0 ms | 10808 KB | Output is correct |
3 | Correct | 0 ms | 10808 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 10808 KB | Output is correct |
2 | Correct | 0 ms | 10808 KB | Output is correct |
3 | Correct | 0 ms | 10808 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 10808 KB | Output is correct |
2 | Correct | 0 ms | 10808 KB | Output is correct |
3 | Correct | 3 ms | 10808 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 10808 KB | Output is correct |
2 | Correct | 3 ms | 10808 KB | Output is correct |
3 | Correct | 3 ms | 10948 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 10808 KB | Output is correct |
2 | Correct | 6 ms | 10948 KB | Output is correct |
3 | Correct | 39 ms | 10808 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 33 ms | 10808 KB | Output is correct |
2 | Correct | 179 ms | 11080 KB | Output is correct |
3 | Correct | 79 ms | 10808 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 33 ms | 10948 KB | Output is correct |
2 | Correct | 33 ms | 11660 KB | Output is correct |
3 | Correct | 86 ms | 10808 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 189 ms | 10808 KB | Output is correct |
2 | Correct | 166 ms | 11276 KB | Output is correct |
3 | Correct | 253 ms | 10948 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 363 ms | 10948 KB | Output is correct |
2 | Correct | 383 ms | 11276 KB | Output is correct |
3 | Correct | 429 ms | 11080 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 313 ms | 11660 KB | Output is correct |
2 | Correct | 439 ms | 13964 KB | Output is correct |
3 | Correct | 413 ms | 10948 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 613 ms | 10808 KB | Output is correct |
2 | Correct | 399 ms | 13964 KB | Output is correct |
3 | Runtime error | 3 ms | 10808 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 11660 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |