답안 #204102

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
204102 2020-02-24T11:12:14 Z coldEr66 Broken Device (JOI17_broken_device) C++14
0 / 100
11 ms 1016 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 == 2) 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] = d[i+2] = 1;
            else if (X % 4 == 2) d[i+1] = 1;
            else d[i+1] = d[i+2] = 2;
            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,2);
    if (ret == 3) return ii(4,3);
    if (ret == 4) return ii(2,1);
    if (ret == 5) return ii(4,1);
    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 Incorrect 10 ms 780 KB Wrong Answer [3]
2 Incorrect 9 ms 776 KB Wrong Answer [3]
3 Incorrect 10 ms 1000 KB Wrong Answer [3]
4 Incorrect 10 ms 784 KB Wrong Answer [3]
5 Incorrect 9 ms 636 KB Wrong Answer [3]
6 Incorrect 9 ms 776 KB Wrong Answer [3]
7 Incorrect 10 ms 1004 KB Wrong Answer [3]
8 Incorrect 10 ms 764 KB Wrong Answer [3]
9 Incorrect 10 ms 892 KB Wrong Answer [3]
10 Incorrect 11 ms 1016 KB Wrong Answer [3]
11 Incorrect 10 ms 776 KB Wrong Answer [3]
12 Incorrect 10 ms 784 KB Wrong Answer [3]
13 Incorrect 9 ms 776 KB Wrong Answer [3]
14 Incorrect 9 ms 764 KB Wrong Answer [3]
15 Incorrect 10 ms 780 KB Wrong Answer [3]
16 Incorrect 10 ms 788 KB Wrong Answer [3]
17 Incorrect 10 ms 776 KB Wrong Answer [3]
18 Incorrect 10 ms 764 KB Wrong Answer [3]
19 Incorrect 10 ms 792 KB Wrong Answer [3]
20 Incorrect 10 ms 680 KB Wrong Answer [3]
21 Incorrect 9 ms 784 KB Wrong Answer [3]
22 Incorrect 10 ms 792 KB Wrong Answer [3]
23 Incorrect 10 ms 1008 KB Wrong Answer [3]
24 Incorrect 10 ms 788 KB Wrong Answer [3]
25 Incorrect 10 ms 1004 KB Wrong Answer [3]
26 Incorrect 8 ms 784 KB Wrong Answer [3]
27 Incorrect 10 ms 772 KB Wrong Answer [3]
28 Incorrect 10 ms 1004 KB Wrong Answer [3]
29 Incorrect 10 ms 772 KB Wrong Answer [3]
30 Incorrect 9 ms 788 KB Wrong Answer [3]
31 Incorrect 10 ms 764 KB Wrong Answer [3]
32 Incorrect 8 ms 792 KB Wrong Answer [3]
33 Incorrect 9 ms 780 KB Wrong Answer [3]
34 Incorrect 9 ms 784 KB Wrong Answer [3]
35 Incorrect 10 ms 776 KB Wrong Answer [3]
36 Incorrect 9 ms 792 KB Wrong Answer [3]
37 Incorrect 9 ms 792 KB Wrong Answer [3]
38 Incorrect 9 ms 764 KB Wrong Answer [3]
39 Incorrect 9 ms 784 KB Wrong Answer [3]
40 Incorrect 10 ms 776 KB Wrong Answer [3]