Submission #72673

#TimeUsernameProblemLanguageResultExecution timeMemory
72673ikura355Broken Device (JOI17_broken_device)C++14
0 / 100
9 ms1100 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;y+60<N;y++) { if(bad[y+60]) continue; int good = 1; for(int i=0;i<60;i++) { if(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 (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...