답안 #26832

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

using namespace std;

static bool st[150];
static int cnt[30];

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]++;
    }
    int cc = 0;
    for(int i = 0; i < N / 3; i++) {
        if(cc >= 60 || cnt[i] == 3) {
            Set(i * 3 , 0);
            Set(i * 3 + 1 , 0);
            Set(i * 3 + 2 , 0);
            continue;
        }
        if(cnt[i] == 2) {
            if(!st[i * 3]) {
                if((~(X>>cc)&1) && (~(X>>(cc + 1))&1)) {
                    Set(i * 3 , 1);
                    Set(i * 3 + 1 , 0);
                    Set(i * 3 + 2 , 0);
                    cc += 2;
                }
            }
            else if(!st[i * 3 + 1]) {
                if(~(X>>cc)&1) {
                    Set(i * 3 , 0);
                    Set(i * 3 + 1 , 1);
                    Set(i * 3 + 2 , 0);
                    cc++;
                }
            }
            else {
                if((X>>cc)&1) {
                    Set(i * 3 , 0);
                    Set(i * 3 + 1 , 0);
                    Set(i * 3 + 2 , 1);
                    cc++;
                }
            }
        }
        else if(cnt[i] == 0) {
            Set(i * 3 , 1);
            Set(i * 3 + 1 , (X>>cc)&1);
            cc++;
            Set(i * 3 + 2 , (X>>cc)&1);
            cc++;
        }
        else {
            if(st[i * 3]) {
                Set(i * 3 , 0);
                Set(i * 3 + 1 , 1);
                Set(i * 3 + 2 , (X>>cc)&1);
                cc++;
            }
            else if(st[i * 3 + 1]) {
                if(~(X>>cc)&1) {
                    Set(i * 3 , 1);
                    Set(i * 3 + 1 , (X>>cc)&1);
                    cc++;
                    Set(i * 3 + 2 , (X>>cc)&1);
                    cc++;
                }
                else {
                    Set(i * 3 , 0);
                    Set(i * 3 + 1 , 0);
                    Set(i * 3 + 2 , 1);
                    cc++;
                }
            }
            else {
                if(~(X>>(cc + 1))&1) {
                    Set(i * 3 , 1);
                    Set(i * 3 + 1 , (X>>cc)&1);
                    cc++;
                    Set(i * 3 + 2 , (X>>cc)&1);
                    cc++;
                }
                else {
                    Set(i * 3 , 0);
                    Set(i * 3 + 1 , 0);
                    Set(i * 3 + 2 , 0);
                }
            }
        }
    }
}
/// Author: Wang, Yen-Jen
#include "Brunolib.h"
#include <bits/stdc++.h>

using namespace std;

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]) {
            X |= ((long long)A[i * 3 + 1]<<cc);
            cc++;
            X |= ((long long)A[i * 3 + 2]<<cc);
            cc++;
        }
        else if(A[i * 3 + 1]) {
            X |= ((long long)A[i * 3 + 2]<<cc);
            cc++;
        }
        else if(A[i * 3 + 2]) {
            X |= ((long long)A[i * 3 + 2]<<cc);
            cc++;
        }
    }
    return X;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 4636 KB Wrong Answer [4]
2 Incorrect 0 ms 4636 KB Wrong Answer [4]
3 Incorrect 0 ms 4636 KB Wrong Answer [4]
4 Incorrect 0 ms 4636 KB Wrong Answer [4]
5 Incorrect 0 ms 4636 KB Wrong Answer [4]
6 Incorrect 0 ms 4636 KB Wrong Answer [4]
7 Incorrect 0 ms 4636 KB Wrong Answer [4]
8 Incorrect 0 ms 4636 KB Wrong Answer [4]
9 Incorrect 0 ms 4636 KB Wrong Answer [4]
10 Incorrect 0 ms 4636 KB Wrong Answer [4]
11 Incorrect 0 ms 4636 KB Wrong Answer [4]
12 Incorrect 0 ms 4636 KB Wrong Answer [4]
13 Incorrect 0 ms 4636 KB Wrong Answer [4]
14 Incorrect 0 ms 4636 KB Wrong Answer [4]
15 Incorrect 0 ms 4636 KB Wrong Answer [4]
16 Incorrect 0 ms 4636 KB Wrong Answer [4]
17 Incorrect 0 ms 4636 KB Wrong Answer [4]
18 Incorrect 0 ms 4636 KB Wrong Answer [4]
19 Incorrect 0 ms 4636 KB Wrong Answer [4]
20 Incorrect 0 ms 4636 KB Wrong Answer [4]
21 Incorrect 0 ms 4636 KB Wrong Answer [4]
22 Incorrect 0 ms 4636 KB Wrong Answer [4]
23 Incorrect 0 ms 4636 KB Wrong Answer [4]
24 Incorrect 0 ms 4636 KB Wrong Answer [4]
25 Incorrect 0 ms 4636 KB Wrong Answer [4]
26 Incorrect 0 ms 4636 KB Wrong Answer [4]
27 Incorrect 0 ms 4636 KB Wrong Answer [4]
28 Incorrect 0 ms 4636 KB Wrong Answer [4]
29 Incorrect 0 ms 4636 KB Wrong Answer [4]
30 Incorrect 0 ms 4636 KB Wrong Answer [4]
31 Incorrect 0 ms 4636 KB Wrong Answer [4]
32 Incorrect 0 ms 4636 KB Wrong Answer [4]
33 Incorrect 0 ms 4636 KB Wrong Answer [4]
34 Incorrect 0 ms 4636 KB Wrong Answer [4]
35 Incorrect 0 ms 4636 KB Wrong Answer [4]
36 Incorrect 0 ms 4636 KB Wrong Answer [4]
37 Incorrect 0 ms 4636 KB Wrong Answer [4]
38 Incorrect 0 ms 4636 KB Wrong Answer [4]
39 Incorrect 0 ms 4636 KB Wrong Answer [4]
40 Incorrect 0 ms 4636 KB Wrong Answer [4]