답안 #250933

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
250933 2020-07-19T13:23:51 Z imeimi2000 Broken Device (JOI17_broken_device) C++17
100 / 100
50 ms 3568 KB
#include "Annalib.h"
#include <stdio.h>
 
using namespace std;
typedef long long llong;
 
void Anna(int n, llong x, int k, int p[]) {
    int dat[61] = {};
    for (int i = 0; i < 60; ++i) {
        dat[i] = (x & 1ll);
        x >>= 1;
    }
    int broken[150] = {};
    for (int i = 0; i < k; ++i) broken[p[i]] = 1;
    int ret[150] = {};
    for (int i = 0, j = 0; j < 60; ++i) {
        int a = 3 * i;
        int b = a + 1;
        int c = a + 2;
        if (broken[a] + broken[b] + broken[c] > 1) continue;
        if (broken[a]) {
            if (dat[j]) {
                if (dat[j + 1]) {
                    ret[b] = 1;
                    ret[c] = 1;
                }
                else {
                    ret[b] = 1;
                }
                j += 2;
            }
            else {
                ret[c] = 1;
                j += 1;
            }
            continue;
        }
        if (broken[b]) {
            if (dat[j]) {
                ret[a] = 1;
            }
            else {
                ret[c] = 1;
            }
            j += 1;
            continue;
        }
        if (broken[c]) {
            if (dat[j]) {
                ret[a] = 1;
            }
            else {
                ret[a] = 1;
                ret[b] = 1;
            }
            j += 1;
            continue;
        }
        int d = (dat[j] << 1 | dat[j + 1]);
        if (d == 0) ret[a] = 1, ret[b] = 1, ret[c] = 1;
        else if (d == 1) ret[a] = 1, ret[c] = 1;
        else if (d == 2) ret[b] = 1;
        else ret[b] = 1, ret[c] = 1;
        j += 2;
    }
    for (int i = 0; i < n; ++i) Set(i, ret[i]);
}
#include "Brunolib.h"
#include <vector>
#include <stdio.h>
 
using namespace std;
typedef long long llong;
 
llong Bruno(int n, int a[]) {
    vector<int> ret;
    for (int i = 0; i < 50; ++i) {
        int r = 0;
        for (int j = 0; j < 3; ++j) r = (r << 1 | a[3 * i + j]);
        if (r == 1) ret.push_back(0);
        else if (r == 2) ret.push_back(1), ret.push_back(0);
        else if (r == 3) ret.push_back(1), ret.push_back(1);
        else if (r == 4) ret.push_back(1);
        else if (r == 5) ret.push_back(0), ret.push_back(1);
        else if (r == 6) ret.push_back(0);
        else if (r == 7) ret.push_back(0), ret.push_back(0);
    }
    while (ret.size() > 60) ret.pop_back();
    llong ans = 0;
    for (int i = 60; i--; ) {
        ans <<= 1;
        ans |= ret[i];
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 40 ms 3312 KB Output is correct - L* = 40
2 Correct 40 ms 3312 KB Output is correct - L* = 40
3 Correct 44 ms 3312 KB Output is correct - L* = 40
4 Correct 43 ms 3072 KB Output is correct - L* = 40
5 Correct 41 ms 3328 KB Output is correct - L* = 40
6 Correct 43 ms 3328 KB Output is correct - L* = 40
7 Correct 43 ms 3328 KB Output is correct - L* = 40
8 Correct 41 ms 3312 KB Output is correct - L* = 40
9 Correct 41 ms 3320 KB Output is correct - L* = 40
10 Correct 43 ms 3312 KB Output is correct - L* = 40
11 Correct 45 ms 3328 KB Output is correct - L* = 40
12 Correct 44 ms 3328 KB Output is correct - L* = 40
13 Correct 40 ms 3312 KB Output is correct - L* = 40
14 Correct 41 ms 3072 KB Output is correct - L* = 40
15 Correct 46 ms 3312 KB Output is correct - L* = 40
16 Correct 43 ms 3328 KB Output is correct - L* = 40
17 Correct 41 ms 3072 KB Output is correct - L* = 40
18 Correct 41 ms 3312 KB Output is correct - L* = 40
19 Correct 41 ms 3328 KB Output is correct - L* = 40
20 Correct 41 ms 3328 KB Output is correct - L* = 40
21 Correct 41 ms 3072 KB Output is correct - L* = 40
22 Correct 41 ms 3200 KB Output is correct - L* = 40
23 Correct 50 ms 3072 KB Output is correct - L* = 40
24 Correct 48 ms 3328 KB Output is correct - L* = 40
25 Correct 41 ms 3328 KB Output is correct - L* = 40
26 Correct 43 ms 3328 KB Output is correct - L* = 40
27 Correct 43 ms 3328 KB Output is correct - L* = 40
28 Correct 44 ms 3568 KB Output is correct - L* = 40
29 Correct 41 ms 3328 KB Output is correct - L* = 40
30 Correct 43 ms 3312 KB Output is correct - L* = 40
31 Correct 40 ms 3072 KB Output is correct - L* = 40
32 Correct 41 ms 3312 KB Output is correct - L* = 40
33 Correct 40 ms 3056 KB Output is correct - L* = 40
34 Correct 41 ms 3312 KB Output is correct - L* = 40
35 Correct 41 ms 3328 KB Output is correct - L* = 40
36 Correct 40 ms 3312 KB Output is correct - L* = 40
37 Correct 41 ms 3312 KB Output is correct - L* = 40
38 Correct 41 ms 3328 KB Output is correct - L* = 40
39 Correct 39 ms 3312 KB Output is correct - L* = 40
40 Correct 43 ms 3312 KB Output is correct - L* = 40