# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
888188 | 2023-12-16T09:57:54 Z | Unforgettablepl | Snake Escaping (JOI18_snake_escaping) | C++17 | 2000 ms | 65536 KB |
#include <bits/stdc++.h> using namespace std; #define int long long const int INF = INT64_MAX; int arr[8192]; 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; } map<string,int> memo; for (int i = 0; i < q; i++) { string a;cin>>a; reverse(a.begin(), a.end()); if(memo.count(a)){cout<<memo[a]<<'\n';continue;} 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'; memo[a]=ans; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 500 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 500 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 261 ms | 4396 KB | Output is correct |
12 | Correct | 348 ms | 4612 KB | Output is correct |
13 | Correct | 447 ms | 3936 KB | Output is correct |
14 | Correct | 401 ms | 3696 KB | Output is correct |
15 | Correct | 420 ms | 4692 KB | Output is correct |
16 | Correct | 481 ms | 4984 KB | Output is correct |
17 | Correct | 581 ms | 8216 KB | Output is correct |
18 | Correct | 143 ms | 5460 KB | Output is correct |
19 | Correct | 247 ms | 2388 KB | Output is correct |
20 | Correct | 352 ms | 4204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 500 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 261 ms | 4396 KB | Output is correct |
12 | Correct | 348 ms | 4612 KB | Output is correct |
13 | Correct | 447 ms | 3936 KB | Output is correct |
14 | Correct | 401 ms | 3696 KB | Output is correct |
15 | Correct | 420 ms | 4692 KB | Output is correct |
16 | Correct | 481 ms | 4984 KB | Output is correct |
17 | Correct | 581 ms | 8216 KB | Output is correct |
18 | Correct | 143 ms | 5460 KB | Output is correct |
19 | Correct | 247 ms | 2388 KB | Output is correct |
20 | Correct | 352 ms | 4204 KB | Output is correct |
21 | Correct | 380 ms | 16816 KB | Output is correct |
22 | Correct | 481 ms | 15824 KB | Output is correct |
23 | Correct | 891 ms | 31388 KB | Output is correct |
24 | Correct | 645 ms | 21212 KB | Output is correct |
25 | Correct | 718 ms | 19336 KB | Output is correct |
26 | Correct | 1229 ms | 41376 KB | Output is correct |
27 | Execution timed out | 2013 ms | 65536 KB | Time limit exceeded |
28 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 500 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Runtime error | 1 ms | 600 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 | 500 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 261 ms | 4396 KB | Output is correct |
12 | Correct | 348 ms | 4612 KB | Output is correct |
13 | Correct | 447 ms | 3936 KB | Output is correct |
14 | Correct | 401 ms | 3696 KB | Output is correct |
15 | Correct | 420 ms | 4692 KB | Output is correct |
16 | Correct | 481 ms | 4984 KB | Output is correct |
17 | Correct | 581 ms | 8216 KB | Output is correct |
18 | Correct | 143 ms | 5460 KB | Output is correct |
19 | Correct | 247 ms | 2388 KB | Output is correct |
20 | Correct | 352 ms | 4204 KB | Output is correct |
21 | Correct | 380 ms | 16816 KB | Output is correct |
22 | Correct | 481 ms | 15824 KB | Output is correct |
23 | Correct | 891 ms | 31388 KB | Output is correct |
24 | Correct | 645 ms | 21212 KB | Output is correct |
25 | Correct | 718 ms | 19336 KB | Output is correct |
26 | Correct | 1229 ms | 41376 KB | Output is correct |
27 | Execution timed out | 2013 ms | 65536 KB | Time limit exceeded |
28 | Halted | 0 ms | 0 KB | - |