답안 #204104

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
204104 2020-02-24T11:15:25 Z coldEr66 Broken Device (JOI17_broken_device) C++14
100 / 100
55 ms 3312 KB
#include "Annalib.h"

const int MAXn = 173;
int ok[MAXn],d[MAXn];
void Anna( int N, long long X, int K, int P[] ){
    for (int i=0;i<N;i++) {
        ok[i] = d[i] = 0;
    }
    for (int i=0;i<K;i++) {
        ok[P[i]] = 1;
    }

    for (int i=0;i<N;i+=3) {
        int tmp = ok[i] + ok[i+1] + ok[i+2];
        if (tmp >= 2) continue;
        if (tmp == 1) {
            if (X % 2 == 0) {
                if (ok[i+2]) d[i] = d[i+1] = 1;
                else d[i+2] = 1;
            }
            else {
                if (ok[i]) {
                    if (X % 4 == 1) d[i+1] = 1;
                    else d[i+1] = d[i+2] = 1;
                    X >>= 1;
                }
                else d[i] = 1;
            }
            X >>= 1;
        }
        else {
            if (X % 4 == 0) d[i] = d[i+1] = d[i+2] = 1;
            else if (X % 4 == 1) d[i+1] = 1;
            else if (X % 4 == 2) d[i] = d[i+2] = 1;
            else d[i+1] = d[i+2] = 1;
            X >>= 2;
        }
    }
    for (int i=0;i<N;i++) {
        Set(i, d[i]);
    }
}
#include "Brunolib.h"
#include <algorithm>
#include <iostream>
using namespace std;
typedef pair<int,int> ii;
#define X first
#define Y second

ii gt(int a,int b,int c){
    int ret = 4*a + 2*b + c;
    if (ret == 0) return ii(1,0);
    if (ret == 1) return ii(2,0);
    if (ret == 2) return ii(4,1);
    if (ret == 3) return ii(4,3);
    if (ret == 4) return ii(2,1);
    if (ret == 5) return ii(4,2);
    if (ret == 6) return ii(2,0);
    if (ret == 7) return ii(4,0);
    return ii(0,0);
}
long long Bruno( int N, int A[] ){
    long long ret = 0;
    for (int i=N-3;i>=0;i-=3) {
        ii tmp = gt(A[i],A[i+1],A[i+2]);
        ret = ret * tmp.X + tmp.Y;
    }
    return ret;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 55 ms 3056 KB Output is correct - L* = 40
2 Correct 51 ms 3056 KB Output is correct - L* = 40
3 Correct 48 ms 3056 KB Output is correct - L* = 40
4 Correct 49 ms 3056 KB Output is correct - L* = 40
5 Correct 49 ms 3056 KB Output is correct - L* = 40
6 Correct 49 ms 3056 KB Output is correct - L* = 40
7 Correct 49 ms 3056 KB Output is correct - L* = 40
8 Correct 48 ms 3056 KB Output is correct - L* = 40
9 Correct 49 ms 3056 KB Output is correct - L* = 40
10 Correct 49 ms 3056 KB Output is correct - L* = 40
11 Correct 47 ms 3056 KB Output is correct - L* = 40
12 Correct 48 ms 3056 KB Output is correct - L* = 40
13 Correct 48 ms 3056 KB Output is correct - L* = 40
14 Correct 48 ms 3048 KB Output is correct - L* = 40
15 Correct 50 ms 3056 KB Output is correct - L* = 40
16 Correct 48 ms 2944 KB Output is correct - L* = 40
17 Correct 49 ms 3056 KB Output is correct - L* = 40
18 Correct 49 ms 3056 KB Output is correct - L* = 40
19 Correct 49 ms 2904 KB Output is correct - L* = 40
20 Correct 48 ms 3056 KB Output is correct - L* = 40
21 Correct 50 ms 3056 KB Output is correct - L* = 40
22 Correct 48 ms 3056 KB Output is correct - L* = 40
23 Correct 49 ms 3056 KB Output is correct - L* = 40
24 Correct 50 ms 3056 KB Output is correct - L* = 40
25 Correct 53 ms 3056 KB Output is correct - L* = 40
26 Correct 50 ms 3056 KB Output is correct - L* = 40
27 Correct 48 ms 3056 KB Output is correct - L* = 40
28 Correct 49 ms 3056 KB Output is correct - L* = 40
29 Correct 52 ms 3056 KB Output is correct - L* = 40
30 Correct 49 ms 3064 KB Output is correct - L* = 40
31 Correct 48 ms 3056 KB Output is correct - L* = 40
32 Correct 49 ms 3056 KB Output is correct - L* = 40
33 Correct 49 ms 3056 KB Output is correct - L* = 40
34 Correct 50 ms 3312 KB Output is correct - L* = 40
35 Correct 49 ms 3056 KB Output is correct - L* = 40
36 Correct 49 ms 3056 KB Output is correct - L* = 40
37 Correct 51 ms 3056 KB Output is correct - L* = 40
38 Correct 48 ms 3056 KB Output is correct - L* = 40
39 Correct 49 ms 3056 KB Output is correct - L* = 40
40 Correct 52 ms 3056 KB Output is correct - L* = 40