Submission #67438

#TimeUsernameProblemLanguageResultExecution timeMemory
67438mirbek01Paint By Numbers (IOI16_paint)C++17
Compilation error
0 ms0 KiB
#include "paint.h" #include "grader.cpp" #include <bits/stdc++.h> using namespace std; int n, k; string solve_puzzle(string s, vector<int> c) { n = (int)(s.size()); k = (int)(c.size()); string ans, t; int sum = 0; for(int i = 0; i < k; i ++) sum += c[i]; sum += max(0, k - 1); if(sum == n){ for(int i = 0; i < k; i ++){ for(int j = 0; j < c[i]; j ++){ ans += 'X'; } if(i != k - 1){ ans += '_'; } } } else { vector <int> v; int pos = 0; for(int i = 0; i < k; i ++){ for(int j = 0; j < n; j ++){ bool fl = 1; for(int w = pos + j, cn = 0; cn < c[i]; w ++, cn ++){ if(s[w] != '.') { fl = 0; break; } } if(fl){ v.push_back(pos + j); pos = pos + j + c[i] + 1; break; } } } ans = s; t = s; for(int i = k - 1; i >= 0; i --){ int mx = 0, all = 0; int cnt[n]; memset(cnt, 0, sizeof(cnt)); for(int j = v[i]; j + c[i] - 1 < n; j ++){ bool fl = 1; for(int w = j, cn = 0; cn < c[i]; w ++, cn ++){ if(t[w] != '.'){ fl = 0; break; } if(cn == c[i] - 1){ if(w + 1 < n && t[w + 1] == 'X') fl = 0; } } if(fl){ all ++; for(int w = j, cn = 0; cn < c[i]; w ++, cn ++){ cnt[w] ++; } mx = j; } } for(int j = v[i]; j < mx + c[i]; j ++){ if(cnt[j] == all){ ans[j] = 'X'; } else if(cnt[j]) ans[j] = '?'; else ans[j] = '_'; } for(int j = mx; j < n; j ++){ t[j] = 'X'; } } } for(int i = 0; i < n; i ++){ if(ans[i] == '.') ans[i] = '_'; } return ans; }

Compilation message (stderr)

/tmp/cc9IA29M.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccjmCCm8.o:paint.cpp:(.text.startup+0x0): first defined here
/tmp/cc9IA29M.o:(.bss+0x0): multiple definition of `buf'
/tmp/ccjmCCm8.o:(.bss+0x20): first defined here
collect2: error: ld returned 1 exit status