Submission #380872

#TimeUsernameProblemLanguageResultExecution timeMemory
380872BlancaHMPainting Squares (IOI20_squares)C++14
0 / 100
1 ms200 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...