Submission #428014

#TimeUsernameProblemLanguageResultExecution timeMemory
428014AzimjonPaint By Numbers (IOI16_paint)C++17
0 / 100
1 ms296 KiB
#include "paint.h" #include <bits/stdc++.h> using namespace std; string solve(string s, vector<int> c, vector<int> &bid) { int lst = 0; for (int k = 0; k < (int)c.size(); k++) { bool flag; int x = c[k]; do { flag = true; for (int i = lst; i < lst + x; i++) { // cerr << i << " " << endl; flag &= (s[i] == '.'); } if (flag) { for (int i = lst; i < lst + x; i++) { s[i] = 'X'; bid[i] = k; } lst += x; } else { lst++; } } while (!flag); lst++; } return s; } std::string solve_puzzle(std::string s, std::vector<int> c) { string a, b; vector<int> aa, bb; aa = bb = vector<int>(s.size(), -1); reverse(s.begin(), s.end()); reverse(c.begin(), c.end()); a = solve(s, c, aa); reverse(a.begin(), a.end()); reverse(aa.begin(), aa.end()); for (int &i : aa) { i = c.size() - i - 1; } reverse(s.begin(), s.end()); reverse(c.begin(), c.end()); b = solve(s, c, bb); // cerr << a << endl; // cerr << b << endl; for (int i = 0; i < (int)s.size(); i++) { if (a[i] == 'X' && b[i] == 'X' && aa[i] == bb[i]) { s[i] = 'X'; } else if (a[i] == 'X' || b[i] == '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...