# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1115781 | 2024-11-21T00:16:22 Z | staszic_ojuz | Snake Escaping (JOI18_snake_escaping) | C++17 | 2000 ms | 4844 KB |
#include <bits/stdc++.h> using namespace std; string bin(int n,int wielk){ string napis; while(n>0){ napis+=n%2+48; n/=2; } while(napis.size()!=wielk) napis+='0'; reverse(napis.begin(),napis.end()); return napis; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,k; string napis,kolejne_snejki; cin >> n >> k >> napis; for(int i=0;i<k;++i){ cin >> kolejne_snejki; int suma=0; for(int j=0;j<(1<<n);++j){ string cos=bin(j,n); bool jest = true; for(int p=0;p<n;++p){ if(cos[p]!=kolejne_snejki[p] && kolejne_snejki[p]!='?'){ jest=false; break; } } if(jest==true){ suma+=napis[j]-48; } } cout << suma << endl; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 29 ms | 336 KB | Output is correct |
2 | Correct | 29 ms | 336 KB | Output is correct |
3 | Correct | 40 ms | 336 KB | Output is correct |
4 | Correct | 28 ms | 336 KB | Output is correct |
5 | Correct | 29 ms | 336 KB | Output is correct |
6 | Correct | 29 ms | 336 KB | Output is correct |
7 | Correct | 29 ms | 336 KB | Output is correct |
8 | Correct | 33 ms | 336 KB | Output is correct |
9 | Correct | 31 ms | 336 KB | Output is correct |
10 | Correct | 28 ms | 336 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 29 ms | 336 KB | Output is correct |
2 | Correct | 29 ms | 336 KB | Output is correct |
3 | Correct | 40 ms | 336 KB | Output is correct |
4 | Correct | 28 ms | 336 KB | Output is correct |
5 | Correct | 29 ms | 336 KB | Output is correct |
6 | Correct | 29 ms | 336 KB | Output is correct |
7 | Correct | 29 ms | 336 KB | Output is correct |
8 | Correct | 33 ms | 336 KB | Output is correct |
9 | Correct | 31 ms | 336 KB | Output is correct |
10 | Correct | 28 ms | 336 KB | Output is correct |
11 | Execution timed out | 2062 ms | 1576 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 29 ms | 336 KB | Output is correct |
2 | Correct | 29 ms | 336 KB | Output is correct |
3 | Correct | 40 ms | 336 KB | Output is correct |
4 | Correct | 28 ms | 336 KB | Output is correct |
5 | Correct | 29 ms | 336 KB | Output is correct |
6 | Correct | 29 ms | 336 KB | Output is correct |
7 | Correct | 29 ms | 336 KB | Output is correct |
8 | Correct | 33 ms | 336 KB | Output is correct |
9 | Correct | 31 ms | 336 KB | Output is correct |
10 | Correct | 28 ms | 336 KB | Output is correct |
11 | Execution timed out | 2062 ms | 1576 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 29 ms | 336 KB | Output is correct |
2 | Correct | 29 ms | 336 KB | Output is correct |
3 | Correct | 40 ms | 336 KB | Output is correct |
4 | Correct | 28 ms | 336 KB | Output is correct |
5 | Correct | 29 ms | 336 KB | Output is correct |
6 | Correct | 29 ms | 336 KB | Output is correct |
7 | Correct | 29 ms | 336 KB | Output is correct |
8 | Correct | 33 ms | 336 KB | Output is correct |
9 | Correct | 31 ms | 336 KB | Output is correct |
10 | Correct | 28 ms | 336 KB | Output is correct |
11 | Execution timed out | 2037 ms | 4844 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 29 ms | 336 KB | Output is correct |
2 | Correct | 29 ms | 336 KB | Output is correct |
3 | Correct | 40 ms | 336 KB | Output is correct |
4 | Correct | 28 ms | 336 KB | Output is correct |
5 | Correct | 29 ms | 336 KB | Output is correct |
6 | Correct | 29 ms | 336 KB | Output is correct |
7 | Correct | 29 ms | 336 KB | Output is correct |
8 | Correct | 33 ms | 336 KB | Output is correct |
9 | Correct | 31 ms | 336 KB | Output is correct |
10 | Correct | 28 ms | 336 KB | Output is correct |
11 | Execution timed out | 2062 ms | 1576 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |