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