# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
21036 | 2017-03-30T21:05:56 Z | sbansalcs | Broken Device (JOI17_broken_device) | C++14 | 0 ms | 0 KB |
#include "Annalib.h" #include <stack> #include <vector> #include <assert.h> using namespace std; const int N = 155; int arr[N]; int arr2[N]; void Anna( int N, long long X, int K, int P[] ){ long long X2=X; vector<int> vt; stack<int> st; for(int i=0;i<N;i++) { arr[i]=0,arr2[i]=0; } for(int i=0;i<60;i++) { st.push(X2%2); X2/=2; } for(int i=0;i<K;i++) { arr2[P[i]]=1; } int i=0; int cnt=0; while(i+3<N) { bool poss=1; for(int j=i;j<=i+3;j++) { if(arr2[j]) poss=0; } if(poss) { cnt++; vt.push(i); } assert(cnt>=20); } for( int i = 0; i < N; i++ ){ Set( i, arr[i]); } }