This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bits/stdc++.h"
using namespace std;
int ans[1024];
vector<int> paint(int n){
vector<int> ret(10), used(1024);
int i = 0, idx = 0;
while(!used[i]){
used[i] = 1;
++idx;
i = (i+i) & 1023;
if(!used[i+1]) ++i;
ret.push_back(i & 1);
ans[i] = idx;
}
ret.resize(n);
ret.push_back(10);
return ret;
}
int find_location(int n, vector<int> c){
if(!ans[1]) paint(1024);
if(c.back() < 0){
int r = n + 1;
for(int i : c) if(i > 0) --r;
return r;
}
int x = 0;
for(int i : c) x = x + x + i;
return ans[x];
}
/*
int main(){
//auto v = paint(1033);
//for(int i : v) cout << i;
//cout << endl;
vector<int> q = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0};
cout << find_location(5, q) << endl;
q = {1, 1, 1, 1, 1, 1, 1, 1, 1, 0};
cout << find_location(5, q) << endl;
}
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |