# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
251265 | 2020-07-20T16:23:00 Z | jimmy123 | Lollipop (POI11_liz) | C++14 | 552 ms | 19832 KB |
#include <stdio.h> using namespace std; const int MAX_NUM = 1000000; char data[MAX_NUM+1]; int location[2*MAX_NUM+1]={0}; int main(){ int num=0, query=0, cnt=1, pos=0, first_W=-1, last_W=-1, range, i; bool isfirst = true; scanf("%d%d%s", &num, &query, data); for(i=0;i<num;++i){ if(data[i] == 'W'){ pos += 1; last_W = pos; if(isfirst){ first_W = pos; isfirst = false; } } else pos += 2; location[pos] = cnt; cnt += 1; } for(i=0;i<query;++i){ if(i != 0) printf("\n"); scanf("%d", &range); if(location[range] != 0){ printf("1 %d", location[range]); continue; } if(first_W != -1 && first_W < range){ if(location[first_W+range] != 0){ printf("%d %d", location[first_W]+1, location[first_W+range]); continue; } else if(location[first_W+range-1] != 0){ printf("%d %d", location[first_W-1]+1, location[first_W+range-1]); continue; } } if(last_W != -1 && last_W > range){ if(location[last_W-range] != 0){ printf("%d %d", location[last_W-range]+1, location[last_W]); continue; } else if(location[last_W-range-1] != 0){ printf("%d %d", location[last_W-range-1]+1, location[last_W-1]); continue; } } // 找不到解 printf("NIE"); } //delete []data; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Correct | 0 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 11 ms | 512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 512 KB | Output is correct |
2 | Correct | 4 ms | 512 KB | Output is correct |
3 | Correct | 4 ms | 512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 768 KB | Output is correct |
2 | Correct | 8 ms | 768 KB | Output is correct |
3 | Correct | 36 ms | 1704 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 29 ms | 1784 KB | Output is correct |
2 | Correct | 140 ms | 4472 KB | Output is correct |
3 | Correct | 67 ms | 2808 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 25 ms | 1784 KB | Output is correct |
2 | Correct | 34 ms | 1528 KB | Output is correct |
3 | Correct | 79 ms | 3320 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 113 ms | 4216 KB | Output is correct |
2 | Correct | 110 ms | 3704 KB | Output is correct |
3 | Correct | 149 ms | 6136 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 226 ms | 9720 KB | Output is correct |
2 | Correct | 218 ms | 9080 KB | Output is correct |
3 | Correct | 257 ms | 12024 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 202 ms | 10104 KB | Output is correct |
2 | Correct | 249 ms | 10488 KB | Output is correct |
3 | Correct | 301 ms | 14200 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 447 ms | 19068 KB | Output is correct |
2 | Correct | 356 ms | 16360 KB | Output is correct |
3 | Runtime error | 18 ms | 16640 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 552 ms | 19832 KB | Bledny przedzial |
2 | Halted | 0 ms | 0 KB | - |