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 <iostream>
#include <vector>
#include <unordered_set>
using namespace std;
vector<int> squares;
vector<int> paint(int n) {
squares = vector<int>(n+1);
squares[n] = 10;
unordered_set<string> used;
string window = "1111111111";
for (int i = 0; i < 10; i++) {
if (i == n)
break;
squares[i] = 1;
}
used.insert(window);
for (int i = 10; i < n; i++) {
window.erase(0, 1);
window.push_back('0');
if (used.find(window) == used.end())
squares[i] = 0;
else {
squares[i] = 1;
window[9] = '1';
}
used.insert(window);
}
return squares;
}
int find_location(int n, vector<int> c) {
// squares = paint(n);
if (c[9] == -1) {
int num = -1;
while(num < 10 && c[num+1] != -1)
num++;
return n - (num+1);
}
bool found;
int pos = 0;
for (int i = 0; i <= n-10; i++) {
found = true;
for (int j = 0; j < 10; j++) {
if (squares[i+j] != c[j]) {
found = false;
break;
}
}
if (found) {
pos = i;
break;
}
}
return pos;
}
# | 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... |