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>
#include "squares.h"
using namespace std;
const int c=512;
int n;
vector<int> sol, s, ans, sz[c];
bool v[c][2];
void dfs(int a) {
if (!v[a][0]) {
v[a][0]=1, dfs(sz[a][0]);
s.push_back(0);
}
if (!v[a][1]) {
v[a][1]=1, dfs(sz[a][1]);
s.push_back(1);
}
}
vector<int> paint(int N) {
n=N;
for (int i=0; i<c; i++) sz[i].clear(), sol.clear(), s.clear(), ans.clear(), v[i][0]=0, v[i][1]=0;
for (int i=0; i<c; i++) {
int x=2*i%c;
sz[i].push_back(x), sz[i].push_back(x+1);
}
dfs(0);
for (int i=0; i<9; i++) sol.push_back(0);
while(s.size()>0) sol.push_back(s.back()), s.pop_back();
for (int i=0; i<n; i++) ans.push_back(sol[i]);
ans.push_back(min(10, n));
for (int i=0; i<10; i++) sol.push_back(-1);
for (int i=n; i<n+10; i++) sol[i]=-1;
return ans;
}
int find_location(int k, vector<int> sz) {
for (int i=0; i<n; i++) {
bool jo=1;
for (int j=0; j<k; j++) {
if (sol[i+j]!=sz[j]) jo=0;
}
if (jo) return i;
}
return n;
}
# | 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... |