Submission #260318

# Submission time Handle Problem Language Result Execution time Memory
260318 2020-08-10T05:08:44 Z 문홍윤(#5075) Broken Device (JOI17_broken_device) C++14
100 / 100
52 ms 3328 KB
#include "Annalib.h"
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;

static bool ch[210];
static LL thr[210];
static int len=38;

static pii INIT[75]={{12, 39}, {87, 4}, {2, 75}, {77, 32}, {62, 1}, {35, 106}, {84, 82}, {60, 92}, {118, 98}, {55, 115}, {96, 67}, {72, 5}, {48, 86}, {26, 93}, {102, 105}, {94, 81}, {0, 36}, {88, 141}, {148, 58}, {110, 31}, {139, 45}, {78, 7}, {9, 114}, {113, 51}, {24, 140}, {107, 29}, {74, 20}, {6, 52}, {42, 27}, {145, 80}, {91, 69}, {109, 121}, {66, 136}, {89, 100}, {59, 44}, {143, 79}, {101, 37}, {54, 99}, {10, 117}, {131, 128}, {137, 112}, {138, 83}, {21, 133}, {46, 40}, {50, 76}, {142, 103}, {125, 104}, {15, 123}, {30, 47}, {18, 14}, {33, 64}, {108, 73}, {90, 25}, {28, 8}, {41, 11}, {19, 116}, {57, 63}, {34, 147}, {71, 124}, {13, 111}, {149, 49}, {23, 132}, {120, 53}, {38, 130}, {68, 127}, {129, 3}, {65, 17}, {135, 22}, {43, 119}, {126, 61}, {56, 144}, {95, 85}, {146, 134}, {16, 70}, {97, 122}};

void Anna(int N, LL X, int K, int P[]){
    memset(ch, 0, sizeof ch);
    for(int i=0; i<K; i++)ch[P[i]]=true;
    for(int i=1; i<=len; i++){
        thr[i]=X%3;
        X/=3;
    }
    int re=len;
    for(int i=0; i<75; i++){
        int l=INIT[i].F, r=INIT[i].S;
        if(re<0){
            Set(l, 0), Set(r, 0);
            continue;
        }
        if(thr[re]==0&&ch[r]){
            Set(l, 0), Set(r, 0);
            continue;
        }
        if(thr[re]==1&&ch[l]){
            Set(l, 0), Set(r, 0);
            continue;
        }
        if(thr[re]==2&&(ch[l]||ch[r])){
            Set(l, 0), Set(r, 0);
            continue;
        }
        if(thr[re]==0)Set(l, 0), Set(r, 1);
        if(thr[re]==1)Set(l, 1), Set(r, 0);
        if(thr[re]==2)Set(l, 1), Set(r, 1);
        re--;
    }
}
#include "Brunolib.h"
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;

static int len=38;

static pii INIT[75]={{12, 39}, {87, 4}, {2, 75}, {77, 32}, {62, 1}, {35, 106}, {84, 82}, {60, 92}, {118, 98}, {55, 115}, {96, 67}, {72, 5}, {48, 86}, {26, 93}, {102, 105}, {94, 81}, {0, 36}, {88, 141}, {148, 58}, {110, 31}, {139, 45}, {78, 7}, {9, 114}, {113, 51}, {24, 140}, {107, 29}, {74, 20}, {6, 52}, {42, 27}, {145, 80}, {91, 69}, {109, 121}, {66, 136}, {89, 100}, {59, 44}, {143, 79}, {101, 37}, {54, 99}, {10, 117}, {131, 128}, {137, 112}, {138, 83}, {21, 133}, {46, 40}, {50, 76}, {142, 103}, {125, 104}, {15, 123}, {30, 47}, {18, 14}, {33, 64}, {108, 73}, {90, 25}, {28, 8}, {41, 11}, {19, 116}, {57, 63}, {34, 147}, {71, 124}, {13, 111}, {149, 49}, {23, 132}, {120, 53}, {38, 130}, {68, 127}, {129, 3}, {65, 17}, {135, 22}, {43, 119}, {126, 61}, {56, 144}, {95, 85}, {146, 134}, {16, 70}, {97, 122}};

LL Bruno(int N, int A[]){
    LL ret=0;
    int num=0;
    for(int i=0; i<75; i++){
        int l=INIT[i].F, r=INIT[i].S;
        if(!A[l]&&!A[r])continue;
        ret*=3;
        if(A[l]&&!A[r])ret++;
        if(A[l]&&A[r])ret+=2;
        num++;
        if(num>=len)return ret;
    }
}

Compilation message

Bruno.cpp: In function 'LL Bruno(int, int*)':
Bruno.cpp:25:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 46 ms 3072 KB Output is correct - L* = 40
2 Correct 48 ms 3072 KB Output is correct - L* = 40
3 Correct 50 ms 3056 KB Output is correct - L* = 40
4 Correct 52 ms 3072 KB Output is correct - L* = 40
5 Correct 49 ms 3072 KB Output is correct - L* = 40
6 Correct 44 ms 3056 KB Output is correct - L* = 40
7 Correct 44 ms 3072 KB Output is correct - L* = 40
8 Correct 45 ms 3072 KB Output is correct - L* = 40
9 Correct 44 ms 3056 KB Output is correct - L* = 40
10 Correct 46 ms 3072 KB Output is correct - L* = 40
11 Correct 45 ms 3056 KB Output is correct - L* = 40
12 Correct 46 ms 3072 KB Output is correct - L* = 40
13 Correct 44 ms 3056 KB Output is correct - L* = 40
14 Correct 44 ms 3024 KB Output is correct - L* = 40
15 Correct 44 ms 3056 KB Output is correct - L* = 40
16 Correct 46 ms 3072 KB Output is correct - L* = 40
17 Correct 45 ms 3056 KB Output is correct - L* = 40
18 Correct 44 ms 3072 KB Output is correct - L* = 40
19 Correct 44 ms 3056 KB Output is correct - L* = 40
20 Correct 45 ms 2864 KB Output is correct - L* = 40
21 Correct 45 ms 3072 KB Output is correct - L* = 40
22 Correct 45 ms 3072 KB Output is correct - L* = 40
23 Correct 45 ms 3072 KB Output is correct - L* = 40
24 Correct 45 ms 3056 KB Output is correct - L* = 40
25 Correct 45 ms 3072 KB Output is correct - L* = 40
26 Correct 44 ms 3072 KB Output is correct - L* = 40
27 Correct 46 ms 3328 KB Output is correct - L* = 40
28 Correct 52 ms 3056 KB Output is correct - L* = 40
29 Correct 44 ms 3072 KB Output is correct - L* = 40
30 Correct 46 ms 3072 KB Output is correct - L* = 40
31 Correct 48 ms 3072 KB Output is correct - L* = 40
32 Correct 46 ms 3072 KB Output is correct - L* = 40
33 Correct 45 ms 3056 KB Output is correct - L* = 40
34 Correct 48 ms 3056 KB Output is correct - L* = 40
35 Correct 46 ms 3072 KB Output is correct - L* = 40
36 Correct 44 ms 3072 KB Output is correct - L* = 40
37 Correct 44 ms 3072 KB Output is correct - L* = 40
38 Correct 49 ms 3056 KB Output is correct - L* = 40
39 Correct 45 ms 3072 KB Output is correct - L* = 40
40 Correct 44 ms 3072 KB Output is correct - L* = 40