Submission #72702

# Submission time Handle Problem Language Result Execution time Memory
72702 2018-08-26T16:40:46 Z ikura355 Broken Device (JOI17_broken_device) C++14
100 / 100
77 ms 3984 KB
#include "Annalib.h"
#include<bits/stdc++.h>
using namespace std;

const int maxn = 150 + 5;

int bad[maxn], res[maxn];

void Anna(int N, long long X, int K, int P[]) {
    for(int i=0;i<N;i++) bad[i] = 0;
    for(int i=0;i<K;i++) bad[P[i]] = 1;
    for(int i=0;i<N;i++) res[i] = 0;
    for(int i=0;i<N;i+=3) {
        if(bad[i] + bad[i+1] + bad[i+2] == 0) {
            int val = X%4;
            if(val==0) res[i] = res[i+2] = 1;
            if(val==1) res[i+1] = 1;
            if(val==2) res[i] = res[i+1] = res[i+2] = 1;
            if(val==3) res[i+1] = 1, res[i+2] = 1;
            X /= 4;
        }
        else if(bad[i] + bad[i+1] + bad[i+2] == 1) {
            int val = X%2;
            if(val==0) {
                if(bad[i] || bad[i+1]) res[i+2] = 1;
                if(bad[i+2]) res[i] = res[i+1] = 1;
            }
            if(val==1) {
                if(bad[i+1] || bad[i+2]) {
                    res[i] = 1;
                }
                if(bad[i]) {
                    if(X%4 == 1) res[i+1] = 1;
                    if(X%4 == 3) res[i+1] = 1, res[i+2] = 1;
                    X /= 2;
                }
            }
            X /= 2;
        }
    }
    for(int i=0;i<N;i++) Set(i,res[i]);
}
#include "Brunolib.h"
#include<bits/stdc++.h>
using namespace std;

long long Bruno(int N, int A[]) {
    long long ans = 0;
    for(int i=N-3;i>=0;i-=3) {
        int x = A[i], y = A[i+1], z = A[i+2];
        int val = x*4 + y*2 + z;
        if(val==1 || val==6) ans = ans*2;
        if(val==4) ans = ans*2 + 1;
        if(val==2) ans = ans*4 + 1;
        if(val==3) ans = ans*4 + 3;
        if(val==5) ans = ans*4;
        if(val==7) ans = ans*4 + 2;
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 59 ms 2800 KB Output is correct - L* = 40
2 Correct 77 ms 3192 KB Output is correct - L* = 40
3 Correct 51 ms 3480 KB Output is correct - L* = 40
4 Correct 51 ms 3560 KB Output is correct - L* = 40
5 Correct 54 ms 3560 KB Output is correct - L* = 40
6 Correct 51 ms 3592 KB Output is correct - L* = 40
7 Correct 54 ms 3592 KB Output is correct - L* = 40
8 Correct 52 ms 3744 KB Output is correct - L* = 40
9 Correct 62 ms 3744 KB Output is correct - L* = 40
10 Correct 49 ms 3744 KB Output is correct - L* = 40
11 Correct 54 ms 3744 KB Output is correct - L* = 40
12 Correct 53 ms 3744 KB Output is correct - L* = 40
13 Correct 48 ms 3744 KB Output is correct - L* = 40
14 Correct 48 ms 3744 KB Output is correct - L* = 40
15 Correct 65 ms 3744 KB Output is correct - L* = 40
16 Correct 57 ms 3744 KB Output is correct - L* = 40
17 Correct 56 ms 3984 KB Output is correct - L* = 40
18 Correct 61 ms 3984 KB Output is correct - L* = 40
19 Correct 66 ms 3984 KB Output is correct - L* = 40
20 Correct 54 ms 3984 KB Output is correct - L* = 40
21 Correct 48 ms 3984 KB Output is correct - L* = 40
22 Correct 60 ms 3984 KB Output is correct - L* = 40
23 Correct 49 ms 3984 KB Output is correct - L* = 40
24 Correct 62 ms 3984 KB Output is correct - L* = 40
25 Correct 55 ms 3984 KB Output is correct - L* = 40
26 Correct 59 ms 3984 KB Output is correct - L* = 40
27 Correct 53 ms 3984 KB Output is correct - L* = 40
28 Correct 53 ms 3984 KB Output is correct - L* = 40
29 Correct 64 ms 3984 KB Output is correct - L* = 40
30 Correct 52 ms 3984 KB Output is correct - L* = 40
31 Correct 51 ms 3984 KB Output is correct - L* = 40
32 Correct 65 ms 3984 KB Output is correct - L* = 40
33 Correct 43 ms 3984 KB Output is correct - L* = 40
34 Correct 62 ms 3984 KB Output is correct - L* = 40
35 Correct 65 ms 3984 KB Output is correct - L* = 40
36 Correct 56 ms 3984 KB Output is correct - L* = 40
37 Correct 47 ms 3984 KB Output is correct - L* = 40
38 Correct 51 ms 3984 KB Output is correct - L* = 40
39 Correct 50 ms 3984 KB Output is correct - L* = 40
40 Correct 58 ms 3984 KB Output is correct - L* = 40