답안 #260306

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
260306 2020-08-10T04:58:17 Z 문홍윤(#5075) Broken Device (JOI17_broken_device) C++14
85 / 100
55 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]={{83, 28}, {64, 123}, {67, 21}, {43, 74}, {107, 18}, {46, 33}, {56, 68}, {14, 27}, {96, 122}, {3, 10}, {131, 77}, {91, 149}, {136, 36}, {76, 120}, {139, 61}, {137, 6}, {105, 49}, {72, 63}, {98, 5}, {87, 54}, {71, 117}, {65, 66}, {44, 59}, {42, 116}, {134, 145}, {47, 2}, {141, 62}, {30, 51}, {97, 70}, {57, 88}, {142, 4}, {24, 80}, {53, 109}, {7, 20}, {127, 23}, {13, 110}, {148, 9}, {25, 95}, {26, 130}, {41, 31}, {45, 55}, {58, 29}, {135, 37}, {69, 86}, {15, 22}, {112, 111}, {104, 106}, {133, 114}, {93, 11}, {113, 101}, {85, 34}, {90, 150}, {39, 78}, {35, 16}, {140, 92}, {60, 118}, {8, 52}, {79, 108}, {125, 121}, {100, 103}, {132, 50}, {89, 102}, {126, 124}, {128, 146}, {75, 115}, {32, 119}, {147, 129}, {94, 38}, {73, 1}, {17, 99}, {81, 143}, {12, 48}, {144, 19}, {84, 40}, {138, 82}};
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-1, r=INIT[i].S-1;
        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]={{83, 28}, {64, 123}, {67, 21}, {43, 74}, {107, 18}, {46, 33}, {56, 68}, {14, 27}, {96, 122}, {3, 10}, {131, 77}, {91, 149}, {136, 36}, {76, 120}, {139, 61}, {137, 6}, {105, 49}, {72, 63}, {98, 5}, {87, 54}, {71, 117}, {65, 66}, {44, 59}, {42, 116}, {134, 145}, {47, 2}, {141, 62}, {30, 51}, {97, 70}, {57, 88}, {142, 4}, {24, 80}, {53, 109}, {7, 20}, {127, 23}, {13, 110}, {148, 9}, {25, 95}, {26, 130}, {41, 31}, {45, 55}, {58, 29}, {135, 37}, {69, 86}, {15, 22}, {112, 111}, {104, 106}, {133, 114}, {93, 11}, {113, 101}, {85, 34}, {90, 150}, {39, 78}, {35, 16}, {140, 92}, {60, 118}, {8, 52}, {79, 108}, {125, 121}, {100, 103}, {132, 50}, {89, 102}, {126, 124}, {128, 146}, {75, 115}, {32, 119}, {147, 129}, {94, 38}, {73, 1}, {17, 99}, {81, 143}, {12, 48}, {144, 19}, {84, 40}, {138, 82}};

LL Bruno(int N, int A[]){
    LL ret=0;
    int num=0;
    for(int i=0; i<75; i++){
        int l=INIT[i].F-1, r=INIT[i].S-1;
        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:24:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Partially correct 44 ms 3064 KB Output is partially correct - L* = 38
2 Partially correct 47 ms 3072 KB Output is partially correct - L* = 37
3 Partially correct 47 ms 3056 KB Output is partially correct - L* = 38
4 Partially correct 49 ms 3072 KB Output is partially correct - L* = 38
5 Partially correct 49 ms 3056 KB Output is partially correct - L* = 39
6 Partially correct 49 ms 3072 KB Output is partially correct - L* = 39
7 Partially correct 55 ms 3064 KB Output is partially correct - L* = 38
8 Partially correct 45 ms 3056 KB Output is partially correct - L* = 38
9 Partially correct 48 ms 3056 KB Output is partially correct - L* = 38
10 Partially correct 50 ms 3064 KB Output is partially correct - L* = 37
11 Partially correct 49 ms 3072 KB Output is partially correct - L* = 39
12 Partially correct 45 ms 3072 KB Output is partially correct - L* = 38
13 Partially correct 44 ms 3072 KB Output is partially correct - L* = 39
14 Partially correct 45 ms 3072 KB Output is partially correct - L* = 38
15 Partially correct 44 ms 3072 KB Output is partially correct - L* = 39
16 Partially correct 45 ms 3072 KB Output is partially correct - L* = 38
17 Partially correct 46 ms 3072 KB Output is partially correct - L* = 39
18 Partially correct 45 ms 3072 KB Output is partially correct - L* = 37
19 Partially correct 47 ms 3056 KB Output is partially correct - L* = 39
20 Partially correct 45 ms 3328 KB Output is partially correct - L* = 39
21 Partially correct 44 ms 3072 KB Output is partially correct - L* = 39
22 Partially correct 43 ms 3056 KB Output is partially correct - L* = 37
23 Partially correct 44 ms 3072 KB Output is partially correct - L* = 37
24 Partially correct 45 ms 3056 KB Output is partially correct - L* = 39
25 Partially correct 44 ms 3328 KB Output is partially correct - L* = 38
26 Partially correct 45 ms 3056 KB Output is partially correct - L* = 39
27 Partially correct 44 ms 3056 KB Output is partially correct - L* = 39
28 Partially correct 44 ms 3056 KB Output is partially correct - L* = 38
29 Partially correct 43 ms 3072 KB Output is partially correct - L* = 37
30 Partially correct 44 ms 3072 KB Output is partially correct - L* = 39
31 Partially correct 44 ms 3312 KB Output is partially correct - L* = 39
32 Partially correct 53 ms 3056 KB Output is partially correct - L* = 37
33 Partially correct 45 ms 3056 KB Output is partially correct - L* = 38
34 Partially correct 45 ms 3072 KB Output is partially correct - L* = 39
35 Partially correct 45 ms 3072 KB Output is partially correct - L* = 39
36 Partially correct 46 ms 3056 KB Output is partially correct - L* = 38
37 Partially correct 48 ms 3312 KB Output is partially correct - L* = 38
38 Partially correct 45 ms 3136 KB Output is partially correct - L* = 38
39 Partially correct 49 ms 3072 KB Output is partially correct - L* = 38
40 Partially correct 46 ms 3072 KB Output is partially correct - L* = 38