Submission #610964

#TimeUsernameProblemLanguageResultExecution timeMemory
610964strange420Paint By Numbers (IOI16_paint)C++14
7 / 100
1 ms212 KiB
#include "paint.h" #include <bits/stdc++.h> #include <cstdlib> using namespace std; bool isEmpty(string s) { for (char x: s) if (x != '.') return false; return true; } std::string solve_puzzle(std::string s, std::vector<int> c) { string ans; int n = s.size(), k = c.size(); for (int i=0; i<n; i++) ans += '?'; if (k == 1) { k = c[0]; for (int i=0; i<2*k-n; i++) ans[i+n-k] = 'X'; return ans; } else if (isEmpty(s)) { int totalSpace = k-1; for (int x: c) totalSpace += x; int gap = n - totalSpace, pt = 0; for (int i=0; i<k; i++) { // solve(start: pt, end: pt + gap + c_i (exclusive)) int tempN = gap + c[i]; for (int j=0; j<2*c[i]-tempN; j++) { ans[pt + j + tempN - c[i]] = 'X'; } pt += c[i] + 1; // size + gap } } 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...