Submission #204099

# Submission time Handle Problem Language Result Execution time Memory
204099 2020-02-24T11:03:07 Z coldEr66 Broken Device (JOI17_broken_device) C++14
0 / 100
118 ms 3312 KB
#include "Annalib.h"

const int MAXn = 173;
int ok[MAXn],d[MAXn];
void Anna( int N, long long X, int K, int P[] ){
    for (int i=0;i<N;i++) {
        ok[i] = d[i] = 0;
    }
    for (int i=0;i<K;i++) {
        ok[P[i]] = 1;
    }

    for (int i=0;i<N;i+=3) {
        int tmp = d[i] + d[i+1] + d[i+2];
        if (tmp >= 2) continue;
        if (tmp == 1) {
            if (X % 2 == 0) {
                if (ok[i+2]) d[i] = d[i+1] = 1;
                else d[i+2] = 1;
            }
            else {
                if (ok[i]) {
                    if (X % 4 == 2) d[i+1] = 1;
                    else d[i+1] = d[i+2] = 1;
                    X >>= 1;
                }
                else d[i] = 1;
            }
            X >>= 1;
        }
        else {
            if (X % 4 == 0) d[i] = d[i+1] = d[i+2] = 1;
            else if (X % 4 == 1) d[i] = d[i+2] = 1;
            else if (X % 4 == 2) d[i+1] = 1;
            else d[i+1] = d[i+2] = 1;
            X >>= 2;
        }
    }
    for (int i=0;i<N;i++) {
        Set(i, d[i]);
    }
}
#include "Brunolib.h"
#include <algorithm>
#include <iostream>
using namespace std;
typedef pair<int,int> ii;
#define X first
#define Y second

ii gt(int a,int b,int c){
    int ret = 4*a + 2*b + c;
    if (ret != 7) cout << ret << endl;
    if (ret == 0) return ii(1,0);
    if (ret == 1) return ii(2,0);
    if (ret == 2) return ii(4,2);
    if (ret == 3) return ii(4,3);
    if (ret == 4) return ii(2,1);
    if (ret == 5) return ii(4,1);
    if (ret == 6) return ii(2,0);
    if (ret == 7) return ii(4,0);
    return ii(0,0);
}
long long Bruno( int N, int A[] ){
    long long ret = 0;
    for (int i=N-3;i>=0;i-=3) {
        ii tmp = gt(A[i],A[i+1],A[i+2]);
        ret = ret * tmp.X + tmp.Y;
    }
    return ret;
}
# Verdict Execution time Memory Grader output
1 Incorrect 114 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
2 Incorrect 115 ms 3064 KB Program terminated incorrectly, or you printed something to stdout
3 Incorrect 114 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
4 Incorrect 113 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
5 Incorrect 113 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
6 Incorrect 114 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
7 Incorrect 114 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
8 Incorrect 110 ms 2800 KB Program terminated incorrectly, or you printed something to stdout
9 Incorrect 118 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
10 Incorrect 115 ms 3064 KB Program terminated incorrectly, or you printed something to stdout
11 Incorrect 112 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
12 Incorrect 117 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
13 Incorrect 114 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
14 Incorrect 115 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
15 Incorrect 115 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
16 Incorrect 113 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
17 Incorrect 112 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
18 Incorrect 114 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
19 Incorrect 114 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
20 Incorrect 114 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
21 Incorrect 113 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
22 Incorrect 114 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
23 Incorrect 117 ms 3312 KB Program terminated incorrectly, or you printed something to stdout
24 Incorrect 111 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
25 Incorrect 114 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
26 Incorrect 113 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
27 Incorrect 112 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
28 Incorrect 113 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
29 Incorrect 114 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
30 Incorrect 111 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
31 Incorrect 113 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
32 Incorrect 113 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
33 Incorrect 118 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
34 Incorrect 111 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
35 Incorrect 112 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
36 Incorrect 112 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
37 Incorrect 114 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
38 Incorrect 110 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
39 Incorrect 110 ms 3056 KB Program terminated incorrectly, or you printed something to stdout
40 Incorrect 110 ms 3056 KB Program terminated incorrectly, or you printed something to stdout