| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 522223 | Monarchuwu | Snake Escaping (JOI18_snake_escaping) | C++17 | 228 ms | 16488 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<iostream>
#include<algorithm>
#include<string>
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
const int N = 2e6 + 10;
int l, q;
string s;
int pw3[13], a[N];
void prep() {
    pw3[0] = 1;
    for (int i = 1; i < 13; ++i)
        pw3[i] = pw3[i - 1] * 3;
    for (int i = 0, msk, x; i < s.size(); ++i) {
        msk = 0, x = i;
        for (int j = 0; j < l; ++j)
            if (x >> j & 1) msk += pw3[j];
        a[msk] = s[i] ^ 48;
    }
    for (int j = 0; j < l; ++j)
        for (int msk = 0; msk < pw3[l]; ++msk)
            if (msk / pw3[j] % 3 == 2)
                a[msk] += a[msk - pw3[j]] + a[msk - pw3[j] * 2];
}
int main() {
    cin.tie(NULL)->sync_with_stdio(false);
    cin >> l >> q >> s;
    prep();
    while (q--) {
        string t; cin >> t;
        int msk(0);
        for (char c : t) {
            msk *= 3;
            if (c == '1') ++msk;
            else if (c == '?') msk += 2;
        }
        cout << a[msk] << '\n';
    }
}
/**  /\_/\
 *  (= ._.)
 *  / >0  \>1
**/
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
