Submission #831028

#TimeUsernameProblemLanguageResultExecution timeMemory
831028KerimPainting Squares (IOI20_squares)C++17
100 / 100
156 ms620 KiB
#include "squares.h" #include "bits/stdc++.h" using namespace std; string S = "0000101000010011000111000100110110110101110011111001011010110110111001000001110111101110101110110101010011010100001101101000001000101101000100111110111001101011110000110011100011011100011101101111001101100100111101011111111001000100101001000011000001101011000111100111011001011110010010011100100110010100010100111011100000011100101110010100110000001011011000110101011100001111000000001001011101010110000000101001010000011000100100101100100011100111001100111111111010110010101010111101001111001010111010011001101001011111101000011101001010100010000010101011011111011001100010111000101100110111011000011100000101110111110000100100000010000100011111110001100001011000101000111010100100110100011010000101111100110000110100110111101010001100011001011000010000000001100100101011001110100000011011111100000111111001111000101010010110111010001011110110001000100011011000001001110101101010011111101111000111110101010100000001111011011001111011111110110100100100010101101001110000101011111010010001100110010000"; vector<int> paint(int n) { vector<int> labels(n + 1, 1); for (int i = 0; i < n; i++) labels[i] = S[i] - '0'; labels[n] = 10; return labels; } int find_location(int n, vector<int> c) { int r = c.size(); if (c[r-1] == -1){ int answer = n; for (int i = 0; i < r; i++) if (c[i] >= 0) answer -= 1; return answer; } string t; for (auto x: c) t += x + '0'; for (int i = 0; i <= n-r; i++) if (S.substr(i, r) == t) return i; return -1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...