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 "squares.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
const int N = 1000;
const int K = 10;
int a[N];
vector<int> generate(int n) {
unordered_set<int> nums;
vector<int> v(n);
nums.insert((1 << K) - 1);
for(int i = 0; i < N; ++i) a[i] = 0;
for(int i = 0; i < K; ++i) a[i] = 1;
int cur = (1 << K) - 1;
for(int i = 1; i + K - 1 < N; ++i) {
cur >>= 1;
if(nums.find(cur) != nums.end()) {
a[i + K - 1] = 1;
cur += (1 << K);
}
nums.insert(cur);
}
for(int i = 0; i < n; ++i) v[i] = a[i];
return v;
}
std::vector<int> paint(int n) {
vector<int> labels = generate(n);
labels.push_back(10);
return labels;
}
int find_location(int n, std::vector<int> c) {
vector<int> paiu = generate(n);
int number = 0;
for(int i = 0; i < (int)c.size(); ++i) {
if(c[i] == -1) {
return n - i;
}
if(c[i] == 1) number += (1 << i);
}
for(int i = 0; i + K - 1 < n; ++i) {
int number2 = 0;
for(int j = 0; j < K; ++j) {
if(paiu[i + j]) number2 += (1 << j);
}
if(number == number2) return i;
}
assert(false);
return -1;
}
# | 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... |