답안 #72681

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
72681 2018-08-26T14:14:30 Z ikura355 Broken Device (JOI17_broken_device) C++14
0 / 100
6 ms 1092 KB
#include "Annalib.h"
#include<bits/stdc++.h>
using namespace std;

#define ll long long
const int maxn = 150 + 5;

int bad[maxn], res[maxn];
int bit[65];

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<60;i++) bit[i] = (X&(1LL<<i)) ? 1 : 0;
    for(int i=0;i<N;i++) res[i] = 0;
    for(int x=1;x+60<N;x++) {
        if(bad[x-1]) continue;
        for(int y=x+60;y+60<N;y++) {
            if(bad[y+60]) continue;
            int good = 1;
            for(int i=0;i<60;i++) {
                if(bit[i] && bad[x+i] && bad[y+i]) good = 0;
            }
            if(good) {
//                printf("Anna : x = %d y = %d\n",x,y);
                for(int i=0;i<60;i++) {
                    res[x+i] = res[y+i] = bit[i];
                }
                res[x-1] = res[y+60] = 1;
                for(int i=0;i<N;i++) Set(i,res[i]);
                return ;
            }
        }
    }
    assert(0);
}
#include "Brunolib.h"
#include<bits/stdc++.h>
using namespace std;

#define ll long long

ll Bruno(int N, int A[]) {
    int x,y;
    for(int i=0;i<N;i++) {
        if(A[i]==1) {
            x = i+1;
            break;
        }
    }
    for(int i=0;i<N;i++) {
        if(A[i]==1) {
            y = i-60;
        }
    }
    ll ans = 0;
//    printf("Bruno : x = %d y = %d\n",x,y);
    for(int i=0;i<60;i++) {
        ans += (1LL<<i) * (A[x+i]|A[y+i]);
    }
//    printf("ans = %lld\n",ans);
    return ans;
}

Compilation message

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:8:9: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
     int x,y;
         ^
Bruno.cpp:8:11: warning: 'y' may be used uninitialized in this function [-Wmaybe-uninitialized]
     int x,y;
           ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 3 ms 756 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 2 ms 780 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 3 ms 928 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 2 ms 928 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 6 ms 928 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 3 ms 976 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 2 ms 976 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 3 ms 976 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 3 ms 976 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 3 ms 976 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 3 ms 1012 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 2 ms 1012 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 3 ms 1012 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 3 ms 1012 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 3 ms 1012 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 2 ms 1012 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 2 ms 1012 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 3 ms 1012 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 3 ms 1012 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 3 ms 1012 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 3 ms 1076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 4 ms 1076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 3 ms 1076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 3 ms 1076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 2 ms 1076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 4 ms 1076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 4 ms 1076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 3 ms 1076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Runtime error 3 ms 1076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
31 Runtime error 3 ms 1076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Runtime error 4 ms 1076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
33 Runtime error 4 ms 1076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
34 Runtime error 4 ms 1076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
35 Runtime error 3 ms 1092 KB Execution killed with signal 11 (could be triggered by violating memory limits)
36 Runtime error 5 ms 1092 KB Execution killed with signal 11 (could be triggered by violating memory limits)
37 Runtime error 4 ms 1092 KB Execution killed with signal 11 (could be triggered by violating memory limits)
38 Runtime error 3 ms 1092 KB Execution killed with signal 11 (could be triggered by violating memory limits)
39 Runtime error 3 ms 1092 KB Execution killed with signal 11 (could be triggered by violating memory limits)
40 Runtime error 4 ms 1092 KB Execution killed with signal 11 (could be triggered by violating memory limits)