Submission #1065702

#TimeUsernameProblemLanguageResultExecution timeMemory
1065702sunboiPaint By Numbers (IOI16_paint)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> #include "paint.h" using namespace std; string solve_puzzle(string s, vector<int> c){ int n = s.size(); int k = c.size(); int suf = -(c[0] + 1); int pref = 0; set<pair<int, int>> black; for (int x : c){ suf += x + 1; } for (int i = 0; i < k; i++){ //cout << "intervalo::::" << pref << ' ' << suf << endl; int r = min(pref + c[i] - 1, n - suf - 1); int l = max(pref, n - suf - c[i]); //cout << l << ' ' << r << endl; if (r >= l) black.insert({l, r}); pref += c[i] + 1; if (i < k - 1) suf -= c[i + 1] + 1; } for (pair<int, int> x : black){ //cout << x.first << ' ' << x.second << endl; for (int i = x.first; i <= x.second; i++) s[i] = 'X'; } for (int i = 0; i< n; i++){ if (s[i] == '.') s[i] = '?'; if (i > 0 && i < n - 1){ if (s[i - 1] == 'X' && s[i + 1] == 'X') s[i] = '_'; } } return s; }
#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...