# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
251259 |
2020-07-20T16:19:47 Z |
jimmy123 |
Lollipop (POI11_liz) |
C++14 |
|
447 ms |
23160 KB |
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cassert>
using namespace std;
const int MAX_N=1000010;
char c[MAX_N]; int gdzie[2*MAX_N], e[2];
int main(void) {
int n, m, i, j=0, k, mx=0;
assert(scanf("%d%d%s", &n, &m, c)==3);
for(i=0; i<n; ++i)
c[i]=(c[i]=='T'?2:1);
for(j=0; j<n; ++j) {
if(c[j]==1)
break;
}
memset(gdzie, -1, sizeof(int)*2*(n+1));
for(i=j; i<n; ++i) {
mx+=c[i]; gdzie[mx]=i;
e[mx&1]=max(e[mx&1], mx);
}
printf("%d %d\n", e[0], e[1]);
while(m--) {
assert(scanf("%d", &k)==1);
if(j==n) {
if((k&1) || k>(n<<1))
puts("NIE");
else
printf("%d %d\n", 1, k>>1);
}
else {
if(!(k&1) && k<=2*j)
printf("%d %d\n", 1, k>>1);
else if(k<=mx) {
if(gdzie[k]!=-1)
printf("%d %d\n", j+1, gdzie[k]+1);
else
printf("%d %d\n", j+2, gdzie[k+1]+1);
}
else {
if(k<=(j<<1)+e[k&1])
printf("%d %d\n", j-((k-e[k&1])>>1)+1, gdzie[e[k&1]]+1);
else
puts("NIE");
}
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
Liczba calkowita spoza zakresu |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
Liczba calkowita spoza zakresu |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
Liczba calkowita spoza zakresu |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
512 KB |
Liczba calkowita spoza zakresu |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
768 KB |
Liczba calkowita spoza zakresu |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
29 ms |
2168 KB |
Liczba calkowita spoza zakresu |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
28 ms |
2160 KB |
Liczba calkowita spoza zakresu |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
110 ms |
5496 KB |
Liczba calkowita spoza zakresu |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
275 ms |
11964 KB |
Liczba calkowita spoza zakresu |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
236 ms |
12152 KB |
Liczba calkowita spoza zakresu |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
447 ms |
21752 KB |
Liczba calkowita spoza zakresu |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
439 ms |
23160 KB |
Liczba calkowita spoza zakresu |
2 |
Halted |
0 ms |
0 KB |
- |