제출 #72681

#제출 시각아이디문제언어결과실행 시간메모리
72681ikura355Broken Device (JOI17_broken_device)C++14
0 / 100
6 ms1092 KiB
#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;
}

컴파일 시 표준 에러 (stderr) 메시지

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;
           ^
#Verdict Execution timeMemoryGrader output
Fetching results...