답안 #680348

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
680348 2023-01-10T15:51:21 Z vjudge1 Snake Escaping (JOI18_snake_escaping) C++17
5 / 100
2000 ms 6188 KB
#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define sz(x) (int)x.size()
#define getBit(x, i) ((x) >> (i) & 1)
#define rep(i, begin, end) for (ll i = (begin); i <= (end); i++)
#define rrep(i, begin, end) for (ll i = (begin); i >= (end); i--)

typedef long long ll;
typedef pair<ll, ll> ii;

template <class T>
bool minimize(T &a, const T &b) {
    if(a > b) {a = b; return 1;}
    return 0;
}
template <class T>
bool maximize(T &a, const T &b) {
    if(a < b) {a = b; return 1;}
    return 0;
}

const int N = 1e5 + 7;
int n, q;
ll f[1 << 13];
char t[N];
int toxic[N];

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
//    freopen("test.inp", "r", stdin);
//    freopen("test.out", "w", stdout);
    cin >> n >> q >> t;
    rep(i, 0, (1 << n) - 1) toxic[i] = t[i] - '0';
    while (q--) {
        string s; cin >> s;
        ll ans = 0;
        rep(i, 0, (1 << n) - 1) {
            bool ok = 1;
            rep(j, 0, n - 1) {
                if (s[j] != '?' && (s[j] - '0') != getBit(i, n - 1 - j)) {
                    ok = 0;
                    break;
                }
            }
            if (ok) ans += toxic[i];
        }
        cout << ans << '\n';
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 340 KB Output is correct
2 Correct 6 ms 340 KB Output is correct
3 Correct 5 ms 340 KB Output is correct
4 Correct 5 ms 340 KB Output is correct
5 Correct 7 ms 340 KB Output is correct
6 Correct 5 ms 340 KB Output is correct
7 Correct 5 ms 340 KB Output is correct
8 Correct 9 ms 340 KB Output is correct
9 Correct 4 ms 340 KB Output is correct
10 Correct 6 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 340 KB Output is correct
2 Correct 6 ms 340 KB Output is correct
3 Correct 5 ms 340 KB Output is correct
4 Correct 5 ms 340 KB Output is correct
5 Correct 7 ms 340 KB Output is correct
6 Correct 5 ms 340 KB Output is correct
7 Correct 5 ms 340 KB Output is correct
8 Correct 9 ms 340 KB Output is correct
9 Correct 4 ms 340 KB Output is correct
10 Correct 6 ms 340 KB Output is correct
11 Execution timed out 2083 ms 6188 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 340 KB Output is correct
2 Correct 6 ms 340 KB Output is correct
3 Correct 5 ms 340 KB Output is correct
4 Correct 5 ms 340 KB Output is correct
5 Correct 7 ms 340 KB Output is correct
6 Correct 5 ms 340 KB Output is correct
7 Correct 5 ms 340 KB Output is correct
8 Correct 9 ms 340 KB Output is correct
9 Correct 4 ms 340 KB Output is correct
10 Correct 6 ms 340 KB Output is correct
11 Execution timed out 2083 ms 6188 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 340 KB Output is correct
2 Correct 6 ms 340 KB Output is correct
3 Correct 5 ms 340 KB Output is correct
4 Correct 5 ms 340 KB Output is correct
5 Correct 7 ms 340 KB Output is correct
6 Correct 5 ms 340 KB Output is correct
7 Correct 5 ms 340 KB Output is correct
8 Correct 9 ms 340 KB Output is correct
9 Correct 4 ms 340 KB Output is correct
10 Correct 6 ms 340 KB Output is correct
11 Runtime error 2 ms 1108 KB Execution killed with signal 11
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 340 KB Output is correct
2 Correct 6 ms 340 KB Output is correct
3 Correct 5 ms 340 KB Output is correct
4 Correct 5 ms 340 KB Output is correct
5 Correct 7 ms 340 KB Output is correct
6 Correct 5 ms 340 KB Output is correct
7 Correct 5 ms 340 KB Output is correct
8 Correct 9 ms 340 KB Output is correct
9 Correct 4 ms 340 KB Output is correct
10 Correct 6 ms 340 KB Output is correct
11 Execution timed out 2083 ms 6188 KB Time limit exceeded
12 Halted 0 ms 0 KB -