Submission #966924

#TimeUsernameProblemLanguageResultExecution timeMemory
966924MarwenElarbiPaint By Numbers (IOI16_paint)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> //#include "paint.h" using namespace std; const int S_MAX_LEN = 200 * 1000; char buf[S_MAX_LEN + 1]; string solve_puzzle(std::string s, std::vector<int> c) { int n=s.size(); int m=c.size(); int beg[m]; int a=0; for (int i = 0; i < n; ++i) { s[i]='?'; } for (int i = 0; i < m; ++i) { beg[i]=a; a+=c[i]; a++; } a--; int dif=n-a; if(dif==0){ int lst=0; for (int i = 0; i < m; ++i) { for (int j = lst; j < lst+c[i]; ++j) { s[j]='X'; } lst+=c[i]; if(lst<n) s[lst]='_'; lst++; } return s; } for (int i = 0; i < m; ++i) { if(c[i]>=dif){ for (int j = beg[i]+dif; j < beg[i]+c[i]; ++j) { s[j]='X'; } } } return s; } /*int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif assert(1 == scanf("%s", buf)); std::string s = buf; int c_len; assert(1 == scanf("%d", &c_len)); std::vector<int> c(c_len); for (int i = 0; i < c_len; i++) { assert(1 == scanf("%d", &c[i])); } std::string ans = solve_puzzle(s, c); printf("%s\n", ans.data()); return 0; }*/

Compilation message (stderr)

/usr/bin/ld: /tmp/cc8LQgrL.o:(.bss+0x0): multiple definition of `buf'; /tmp/ccY79W9M.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status