답안 #26847

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
26847 2017-07-06T10:16:50 Z wangyenjen Broken Device (JOI17_broken_device) C++14
0 / 100
59 ms 4636 KB
/// Author: Wang, Yen-Jen
#include "Annalib.h"
#include <bits/stdc++.h>

using namespace std;

static bool A[60];
static bool B[150];
static int cnt[30];
static bool st[150];

inline static void my_set(int p , int a , int b , int c) {
    B[p * 3] = a;
    B[p * 3 + 1] = b;
    B[p * 3 + 2] = c;
}

void Anna(int N , long long X , int K , int P[]) {
    memset(st , 0 , sizeof(st));
    memset(cnt , 0 , sizeof(cnt));
    for(int i = 0; i < K; i++) {
        st[P[i]] = 1;
        cnt[P[i] / 3]++;
    }
    for(int i = 0; i < 60; i++) {
        A[i] = (X&1);
        X >>= 1;
    }
    int cc = 0;
    memset(B , 0 , sizeof(B));
    for(int i = 0; i < N / 3; i++) {
        if(cnt[i] >= 2 || cc >= 60) continue;
        if(cnt[i] == 0) {
            if(cc == 59) {
                if(A[cc]) my_set(i , 0 , 1 , 0);
                else my_set(i , 0 , 0 , 1);
                cc++;
            }
            else {
                if(A[cc]) {
                    if(A[cc + 1]) my_set(i , 1 , 1 , 1);
                    else my_set(i , 0 , 1 , 1);
                }
                else {
                    if(A[cc + 1]) my_set(i , 1 , 1 , 0);
                    else my_set(i , 1 , 0 , 1);
                }
                cc += 2;
            }
        }
        else {
            if(st[i * 3]) {
                if(cc == 59) {
                    if(A[cc]) my_set(i , 0 , 1 , 0);
                    else my_set(i , 0 , 0 , 1);
                    cc++;
                }
                else if(A[cc] && !A[cc + 1]) {
                    my_set(i , 0 , 1 , 1);
                    cc += 2;
                }
            }
            else if(st[i * 3 + 1]) {
                if(cc == 59) {
                    if(!A[cc]) {
                        my_set(i , 0 , 0 , 1);
                        cc++;
                    }
                }
                else {
                    if(!A[cc] && !A[cc + 1]) {
                        my_set(i , 1 , 0 , 1);
                        cc += 2;
                    }
                }
            }
            else {
                if(cc == 59) {
                    if(A[cc]) {
                        my_set(i , 0 , 1 , 0);
                        cc++;
                    }
                }
                else {
                    if(!A[cc] && A[cc + 1]) {
                        my_set(i , 1 , 1 , 0);
                        cc += 2;
                    }
                }
            }
        }
    }
    for(int i = 0; i < N; i++) Set(i , B[i]);
}
/// Author: Wang, Yen-Jen
#include "Brunolib.h"
#include <bits/stdc++.h>

using namespace std;

static int B[150];

long long Bruno(int N , int A[]) {
    long long X = 0;
    int cc = 0;
    for(int i = 0; i < N / 3; i++) {
        if(!(A[i * 3] || A[i * 3 + 1] || A[i * 3 + 2])) continue;
        if(A[i * 3]) {
            if(A[i * 3 + 1]) {
                if(A[i * 3 + 2]) B[cc++] = 1 , B[cc++] = 1;
                else B[cc++] = 0 , B[cc++] = 1;
            }
            else {
                if(A[i * 3 + 2]) B[cc++] = 0 , B[cc++] = 0;
                else B[cc++] = 0 , B[cc++] = 0;
            }
        }
        else {
            if(A[i * 3 + 1]) {
                if(A[i * 3 + 2]) B[cc++] = 1 , B[cc++] = 0;
                else B[cc++] = 1;
            }
            else {
                if(A[i * 3 + 2]) B[cc++] = 0;
            }
        }
    }
    for(int i = 0; i < 60; i++) X |= ((long long)B[i]<<i);
    return X;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 32 ms 4636 KB Output isn't correct - L* = 0
2 Incorrect 35 ms 4636 KB Output isn't correct - L* = 0
3 Incorrect 41 ms 4636 KB Output isn't correct - L* = 0
4 Incorrect 41 ms 4636 KB Output isn't correct - L* = 0
5 Incorrect 59 ms 4636 KB Output isn't correct - L* = 0
6 Incorrect 56 ms 4636 KB Output isn't correct - L* = 0
7 Incorrect 35 ms 4636 KB Output isn't correct - L* = 0
8 Incorrect 41 ms 4636 KB Output isn't correct - L* = 0
9 Incorrect 35 ms 4636 KB Output isn't correct - L* = 0
10 Incorrect 45 ms 4636 KB Output isn't correct - L* = 0
11 Incorrect 32 ms 4636 KB Output isn't correct - L* = 0
12 Incorrect 39 ms 4636 KB Output isn't correct - L* = 0
13 Incorrect 41 ms 4636 KB Output isn't correct - L* = 0
14 Incorrect 39 ms 4636 KB Output isn't correct - L* = 0
15 Incorrect 39 ms 4636 KB Output isn't correct - L* = 0
16 Incorrect 49 ms 4636 KB Output isn't correct - L* = 0
17 Incorrect 35 ms 4636 KB Output isn't correct - L* = 0
18 Incorrect 35 ms 4636 KB Output isn't correct - L* = 0
19 Incorrect 35 ms 4636 KB Output isn't correct - L* = 0
20 Incorrect 36 ms 4636 KB Output isn't correct - L* = 0
21 Incorrect 35 ms 4636 KB Output isn't correct - L* = 0
22 Incorrect 41 ms 4636 KB Output isn't correct - L* = 0
23 Incorrect 35 ms 4636 KB Output isn't correct - L* = 0
24 Incorrect 32 ms 4636 KB Output isn't correct - L* = 0
25 Incorrect 38 ms 4636 KB Output isn't correct - L* = 0
26 Incorrect 35 ms 4636 KB Output isn't correct - L* = 0
27 Incorrect 35 ms 4636 KB Output isn't correct - L* = 0
28 Incorrect 22 ms 4636 KB Output isn't correct - L* = 0
29 Incorrect 46 ms 4636 KB Output isn't correct - L* = 0
30 Incorrect 46 ms 4636 KB Output isn't correct - L* = 0
31 Incorrect 45 ms 4636 KB Output isn't correct - L* = 0
32 Incorrect 35 ms 4636 KB Output isn't correct - L* = 0
33 Incorrect 35 ms 4636 KB Output isn't correct - L* = 0
34 Incorrect 35 ms 4636 KB Output isn't correct - L* = 0
35 Incorrect 49 ms 4636 KB Output isn't correct - L* = 0
36 Incorrect 38 ms 4636 KB Output isn't correct - L* = 0
37 Incorrect 35 ms 4636 KB Output isn't correct - L* = 0
38 Incorrect 41 ms 4636 KB Output isn't correct - L* = 0
39 Incorrect 39 ms 4636 KB Output isn't correct - L* = 0
40 Incorrect 41 ms 4636 KB Output isn't correct - L* = 0