Submission #92240

#TimeUsernameProblemLanguageResultExecution timeMemory
92240turbatPaint By Numbers (IOI16_paint)C++14
0 / 100
2 ms376 KiB
#include "paint.h" #include <bits/stdc++.h> using namespace std; #define N 200005 int cnt[N], n, t, ok, now; string st, st1, ans; string solve_puzzle(string s, vector<int> c) { n = s.size(); t = c.size(); now = 0; for (int i = 0;i < n;i++){ if (t == now || st.back() == 'X'){ st += '_'; continue; } ok = 0; for (int j = 0;j < c[now];j++) if (s[i + j] == '_') ok = 1; if (!ok) { int tmp = i + c[now++]; for (;i < tmp;i++) st += 'X'; i--; } else st = '_'; } reverse(s.begin(), s.end()); reverse(c.begin(), c.end()); now = 0; for (int i = 0;i < n;i++){ if (t == now || st1.back() == 'X'){ st1 += '_'; continue; } ok = 0; for (int j = 0;j < c[now];j++) if (s[i + j] == '_') ok = 1; if (!ok) { int tmp = i + c[now++]; for (;i < tmp;i++) st1 += 'X'; i--; } else st1 = '_'; } reverse(st1.begin(), st1.end()); for (int i = 0;i < n;i++) if (st[i] == st1[i]) ans += st[i]; else ans += '?'; 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...