# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
741354 | josanneo22 | Painting Squares (IOI20_squares) | C++17 | 1 ms | 304 KiB |
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;
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
vector<int> ans;
void Init(){
int k = 10;
for (int i = 0; i < 10; i++) ans.push_back(1);
int v = (1 << k) - 1;
vector<bool> kt(1 << k);
kt[v] = true;
while ((int)ans.size() < 1000) {
v = (v << 1) % (1 << k);
int sign = 0;
if (kt[v]) {
v++;
sign = 1;
}
kt[v] = true;
ans.push_back(sign);
}
}
#include "squares.h"
#include <vector>
std::vector<int> paint(int n) {
std::vector<int> labels(n + 1, 1);
if(ans.empty()) Init();
ans[n]=10;
for(int i=0;i<n;i++) labels[i]=ans[i];
return labels;
}
int find_location(int n, std::vector<int> c) {
if(ans.empty()) Init();
vector<int> nw;
for(int i=0;i<n;i++){
for(int j=0;j<10;j++){
if(i+j>n) nw.pb(-1);
else nw.pb(ans[i+j]);
}
if(nw==c) return i;
}
}
Compilation message (stderr)
# | 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... |