Submission #100872

#TimeUsernameProblemLanguageResultExecution timeMemory
100872Pro_ktmrBroken Device (JOI17_broken_device)C++14
0 / 100
66 ms3312 KiB
#include"bits/stdc++.h" using namespace std; #define LL long long #define MP make_pair #include"Annalib.h" //void Set(int pos, int bit) //N=150 void Anna(int N, long long X, int K, int P[]){ bool canUse[150]; for(int i=0; i<N; i++) canUse[i] = true; for(int i=0; i<K; i++) canUse[P[i]] = false; int now = 0; for(int i=0; i<N; i++){ if(i+1 < N && canUse[i] && canUse[i+1]){ Set(i, 1); Set(i+1, (X>>now)%2); i++; now++; } else if(i+1 < N && canUse[i] && (X>>now)%2 == 0){ Set(i, 1); Set(i+1, 0); i++; now++; } else{ Set(i, 0); } } }
#include"bits/stdc++.h" using namespace std; #define LL long long #define MP make_pair #include"Brunolib.h" long long Bruno(int N, int A[]){ long long ans; int now = 0; for(int i=0; i+1<N; i++){ if(A[i] == 1){ ans += A[i+1]<<now; i++; now++; } } return ans; }

Compilation message (stderr)

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:17:9: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
  return ans;
         ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...