제출 #819391

#제출 시각아이디문제언어결과실행 시간메모리
819391jlallas384Paint By Numbers (IOI16_paint)C++17
32 / 100
1 ms340 KiB
#include "paint.h" #include <bits/stdc++.h> using namespace std; std::string solve_puzzle(std::string s, std::vector<int> c) { int n = s.size(), k = c.size(); vector<int> ans(n); int sum = accumulate(c.begin(), c.end(), 0); if(sum + k - 1 == n){ string res; for(int i = 0; i < k; i++){ if(i) res += '_'; res += string(c[i], 'X'); } return res; }else{ string ans = string(n, 'X'); for(int i = 0; i < n; i++){ int has = 0; int gd = 1; int pre = 0; for(int j = 0; j < k; j++){ if(has + c[j] + (j != 0) <= i) has += c[j] + (j != 0), pre += c[j]; else{ if(i + sum - pre + (k - j) - 1 >= n) gd = 0; } } if(gd) ans[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...