Submission #260309

# Submission time Handle Problem Language Result Execution time Memory
260309 2020-08-10T05:02:12 Z 문홍윤(#5075) Broken Device (JOI17_broken_device) C++14
85 / 100
50 ms 3312 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(ch[l]||ch[r]||re<0)Set(l, 0), Set(r, 0);
        else{
            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 Partially correct 46 ms 3056 KB Output is partially correct - L* = 37
2 Partially correct 49 ms 3056 KB Output is partially correct - L* = 39
3 Partially correct 48 ms 3056 KB Output is partially correct - L* = 38
4 Partially correct 45 ms 3072 KB Output is partially correct - L* = 39
5 Partially correct 45 ms 3072 KB Output is partially correct - L* = 39
6 Partially correct 44 ms 3072 KB Output is partially correct - L* = 37
7 Partially correct 46 ms 3072 KB Output is partially correct - L* = 39
8 Partially correct 46 ms 3056 KB Output is partially correct - L* = 39
9 Partially correct 50 ms 3312 KB Output is partially correct - L* = 39
10 Partially correct 45 ms 3072 KB Output is partially correct - L* = 38
11 Partially correct 46 ms 3064 KB Output is partially correct - L* = 38
12 Partially correct 45 ms 3056 KB Output is partially correct - L* = 38
13 Partially correct 44 ms 3056 KB Output is partially correct - L* = 37
14 Partially correct 47 ms 3056 KB Output is partially correct - L* = 39
15 Partially correct 44 ms 3072 KB Output is partially correct - L* = 38
16 Partially correct 46 ms 3056 KB Output is partially correct - L* = 38
17 Partially correct 44 ms 3072 KB Output is partially correct - L* = 37
18 Partially correct 47 ms 3056 KB Output is partially correct - L* = 39
19 Partially correct 45 ms 3008 KB Output is partially correct - L* = 38
20 Partially correct 45 ms 3072 KB Output is partially correct - L* = 38
21 Partially correct 45 ms 3072 KB Output is partially correct - L* = 37
22 Partially correct 45 ms 3072 KB Output is partially correct - L* = 38
23 Partially correct 44 ms 3056 KB Output is partially correct - L* = 38
24 Partially correct 43 ms 3056 KB Output is partially correct - L* = 38
25 Partially correct 46 ms 3072 KB Output is partially correct - L* = 39
26 Partially correct 45 ms 3072 KB Output is partially correct - L* = 37
27 Partially correct 45 ms 3072 KB Output is partially correct - L* = 38
28 Partially correct 44 ms 3072 KB Output is partially correct - L* = 38
29 Partially correct 44 ms 3072 KB Output is partially correct - L* = 39
30 Partially correct 44 ms 3072 KB Output is partially correct - L* = 39
31 Partially correct 45 ms 3072 KB Output is partially correct - L* = 39
32 Partially correct 46 ms 3072 KB Output is partially correct - L* = 38
33 Partially correct 45 ms 3056 KB Output is partially correct - L* = 38
34 Partially correct 45 ms 3056 KB Output is partially correct - L* = 38
35 Partially correct 45 ms 3056 KB Output is partially correct - L* = 38
36 Partially correct 44 ms 3072 KB Output is partially correct - L* = 38
37 Partially correct 47 ms 3072 KB Output is partially correct - L* = 37
38 Partially correct 50 ms 3072 KB Output is partially correct - L* = 38
39 Partially correct 45 ms 3072 KB Output is partially correct - L* = 38
40 Partially correct 47 ms 3312 KB Output is partially correct - L* = 37