Submission #707656

#TimeUsernameProblemLanguageResultExecution timeMemory
707656benjaminkleynPaint By Numbers (IOI16_paint)C++17
32 / 100
1 ms308 KiB
#include <bits/stdc++.h> using namespace std; #include "paint.h" string solve_puzzle(string s, vector<int> c) { int n = s.size(), k = c.size(); string res(n, '?'); int sum_l = 0, sum_r = 0; for (int i = 0; i < k; i++) sum_r += c[i]; for (int i = 0; i < k; i++) { sum_r -= c[i]; int L_dist = sum_l + i; int R_dist = sum_r + k - 1 - i; if (L_dist + R_dist >= n) continue; for (int j = n - R_dist - c[i]; j < L_dist + c[i]; j++) res[j] = 'X'; sum_l += c[i]; } if (sum_l + k - 1 == n) { for (int i = 0; i < n; i++) if (res[i] == '?') res[i] = '_'; } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...