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>
using namespace std;
vector<int> squares;
vector<int> paint(int n) {
squares = vector<int>(n+1);
// rellenar squares con los números en binario (8 bits) del 00000001 a 00111111
int numero = 1;
for (int i = 0; i < n; i += 8) {
for (int j = 0; j < 8; j++) {
if (i + j == n)
break;
if (numero & (1<<(7-j)))
squares[i+j] = 1;
else
squares[i+j] = 0;
}
numero++;
}
squares[n] = 10;
return squares;
}
int find_location(int n, vector<int> c) {
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... |