Submission #435821

#TimeUsernameProblemLanguageResultExecution timeMemory
435821zxcvbnmPaint By Numbers (IOI16_paint)C++14
7 / 100
1 ms204 KiB
#include "paint.h" #include <bits/stdc++.h> using namespace std; using ll = long long; /* ................ 4 3 2 3 4 */ std::string solve_puzzle(std::string str, std::vector<int> c) { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n = str.length(), k = c.size(); string orig; for(int i = 0; i < k; i++) { for(int j = 0; j < c[i]; j++) { orig += 'X'; } if (i != k-1) { orig += '_'; } } vector<int> pref(k+1, 0); for(int i = 1; i <= k; i++) { pref[i] += pref[i-1]; pref[i] += c[i-1]; // cout << pref[i] << "\n"; } string ans; for(int i = 0; i < n; i++) { bool ok = false; for(int j = 0; j <= k; j++) { // cout << i << " " << j << " " << pref[j]+(j-1) << " " << (pref[k] - pref[j]) + (k-j) << "\n"; if (i >= pref[j]+(j-1) && (n-i-1) >= (pref[k] - pref[j]) + (k-j-1)) { ans += '?'; ok = true; break; } } if (!ok) { ans += orig[i]; } } return ans; }
#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...