Submission #380880

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