제출 #599695

#제출 시각아이디문제언어결과실행 시간메모리
599695promaPaint By Numbers (IOI16_paint)C++17
59 / 100
1 ms312 KiB
#include "paint.h" #include <bits/stdc++.h> using namespace std; string solve_puzzle(string s, vector<int> c) { int n = c.size(); int m = s.size(); vector <int> beg(n+1); int cnt = 0, pos = 0; for (int i = 0; i < m and pos < n; i ++) { if (s[i] == '.') cnt ++; else cnt = 0; if (cnt == c[pos]) { beg[pos ++] = i - cnt + 1; cnt = 0; i ++; } } string res = s; beg[n] = m + 1; for (int i = n - 1; i >= 0; i --) { int last = beg[i]; for (int j = beg[i] + 1; j + c[i] < beg[i+1]; j ++) { int flag = 0; for (int k = j; k < j + c[i]; k ++) { if (s[k] == '_') flag = 1; } if (!flag) { for (int k = last; k < min(last + c[i], j); k ++) { res[k] = '?'; } last = j; } } for (int j = last; j < last + c[i]; j ++) { res[j] = '?'; } if (last < beg[i] + c[i]) { for (int j = last; j < beg[i] + c[i]; j ++) { res[j] = 'X'; } } beg[i] = last; } for (int i = 0; i < m; 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...