제출 #435824

#제출 시각아이디문제언어결과실행 시간메모리
435824zxcvbnmPaint By Numbers (IOI16_paint)C++14
32 / 100
1 ms332 KiB
#include "paint.h" #include <bits/stdc++.h> using namespace std; using ll = long long; /* .... 2 9 3 */ std::string solve_puzzle(std::string str, std::vector<int> c) { ios_base::sync_with_stdio(false); cin.tie(nullptr); // str = string(20, '.'); 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"; int diff = (i - (pref[j]+(j-1))) + (n-i-1) - ((pref[k]-pref[j])+(k-j-1)); if (i >= pref[j]+(j-1) && (n-i-1) >= (pref[k] - pref[j]) + (k-j-1) && diff > 0) { 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...