제출 #592239

#제출 시각아이디문제언어결과실행 시간메모리
592239EliasPaint By Numbers (IOI16_paint)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int n, k; vector<bool> hi; vector<int> cl; unordered_map<int, bool> dp; vector<int> wh, bl; vector<int> numWhite; bool checkWhite(int l, int r) { int cnt = numWhite[r - 1]; if (l) cnt -= numWhite[l - 1]; return cnt; } bool DP(int i, int j) { if (i <= 0) return j == 0; if (dp.count(i + (j << 20))) return dp[i + (j << 20)]; bool b = false; if (j > 0) { int size = cl[j - 1]; if (i >= size && (i == size || !hi[i - size - 1]) && !checkWhite(i - size, i)) { if (DP(i - size - 1, j - 1)) { b = true; if (i != n) bl[i]--; bl[i - size]++; if (i - size > 0) wh[i - size - 1]++; } } } if (!hi[i - 1]) { if (DP(i - 1, j)) { b = true; wh[i - 1]++; } } return dp[i + (j << 20)] = b; } string solve_puzzle(string s, vector<int> c) { n = s.size(); k = c.size(); cl = c; hi = vector<bool>(n); numWhite = vector<int>(n); for (int i = 0; i < n; i++) { numWhite[i] += numWhite[max(i - 1, 0)]; if (s[i] == 'X') hi[i] = true; if (s[i] == '_') numWhite[i]++; } wh = bl = vector<int>(n); DP(n, k); int black = 0; string out; for (int i = 0; i < n; i++) { black += bl[i]; if (black && wh[i]) out.push_back('?'); else if (black) out.push_back('X'); else out.push_back('_'); } return out; } signed main() { cin.tie(0); ios_base::sync_with_stdio(false); int n, k; cin >> n >> k; string s; cin >> s; vector<int> blub(k); for (int &x : blub) cin >> x; cout << solve_puzzle(s, blub); }

컴파일 시 표준 에러 (stderr) 메시지

/usr/bin/ld: /tmp/ccARdWjG.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccMlqYrD.o:paint.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status