Submission #131705

# Submission time Handle Problem Language Result Execution time Memory
131705 2019-07-17T13:11:50 Z Osama_Alkhodairy Broken Device (JOI17_broken_device) C++17
85 / 100
57 ms 3312 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(1000000007);
    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;
    }
    for(int i = 0 ; i < N ; i += 2){
        if(broken[all[i]] == 1) broken[all[i + 1]] = 1;
        if(broken[all[i + 1]] == 1) broken[all[i]] = 1;
    }
    for(int i = 0 ; i < N ; i += 2){
        if(broken[all[i]]){
            Set(all[i], 0);
            Set(all[i + 1], 0);
            continue;
        }
        int cur = X % 3;
        X /= 3;
        if(cur == 0){
            Set(all[i], 0);
            Set(all[i + 1], 1);
        }
        else if(cur == 1){
            Set(all[i], 1);
            Set(all[i + 1], 0);
        }
        else{
            Set(all[i], 1);
            Set(all[i + 1], 1);
        }
    }
}
#include <bits/stdc++.h>
#include "Brunolib.h"
using namespace std;
#define ll long long

long long Bruno( int N, int A[] ){
    srand(1000000007);
    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;
}
# Verdict Execution time Memory Grader output
1 Partially correct 56 ms 3056 KB Output is partially correct - L* = 39
2 Partially correct 56 ms 3056 KB Output is partially correct - L* = 37
3 Partially correct 56 ms 3056 KB Output is partially correct - L* = 37
4 Partially correct 55 ms 3008 KB Output is partially correct - L* = 38
5 Partially correct 55 ms 2856 KB Output is partially correct - L* = 39
6 Partially correct 56 ms 3056 KB Output is partially correct - L* = 38
7 Partially correct 56 ms 3056 KB Output is partially correct - L* = 39
8 Partially correct 55 ms 3056 KB Output is partially correct - L* = 38
9 Partially correct 55 ms 3056 KB Output is partially correct - L* = 39
10 Partially correct 55 ms 3056 KB Output is partially correct - L* = 38
11 Partially correct 55 ms 3056 KB Output is partially correct - L* = 39
12 Partially correct 55 ms 3056 KB Output is partially correct - L* = 39
13 Partially correct 56 ms 3056 KB Output is partially correct - L* = 38
14 Partially correct 56 ms 3000 KB Output is partially correct - L* = 38
15 Partially correct 56 ms 3312 KB Output is partially correct - L* = 39
16 Partially correct 56 ms 3056 KB Output is partially correct - L* = 38
17 Partially correct 56 ms 3056 KB Output is partially correct - L* = 39
18 Partially correct 55 ms 3056 KB Output is partially correct - L* = 38
19 Partially correct 56 ms 3056 KB Output is partially correct - L* = 39
20 Partially correct 57 ms 3056 KB Output is partially correct - L* = 39
21 Partially correct 55 ms 3056 KB Output is partially correct - L* = 39
22 Partially correct 55 ms 2984 KB Output is partially correct - L* = 38
23 Partially correct 55 ms 3056 KB Output is partially correct - L* = 39
24 Partially correct 56 ms 3056 KB Output is partially correct - L* = 39
25 Correct 55 ms 3064 KB Output is correct - L* = 40
26 Partially correct 56 ms 3056 KB Output is partially correct - L* = 39
27 Partially correct 57 ms 3056 KB Output is partially correct - L* = 38
28 Partially correct 56 ms 3056 KB Output is partially correct - L* = 38
29 Partially correct 55 ms 3056 KB Output is partially correct - L* = 38
30 Partially correct 55 ms 3056 KB Output is partially correct - L* = 38
31 Partially correct 57 ms 3056 KB Output is partially correct - L* = 38
32 Partially correct 55 ms 3056 KB Output is partially correct - L* = 39
33 Partially correct 57 ms 3056 KB Output is partially correct - L* = 39
34 Partially correct 57 ms 2864 KB Output is partially correct - L* = 39
35 Partially correct 56 ms 3056 KB Output is partially correct - L* = 39
36 Partially correct 55 ms 3056 KB Output is partially correct - L* = 38
37 Partially correct 57 ms 3056 KB Output is partially correct - L* = 38
38 Partially correct 56 ms 3056 KB Output is partially correct - L* = 39
39 Partially correct 56 ms 3056 KB Output is partially correct - L* = 39
40 Partially correct 56 ms 3056 KB Output is partially correct - L* = 38