Submission #204780

# Submission time Handle Problem Language Result Execution time Memory
204780 2020-02-27T06:05:07 Z balbit Broken Device (JOI17_broken_device) C++14
85 / 100
61 ms 3568 KB
#include <bits/stdc++.h>
using namespace std;
#include "Annalib.h"



void Anna( int N, long long X, int K, int P[] ){
    vector<int> bad(N);
    for (int i = 0; i<K; i++) bad[P[i]] = 1;
    vector<int> p = {110,51,11,69,119,142,17,109,26,101,115,39,108,2,75,56,59,18,32,116,143,86,57,133,14,42,27,136,104,58,30,96,13,68,130,114,71,102,9,139,66,80,103,79,89,81,106,0,134,41,88,28,52,43,16,60,49,105,149,132,29,112,141,45,53,76,8,33,37,15,25,55,70,31,82,47,111,107,90,117,23,122,77,19,126,44,120,131,97,1,38,95,4,21,137,5,121,65,135,144,7,138,64,148,140,100,73,10,83,113,92,48,61,127,87,67,40,124,63,129,93,78,74,54,34,123,85,36,6,24,3,125,72,145,94,50,62,146,98,22,118,128,35,91,46,12,99,84,20,147};
    vector<int> pr(N);
    for (int i = 0; i<N; i++) {
        pr[p[i]] = i;
    }
    vector<int> ans (N);
    for (int i = 0; i<N; i+=2) {
        int a = p[i], b = p[i+1];
        if (!bad[a] && !bad[b]) {
            int x3 = X%3; X/=3;
            if (x3 == 1 || x3 == 2) ans[a] = 1;
            if (x3 == 0 || x3 == 2) ans[b] = 1;
        }
    }
    for (int i = 0; i<N; i++){
        Set(i,ans[i]);
    }
}
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#include "Brunolib.h"

long long Bruno( int N, int A[] ){
    vector<int> p = {110,51,11,69,119,142,17,109,26,101,115,39,108,2,75,56,59,18,32,116,143,86,57,133,14,42,27,136,104,58,30,96,13,68,130,114,71,102,9,139,66,80,103,79,89,81,106,0,134,41,88,28,52,43,16,60,49,105,149,132,29,112,141,45,53,76,8,33,37,15,25,55,70,31,82,47,111,107,90,117,23,122,77,19,126,44,120,131,97,1,38,95,4,21,137,5,121,65,135,144,7,138,64,148,140,100,73,10,83,113,92,48,61,127,87,67,40,124,63,129,93,78,74,54,34,123,85,36,6,24,3,125,72,145,94,50,62,146,98,22,118,128,35,91,46,12,99,84,20,147};
    vector<int> pr(N);
    for (int i = 0; i<N; i++) {
        pr[p[i]] = i;
    }
    ll X = 0;
    ll p3 = 1;
    for (int i = 0; i<N; i+=2) {
        int a = p[i], b = p[i+1];
        if (A[a] || A[b]) {
            ll x3 = 2*A[a] + A[b] -1;
            X+=p3 * x3;
            p3 *= 3;
        }
    }
    return X;
}
# Verdict Execution time Memory Grader output
1 Partially correct 51 ms 3312 KB Output is partially correct - L* = 38
2 Partially correct 49 ms 3312 KB Output is partially correct - L* = 38
3 Partially correct 51 ms 3320 KB Output is partially correct - L* = 38
4 Partially correct 49 ms 3312 KB Output is partially correct - L* = 38
5 Partially correct 49 ms 3304 KB Output is partially correct - L* = 39
6 Partially correct 61 ms 3312 KB Output is partially correct - L* = 38
7 Partially correct 52 ms 3312 KB Output is partially correct - L* = 38
8 Partially correct 50 ms 3312 KB Output is partially correct - L* = 38
9 Partially correct 49 ms 3312 KB Output is partially correct - L* = 38
10 Partially correct 50 ms 3312 KB Output is partially correct - L* = 37
11 Partially correct 49 ms 3312 KB Output is partially correct - L* = 38
12 Partially correct 50 ms 3312 KB Output is partially correct - L* = 37
13 Partially correct 48 ms 3312 KB Output is partially correct - L* = 38
14 Partially correct 49 ms 3312 KB Output is partially correct - L* = 38
15 Partially correct 50 ms 3320 KB Output is partially correct - L* = 38
16 Partially correct 49 ms 3312 KB Output is partially correct - L* = 38
17 Partially correct 49 ms 3312 KB Output is partially correct - L* = 37
18 Partially correct 51 ms 3312 KB Output is partially correct - L* = 38
19 Partially correct 51 ms 3320 KB Output is partially correct - L* = 38
20 Partially correct 52 ms 3312 KB Output is partially correct - L* = 38
21 Partially correct 50 ms 3312 KB Output is partially correct - L* = 38
22 Partially correct 51 ms 3056 KB Output is partially correct - L* = 38
23 Partially correct 54 ms 3312 KB Output is partially correct - L* = 38
24 Partially correct 55 ms 3312 KB Output is partially correct - L* = 38
25 Partially correct 51 ms 3312 KB Output is partially correct - L* = 38
26 Partially correct 53 ms 3312 KB Output is partially correct - L* = 38
27 Partially correct 49 ms 3056 KB Output is partially correct - L* = 37
28 Partially correct 49 ms 3320 KB Output is partially correct - L* = 38
29 Partially correct 50 ms 3312 KB Output is partially correct - L* = 38
30 Partially correct 48 ms 3312 KB Output is partially correct - L* = 38
31 Partially correct 49 ms 3312 KB Output is partially correct - L* = 38
32 Partially correct 49 ms 3312 KB Output is partially correct - L* = 38
33 Partially correct 52 ms 3320 KB Output is partially correct - L* = 38
34 Partially correct 50 ms 3312 KB Output is partially correct - L* = 38
35 Partially correct 50 ms 3568 KB Output is partially correct - L* = 38
36 Partially correct 49 ms 3312 KB Output is partially correct - L* = 38
37 Partially correct 49 ms 3312 KB Output is partially correct - L* = 38
38 Partially correct 49 ms 3312 KB Output is partially correct - L* = 39
39 Partially correct 51 ms 3312 KB Output is partially correct - L* = 38
40 Partially correct 51 ms 3320 KB Output is partially correct - L* = 38