답안 #131727

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
131727 2019-07-17T13:40:06 Z Osama_Alkhodairy Broken Device (JOI17_broken_device) C++17
100 / 100
57 ms 3320 KB
#include <bits/stdc++.h>
//~ #include "grader.cpp"
//~ #include "Bruno.cpp"
#include "Annalib.h"
using namespace std;

void Anna( int N, long long X, int K, int P[] ){
    srand(123321);
    vector <int> all;
    for(int i = 0 ; i < N ; i++){
        all.push_back(i);
    }
    random_shuffle(all.begin(), all.end());
    vector <int> broken(N);
    for(int i = 0 ; i < K ; i++){
        broken[P[i]] = 1;
    }
    vector <int> send(N);
    for(int i = 0 ; i < N ; i += 2){
        int cur = X % 3;
        if(broken[all[i]] && broken[all[i + 1]]) continue;
        if(broken[all[i]] && (cur == 1 || cur == 2)) continue;
        if(broken[all[i + 1]] && (cur == 0 || cur == 2)) continue;
        X /= 3;
        if(cur == 0) send[all[i + 1]] = 1;
        else if(cur == 1) send[all[i]] = 1;
        else send[all[i]] = send[all[i + 1]] = 1;
    }
    for(int i = 0 ; i < N ; i++){
        Set(i, send[i]);
    }
}
#include <bits/stdc++.h>
#include "Brunolib.h"
using namespace std;
#define ll long long

long long Bruno( int N, int A[] ){
    srand(123321);
    vector <int> all;
    for(int i = 0 ; i < N ; i++){
        all.push_back(i);
    }
    random_shuffle(all.begin(), all.end());
    vector <int> r;
    for(int i = 0 ; i < N ; i += 2){
        if(A[all[i]] == 0 && A[all[i + 1]] == 1) r.push_back(0);
        else if(A[all[i]] == 1 && A[all[i + 1]] == 0) r.push_back(1);
        else if(A[all[i]] == 1 && A[all[i + 1]] == 1) r.push_back(2);
    }
    reverse(r.begin(), r.end());
    ll ret = 0;
    for(auto &i : r) ret = ret * 3 + i;
    return ret;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 55 ms 3056 KB Output is correct - L* = 40
2 Correct 55 ms 3056 KB Output is correct - L* = 40
3 Correct 55 ms 3048 KB Output is correct - L* = 40
4 Correct 56 ms 3056 KB Output is correct - L* = 40
5 Correct 55 ms 3056 KB Output is correct - L* = 40
6 Correct 56 ms 3056 KB Output is correct - L* = 40
7 Correct 55 ms 3056 KB Output is correct - L* = 40
8 Correct 55 ms 3056 KB Output is correct - L* = 40
9 Correct 55 ms 3056 KB Output is correct - L* = 40
10 Correct 56 ms 3056 KB Output is correct - L* = 40
11 Correct 56 ms 3048 KB Output is correct - L* = 40
12 Correct 56 ms 3056 KB Output is correct - L* = 40
13 Correct 55 ms 3056 KB Output is correct - L* = 40
14 Correct 55 ms 3320 KB Output is correct - L* = 40
15 Correct 57 ms 3056 KB Output is correct - L* = 40
16 Correct 56 ms 3056 KB Output is correct - L* = 40
17 Correct 55 ms 3056 KB Output is correct - L* = 40
18 Correct 56 ms 2904 KB Output is correct - L* = 40
19 Correct 57 ms 2984 KB Output is correct - L* = 40
20 Correct 56 ms 3056 KB Output is correct - L* = 40
21 Correct 55 ms 2840 KB Output is correct - L* = 40
22 Correct 56 ms 3056 KB Output is correct - L* = 40
23 Correct 56 ms 3056 KB Output is correct - L* = 40
24 Correct 55 ms 3144 KB Output is correct - L* = 40
25 Correct 55 ms 3000 KB Output is correct - L* = 40
26 Correct 56 ms 3056 KB Output is correct - L* = 40
27 Correct 56 ms 3056 KB Output is correct - L* = 40
28 Correct 55 ms 3056 KB Output is correct - L* = 40
29 Correct 55 ms 3056 KB Output is correct - L* = 40
30 Correct 55 ms 3056 KB Output is correct - L* = 40
31 Correct 55 ms 3056 KB Output is correct - L* = 40
32 Correct 55 ms 3056 KB Output is correct - L* = 40
33 Correct 56 ms 3056 KB Output is correct - L* = 40
34 Correct 55 ms 3056 KB Output is correct - L* = 40
35 Correct 56 ms 3056 KB Output is correct - L* = 40
36 Correct 55 ms 3056 KB Output is correct - L* = 40
37 Correct 55 ms 3056 KB Output is correct - L* = 40
38 Correct 56 ms 2824 KB Output is correct - L* = 40
39 Correct 56 ms 3056 KB Output is correct - L* = 40
40 Correct 55 ms 3056 KB Output is correct - L* = 40