# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
256786 | 2020-08-03T08:02:15 Z | 송준혁(#5037) | Snake Escaping (JOI18_snake_escaping) | C++17 | 2000 ms | 4452 KB |
#include <bits/stdc++.h> #define pb push_back #define lb lower_bound #define fi first #define se second #define mup(a,x) a=min(a,x) #define Mup(a,x) a=max(a,x) #define INF 1234567890 using namespace std; typedef long long LL; typedef pair<int,int> pii; int N, Q; int A[1010101]; char str[22]; int qm(int lv, int x){ if (lv==N) return A[x]; if (str[lv] == '?') return qm(lv+1, x*2+1)+qm(lv+1, x*2); return qm(lv+1, x*2+str[lv]-'0'); } int main(){ scanf("%d %d", &N, &Q); for (int i=0; i<(1<<N); i++) scanf("%1d", &A[i]); while (Q--){ scanf("%s", str); printf("%d\n", qm(0, 0)); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Correct | 1 ms | 256 KB | Output is correct |
6 | Correct | 1 ms | 256 KB | Output is correct |
7 | Correct | 1 ms | 256 KB | Output is correct |
8 | Correct | 7 ms | 384 KB | Output is correct |
9 | Correct | 1 ms | 256 KB | Output is correct |
10 | Correct | 1 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Correct | 1 ms | 256 KB | Output is correct |
6 | Correct | 1 ms | 256 KB | Output is correct |
7 | Correct | 1 ms | 256 KB | Output is correct |
8 | Correct | 7 ms | 384 KB | Output is correct |
9 | Correct | 1 ms | 256 KB | Output is correct |
10 | Correct | 1 ms | 256 KB | Output is correct |
11 | Correct | 583 ms | 4344 KB | Output is correct |
12 | Correct | 749 ms | 3960 KB | Output is correct |
13 | Correct | 349 ms | 3232 KB | Output is correct |
14 | Correct | 339 ms | 3400 KB | Output is correct |
15 | Correct | 785 ms | 4452 KB | Output is correct |
16 | Correct | 475 ms | 3496 KB | Output is correct |
17 | Correct | 459 ms | 3624 KB | Output is correct |
18 | Execution timed out | 2079 ms | 1928 KB | Time limit exceeded |
19 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Correct | 1 ms | 256 KB | Output is correct |
6 | Correct | 1 ms | 256 KB | Output is correct |
7 | Correct | 1 ms | 256 KB | Output is correct |
8 | Correct | 7 ms | 384 KB | Output is correct |
9 | Correct | 1 ms | 256 KB | Output is correct |
10 | Correct | 1 ms | 256 KB | Output is correct |
11 | Correct | 583 ms | 4344 KB | Output is correct |
12 | Correct | 749 ms | 3960 KB | Output is correct |
13 | Correct | 349 ms | 3232 KB | Output is correct |
14 | Correct | 339 ms | 3400 KB | Output is correct |
15 | Correct | 785 ms | 4452 KB | Output is correct |
16 | Correct | 475 ms | 3496 KB | Output is correct |
17 | Correct | 459 ms | 3624 KB | Output is correct |
18 | Execution timed out | 2079 ms | 1928 KB | Time limit exceeded |
19 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Correct | 1 ms | 256 KB | Output is correct |
6 | Correct | 1 ms | 256 KB | Output is correct |
7 | Correct | 1 ms | 256 KB | Output is correct |
8 | Correct | 7 ms | 384 KB | Output is correct |
9 | Correct | 1 ms | 256 KB | Output is correct |
10 | Correct | 1 ms | 256 KB | Output is correct |
11 | Incorrect | 104 ms | 4288 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Correct | 1 ms | 256 KB | Output is correct |
6 | Correct | 1 ms | 256 KB | Output is correct |
7 | Correct | 1 ms | 256 KB | Output is correct |
8 | Correct | 7 ms | 384 KB | Output is correct |
9 | Correct | 1 ms | 256 KB | Output is correct |
10 | Correct | 1 ms | 256 KB | Output is correct |
11 | Correct | 583 ms | 4344 KB | Output is correct |
12 | Correct | 749 ms | 3960 KB | Output is correct |
13 | Correct | 349 ms | 3232 KB | Output is correct |
14 | Correct | 339 ms | 3400 KB | Output is correct |
15 | Correct | 785 ms | 4452 KB | Output is correct |
16 | Correct | 475 ms | 3496 KB | Output is correct |
17 | Correct | 459 ms | 3624 KB | Output is correct |
18 | Execution timed out | 2079 ms | 1928 KB | Time limit exceeded |
19 | Halted | 0 ms | 0 KB | - |