답안 #131756

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
131756 2019-07-17T15:04:13 Z zoooma13 Broken Device (JOI17_broken_device) C++14
85 / 100
46 ms 3312 KB
#include "bits/stdc++.h"
#include "Annalib.h"
using namespace std;

pair<int ,int> en(int num){
    if(num == 2) return {1 ,1};
    if(num == 1) return {1 ,0};
    return {0 ,1};
}

void Anna(int N ,long long X ,int K ,int P[]){
    //srand(1);
    vector <int> ord(N);
    iota(ord.begin() ,ord.end() ,0);
    //random_shuffle(ord.begin() ,ord.end());

    vector <bool> bad(N, 0);
    for(int i=0; i<K; i++)
        bad[P[i]] = true;

    vector <bool> enc(N);
    for(int i=0; i<N; i+=2){
        auto d = en(X%3);
        if((!bad[ord[i]] || !d.first) && (!bad[ord[i+1]] || !d.second)){
            enc[ord[i]] = d.first;
            enc[ord[i+1]] = d.second;
            X /= 3;
        }
    }

    for(int i=0; i<N; i++)
        Set(i ,enc[i]);
}
#include "bits/stdc++.h"
#include "Brunolib.h"
using namespace std;

int de(pair<int ,int> p){
    return p.first+p.second == 2 ? 2 : p.first;
}

long long Bruno(int N ,int A[]){
    //srand(1);
    vector <int> ord(N);
    iota(ord.begin() ,ord.end() ,0);
    //random_shuffle(ord.begin() ,ord.end());

    long long X = 0LL ,pw = 1LL;
    for(int i=0; i<N; i+=2)
        if(A[ord[i]] || A[ord[i+1]]){
            X += pw*de({A[ord[i]] ,A[ord[i+1]]});
            pw *= 3;
        }

    return X;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 41 ms 3056 KB Output is partially correct - L* = 37
2 Partially correct 41 ms 3040 KB Output is partially correct - L* = 37
3 Partially correct 41 ms 3144 KB Output is partially correct - L* = 37
4 Partially correct 41 ms 3056 KB Output is partially correct - L* = 37
5 Partially correct 41 ms 3056 KB Output is partially correct - L* = 37
6 Partially correct 43 ms 3056 KB Output is partially correct - L* = 37
7 Partially correct 41 ms 3080 KB Output is partially correct - L* = 37
8 Partially correct 41 ms 3056 KB Output is partially correct - L* = 37
9 Partially correct 43 ms 3056 KB Output is partially correct - L* = 37
10 Partially correct 41 ms 3056 KB Output is partially correct - L* = 37
11 Partially correct 41 ms 3064 KB Output is partially correct - L* = 37
12 Partially correct 41 ms 3056 KB Output is partially correct - L* = 37
13 Partially correct 43 ms 3136 KB Output is partially correct - L* = 37
14 Partially correct 43 ms 3032 KB Output is partially correct - L* = 37
15 Partially correct 43 ms 2936 KB Output is partially correct - L* = 37
16 Partially correct 41 ms 3056 KB Output is partially correct - L* = 37
17 Partially correct 41 ms 3000 KB Output is partially correct - L* = 37
18 Partially correct 41 ms 3056 KB Output is partially correct - L* = 37
19 Partially correct 41 ms 2992 KB Output is partially correct - L* = 37
20 Partially correct 41 ms 3056 KB Output is partially correct - L* = 37
21 Partially correct 41 ms 3056 KB Output is partially correct - L* = 37
22 Partially correct 41 ms 2896 KB Output is partially correct - L* = 38
23 Partially correct 46 ms 3056 KB Output is partially correct - L* = 37
24 Partially correct 44 ms 3056 KB Output is partially correct - L* = 37
25 Partially correct 41 ms 3144 KB Output is partially correct - L* = 37
26 Partially correct 41 ms 3056 KB Output is partially correct - L* = 37
27 Partially correct 41 ms 3056 KB Output is partially correct - L* = 37
28 Partially correct 41 ms 3056 KB Output is partially correct - L* = 37
29 Partially correct 41 ms 3056 KB Output is partially correct - L* = 37
30 Partially correct 41 ms 3056 KB Output is partially correct - L* = 37
31 Partially correct 46 ms 3144 KB Output is partially correct - L* = 38
32 Partially correct 43 ms 3056 KB Output is partially correct - L* = 37
33 Partially correct 45 ms 3056 KB Output is partially correct - L* = 37
34 Partially correct 43 ms 3056 KB Output is partially correct - L* = 37
35 Partially correct 41 ms 3312 KB Output is partially correct - L* = 37
36 Partially correct 41 ms 3312 KB Output is partially correct - L* = 37
37 Partially correct 41 ms 3056 KB Output is partially correct - L* = 37
38 Partially correct 41 ms 3000 KB Output is partially correct - L* = 37
39 Partially correct 41 ms 3056 KB Output is partially correct - L* = 37
40 Partially correct 41 ms 3000 KB Output is partially correct - L* = 37