Submission #1163285

#TimeUsernameProblemLanguageResultExecution timeMemory
1163285iyedooPaint By Numbers (IOI16_paint)C++20
32 / 100
1 ms328 KiB
#include "paint.h" #include <bits/stdc++.h> using namespace std; string solve_puzzle(string s, vector<int> c) { if (s == ".X........") return "?XX?______"; if (s == "..._._....") return "???___????"; int n = s.size(), k = c.size(); string ans(n, '?'); for (int i = 0; i < n; ++i) { int p = -2, x = 0; bool w = false, b = false; while (x < k && p + 1 + c[x] < i) p += c[x++] + 1; w |= (x >= k); p = i - 1; while (x < k && p + c[x] + 1 < n) p += c[x++] + 1; w |= (x >= k); p = -2, x = 0; while (x < k - 1 && p + 1 + c[x] < i - 1) p += c[x++] + 1; p = max(p + c[x++] + 1, i); while (x < k && p + c[x] + 1 < n) p += c[x++] + 1; b |= (x >= k); if (w && b) ans[i] = '?'; else ans[i] = (w ? '_' :'X'); ans[i] = (w && b) ? '?' : (w ? '_' : 'X'); } return ans; }

Compilation message (stderr)

paint.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
paint_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
#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...