답안 #287545

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
287545 2020-08-31T19:51:30 Z Leonardo_Paes Snake Escaping (JOI18_snake_escaping) C++17
12 / 100
308 ms 65536 KB
#include <bits/stdc++.h>
using namespace std;
const int maxn = 13;
int dp[(1<<maxn)][(1<<maxn)];
int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int l, q;
    cin >> l >> q;
    vector<int> v((1<<l));
    for(int i=0; i<(1<<l); i++){
        char a;
        cin >> a;
        v[i] = a - '0';
    }
    for(int a=(1<<l)-1; a>=0; a--){
        dp[a][0] = v[a]; // caso base -> ok
        for(int b=1; b<(1<<l); b++){
            int x = (b & -b); // rightmost set bit tipo na BIT -> ok
            dp[a][b] = dp[a|x][b^x] + dp[a][b^x]; // unicos dois casos -> ok
        }
    }
    while(q--){
        string s;
        cin >> s;
        int a = 0, b = 0;
        for(int i=0; i<l; i++){
            if(s[i] == '1') a += (1<<(l-i-1));
            if(s[i] == '?') b += (1<<(l-i-1));
        }
        cout << dp[a][b] << "\n";
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 8576 KB Output is correct
2 Correct 7 ms 8576 KB Output is correct
3 Correct 8 ms 8576 KB Output is correct
4 Correct 8 ms 8576 KB Output is correct
5 Correct 7 ms 8576 KB Output is correct
6 Correct 7 ms 8576 KB Output is correct
7 Correct 7 ms 8576 KB Output is correct
8 Correct 8 ms 8576 KB Output is correct
9 Correct 8 ms 8680 KB Output is correct
10 Correct 7 ms 8704 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 8576 KB Output is correct
2 Correct 7 ms 8576 KB Output is correct
3 Correct 8 ms 8576 KB Output is correct
4 Correct 8 ms 8576 KB Output is correct
5 Correct 7 ms 8576 KB Output is correct
6 Correct 7 ms 8576 KB Output is correct
7 Correct 7 ms 8576 KB Output is correct
8 Correct 8 ms 8576 KB Output is correct
9 Correct 8 ms 8680 KB Output is correct
10 Correct 7 ms 8704 KB Output is correct
11 Correct 244 ms 22592 KB Output is correct
12 Correct 247 ms 23032 KB Output is correct
13 Correct 263 ms 22264 KB Output is correct
14 Correct 264 ms 22520 KB Output is correct
15 Correct 256 ms 23416 KB Output is correct
16 Correct 289 ms 22520 KB Output is correct
17 Correct 308 ms 22428 KB Output is correct
18 Correct 198 ms 24312 KB Output is correct
19 Correct 243 ms 21336 KB Output is correct
20 Correct 262 ms 23032 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 8576 KB Output is correct
2 Correct 7 ms 8576 KB Output is correct
3 Correct 8 ms 8576 KB Output is correct
4 Correct 8 ms 8576 KB Output is correct
5 Correct 7 ms 8576 KB Output is correct
6 Correct 7 ms 8576 KB Output is correct
7 Correct 7 ms 8576 KB Output is correct
8 Correct 8 ms 8576 KB Output is correct
9 Correct 8 ms 8680 KB Output is correct
10 Correct 7 ms 8704 KB Output is correct
11 Correct 244 ms 22592 KB Output is correct
12 Correct 247 ms 23032 KB Output is correct
13 Correct 263 ms 22264 KB Output is correct
14 Correct 264 ms 22520 KB Output is correct
15 Correct 256 ms 23416 KB Output is correct
16 Correct 289 ms 22520 KB Output is correct
17 Correct 308 ms 22428 KB Output is correct
18 Correct 198 ms 24312 KB Output is correct
19 Correct 243 ms 21336 KB Output is correct
20 Correct 262 ms 23032 KB Output is correct
21 Runtime error 85 ms 65536 KB Execution killed with signal 9
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 8576 KB Output is correct
2 Correct 7 ms 8576 KB Output is correct
3 Correct 8 ms 8576 KB Output is correct
4 Correct 8 ms 8576 KB Output is correct
5 Correct 7 ms 8576 KB Output is correct
6 Correct 7 ms 8576 KB Output is correct
7 Correct 7 ms 8576 KB Output is correct
8 Correct 8 ms 8576 KB Output is correct
9 Correct 8 ms 8680 KB Output is correct
10 Correct 7 ms 8704 KB Output is correct
11 Runtime error 39 ms 9336 KB Execution killed with signal 11
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 8576 KB Output is correct
2 Correct 7 ms 8576 KB Output is correct
3 Correct 8 ms 8576 KB Output is correct
4 Correct 8 ms 8576 KB Output is correct
5 Correct 7 ms 8576 KB Output is correct
6 Correct 7 ms 8576 KB Output is correct
7 Correct 7 ms 8576 KB Output is correct
8 Correct 8 ms 8576 KB Output is correct
9 Correct 8 ms 8680 KB Output is correct
10 Correct 7 ms 8704 KB Output is correct
11 Correct 244 ms 22592 KB Output is correct
12 Correct 247 ms 23032 KB Output is correct
13 Correct 263 ms 22264 KB Output is correct
14 Correct 264 ms 22520 KB Output is correct
15 Correct 256 ms 23416 KB Output is correct
16 Correct 289 ms 22520 KB Output is correct
17 Correct 308 ms 22428 KB Output is correct
18 Correct 198 ms 24312 KB Output is correct
19 Correct 243 ms 21336 KB Output is correct
20 Correct 262 ms 23032 KB Output is correct
21 Runtime error 85 ms 65536 KB Execution killed with signal 9
22 Halted 0 ms 0 KB -