답안 #100057

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
100057 2019-03-09T07:54:29 Z jeff Broken Device (JOI17_broken_device) C++14
57 / 100
66 ms 3328 KB
#include <bits/stdc++.h>
#include "Annalib.h"
using namespace std;

void Anna(int N, long long X, int K, int P[]) {
    int A[50], s[150], i, j, k;
    bool f[N];
    queue<int> q;
    memset(A, -1, sizeof(A));
    for (i = 0; i < N; ++i) f[i] = 1;
    for (i = 0; i < K; ++i) f[P[i]] = 0;
    for (i = 0; i < 150; ++i) s[i] = X % 2, X /= 2, q.push(i);
    j = q.front();
    q.pop();
    k = q.front();
    q.pop();
    for (i = 0; i < N; i += 3) {
        if (j > k) swap(j, k);
        if (!s[j] && !s[k] && f[i] && f[i + 1]) {A[i / 3] = 110; j = q.front(); q.pop(); k = q.front(); q.pop(); continue;}
        if (!s[j] && s[k] && f[i]) {A[i / 3] = 100; j = q.front(); q.pop(); k = q.front(); q.pop(); continue;}
        if (s[j] && s[k] && f[i] && f[i + 2]) {A[i / 3] = 101; j = q.front(); q.pop(); k = q.front(); q.pop(); continue;}
        if (s[j] && !s[k] && f[i] && f[i + 1] && f[i + 2]) {A[i / 3] = 111; j = q.front(); q.pop(); k = q.front(); q.pop(); continue;}
        if (!s[j] && f[i + 1] && f[i + 2]) {A[i / 3] = 11; j = q.front(); q.pop(); continue;}
        if (s[j] && f[i + 1]) {A[i / 3] = 10; j = q.front(); q.pop(); continue;}
        if (!s[k] && f[i + 2]) {A[i / 3] = 1; k = q.front(); q.pop(); continue;}
        A[i / 3] = 0;
    }
    for (i = 0; i < N / 3; ++i) Set(i * 3, A[i] / 100), Set(i * 3 + 1, A[i] / 10 % 10), Set(i * 3 + 2, A[i] % 10);
}
#include <bits/stdc++.h>
#include "Brunolib.h"
using namespace std;

long long Bruno(int N, int A[]) {
    long long r = 0, l = 1;
    int s[150], i, j, k;
    memset(s, 0, sizeof(s));
    queue<int> q;
    for (i = 0; i < 150; ++i) q.push(i);
    j = q.front();
    q.pop();
    k = q.front();
    q.pop();
    for (i = 0; i < N; i += 3) {
        if (j > k) swap(j, k);
        if (A[i] && A[i + 1] && A[i + 2]) {s[j] = 1; s[k] = 0; j = q.front(); q.pop(); k = q.front(); q.pop(); continue;}
        if (A[i] && A[i + 1]) {s[j] = 0; s[k] = 0; j = q.front(); q.pop(); k = q.front(); q.pop(); continue;}
        if (A[i] && A[i + 2]) {s[j] = 1; s[k] = 1; j = q.front(); q.pop(); k = q.front(); q.pop(); continue;}
        if (A[i + 1] && A[i + 2]) {s[j] = 0; j = q.front(); q.pop(); continue;}
        if (A[i]) {s[j] = 0; s[k] = 1; j = q.front(); q.pop(); k = q.front(); q.pop(); continue;}
        if (A[i + 1]) {s[j] = 1; j = q.front(); q.pop(); continue;}
        if (A[i + 2]) {s[k] = 0; k = q.front(); q.pop(); continue;}
    }
    for (i = 0; i < 150 && s[i] > -1; ++i) {
        r += l * s[i];
        l *= 2;
    }
    return r;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 3056 KB Output is correct - L* = 40
2 Correct 52 ms 3072 KB Output is correct - L* = 40
3 Correct 45 ms 3056 KB Output is correct - L* = 40
4 Correct 41 ms 3056 KB Output is correct - L* = 40
5 Correct 51 ms 3056 KB Output is correct - L* = 40
6 Correct 48 ms 3056 KB Output is correct - L* = 40
7 Correct 50 ms 2944 KB Output is correct - L* = 40
8 Correct 59 ms 3072 KB Output is correct - L* = 40
9 Correct 44 ms 3072 KB Output is correct - L* = 40
10 Correct 53 ms 3056 KB Output is correct - L* = 40
11 Correct 47 ms 3064 KB Output is correct - L* = 40
12 Correct 44 ms 3328 KB Output is correct - L* = 40
13 Correct 66 ms 3056 KB Output is correct - L* = 40
14 Partially correct 40 ms 3056 KB Output is partially correct - L* = 39
15 Correct 48 ms 3056 KB Output is correct - L* = 40
16 Correct 49 ms 3072 KB Output is correct - L* = 40
17 Partially correct 38 ms 3104 KB Output is partially correct - L* = 39
18 Correct 49 ms 3056 KB Output is correct - L* = 40
19 Partially correct 54 ms 3072 KB Output is partially correct - L* = 23
20 Correct 41 ms 3072 KB Output is correct - L* = 40
21 Correct 35 ms 2904 KB Output is correct - L* = 40
22 Correct 43 ms 3072 KB Output is correct - L* = 40
23 Correct 40 ms 3072 KB Output is correct - L* = 40
24 Partially correct 40 ms 3072 KB Output is partially correct - L* = 32
25 Correct 44 ms 3072 KB Output is correct - L* = 40
26 Correct 37 ms 3080 KB Output is correct - L* = 40
27 Correct 40 ms 3072 KB Output is correct - L* = 40
28 Partially correct 54 ms 3056 KB Output is partially correct - L* = 39
29 Correct 52 ms 3000 KB Output is correct - L* = 40
30 Correct 41 ms 3056 KB Output is correct - L* = 40
31 Correct 50 ms 2960 KB Output is correct - L* = 40
32 Correct 48 ms 3080 KB Output is correct - L* = 40
33 Correct 37 ms 3072 KB Output is correct - L* = 40
34 Correct 43 ms 3072 KB Output is correct - L* = 40
35 Partially correct 42 ms 3072 KB Output is partially correct - L* = 37
36 Correct 37 ms 3048 KB Output is correct - L* = 40
37 Correct 37 ms 3072 KB Output is correct - L* = 40
38 Correct 40 ms 3056 KB Output is correct - L* = 40
39 Correct 51 ms 3056 KB Output is correct - L* = 40
40 Correct 39 ms 3072 KB Output is correct - L* = 40