# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
888183 | 2023-12-16T09:52:58 Z | Unforgettablepl | Snake Escaping (JOI18_snake_escaping) | C++17 | 2000 ms | 14032 KB |
#include <bits/stdc++.h> using namespace std; #define int long long const int INF = INT64_MAX; int arr[1024]; int ask(string &a,int perm){ int idx = 0; for(int x=0;x<a.size();x++){ if(a[x]=='1')idx|=(1<<x); else if(a[x]=='?'){idx|=((perm&1)<<x);perm>>=1;} } return arr[idx]; } int32_t main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int L,q; cin >> L >> q; for(int i=0;i<(1<<L);i++){ char a;cin>>a;a-='0'; arr[i]=a; } for (int i = 0; i < q; i++) { string a;cin>>a; reverse(a.begin(), a.end()); int n = count(a.begin(), a.end(),'?'); int ans = 0; for(int perm = 0;perm<(1<<n);perm++){ ans+=ask(a,perm); } cout << ans << '\n'; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 2 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 2 ms | 344 KB | Output is correct |
8 | Correct | 8 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 2 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 2 ms | 344 KB | Output is correct |
8 | Correct | 8 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 344 KB | Output is correct |
11 | Correct | 506 ms | 13656 KB | Output is correct |
12 | Correct | 963 ms | 13716 KB | Output is correct |
13 | Correct | 408 ms | 13192 KB | Output is correct |
14 | Correct | 462 ms | 13076 KB | Output is correct |
15 | Correct | 1119 ms | 14032 KB | Output is correct |
16 | Correct | 570 ms | 13136 KB | Output is correct |
17 | Correct | 580 ms | 13220 KB | Output is correct |
18 | Execution timed out | 2032 ms | 4704 KB | Time limit exceeded |
19 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 2 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 2 ms | 344 KB | Output is correct |
8 | Correct | 8 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 344 KB | Output is correct |
11 | Correct | 506 ms | 13656 KB | Output is correct |
12 | Correct | 963 ms | 13716 KB | Output is correct |
13 | Correct | 408 ms | 13192 KB | Output is correct |
14 | Correct | 462 ms | 13076 KB | Output is correct |
15 | Correct | 1119 ms | 14032 KB | Output is correct |
16 | Correct | 570 ms | 13136 KB | Output is correct |
17 | Correct | 580 ms | 13220 KB | Output is correct |
18 | Execution timed out | 2032 ms | 4704 KB | Time limit exceeded |
19 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 2 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 2 ms | 344 KB | Output is correct |
8 | Correct | 8 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 344 KB | Output is correct |
11 | Runtime error | 1 ms | 604 KB | Execution killed with signal 11 |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 2 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 2 ms | 344 KB | Output is correct |
8 | Correct | 8 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 344 KB | Output is correct |
11 | Correct | 506 ms | 13656 KB | Output is correct |
12 | Correct | 963 ms | 13716 KB | Output is correct |
13 | Correct | 408 ms | 13192 KB | Output is correct |
14 | Correct | 462 ms | 13076 KB | Output is correct |
15 | Correct | 1119 ms | 14032 KB | Output is correct |
16 | Correct | 570 ms | 13136 KB | Output is correct |
17 | Correct | 580 ms | 13220 KB | Output is correct |
18 | Execution timed out | 2032 ms | 4704 KB | Time limit exceeded |
19 | Halted | 0 ms | 0 KB | - |