# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
251270 | 2020-07-20T16:29:09 Z | jimmy123 | Lollipop (POI11_liz) | C++14 | 468 ms | 19448 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; } } // 找不到解 puts("NIE"); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 256 KB | Bledny format odpowiedzi: Nieoczekiwany znak |
2 | Halted | 0 ms | 0 KB | - |
# | 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 | Incorrect | 0 ms | 256 KB | Bledny format odpowiedzi: Nieoczekiwany znak |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 256 KB | Bledny format odpowiedzi: Nieoczekiwany znak |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 384 KB | Bledny format odpowiedzi: Nieoczekiwany znak |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 12 ms | 640 KB | Bledny format odpowiedzi: Nieoczekiwany znak |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 33 ms | 1520 KB | Bledny format odpowiedzi: Nieoczekiwany znak |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 39 ms | 1528 KB | Bledny format odpowiedzi: Nieoczekiwany znak |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 123 ms | 3832 KB | Bledny format odpowiedzi: Nieoczekiwany znak |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 260 ms | 9080 KB | Bledny format odpowiedzi: Nieoczekiwany znak |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 190 ms | 9464 KB | Bledny format odpowiedzi: Nieoczekiwany znak |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 448 ms | 18716 KB | Bledny format odpowiedzi: Nieoczekiwany znak |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 468 ms | 19448 KB | Bledny format odpowiedzi: Nieoczekiwany znak |
2 | Halted | 0 ms | 0 KB | - |