제출 #1065690

#제출 시각아이디문제언어결과실행 시간메모리
1065690sunboiPaint By Numbers (IOI16_paint)C++17
7 / 100
1 ms444 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; suf -= c[i] + 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] = '?'; } 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...