Submission #321515

#TimeUsernameProblemLanguageResultExecution timeMemory
321515KuuhakuPaint By Numbers (IOI16_paint)C++14
Compilation error
0 ms0 KiB
//Nov11-2020 #include <iostream> #include <stdio.h> #include <string> #include <vector> using namespace std; const int maxn=2e5+2; const int maxc=102; int n, k, type[maxc][maxn], demw[maxn], ch_b[maxn], ch_w[maxn]; string s; bool vs[maxc][maxn]; vector<int> c; void Enter() { cin>>s>>k; n=s.length(); c.push_back(0); for(int i=1;i<=k;i++) { int u;cin>>u; c.push_back(u); } s="."+s; for(int i=1;i<=n;i++) { demw[i]=demw[i-1]; if(s[i]=='_')demw[i]++; } int j=0; while(j<=n&&s[j]!='X') { type[0][j]=2; j++; } for(int i=1;i<=k;i++) for(int j=1;j<=n;j++) { bool add_b=(j>=c[i]&&type[i-1][j-c[i]]>1&&demw[j]==demw[j-c[i]]) ? 1 : 0; bool add_w=(type[i][j-1]>0&&s[j]!='X') ? 1 : 0; if(add_b&&!add_w)type[i][j]=1; if(!add_b&&add_w)type[i][j]=2; if(add_b&&add_w)type[i][j]=3; } } void Calc(int i,int j) { if(i<0||j<0)return; if(vs[i][j])return; vs[i][j]=true; if(type[i][j]==1||type[i][j]==3) { ch_b[j-c[i]+1]++; ch_b[j+1]--; ch_w[j-c[i]]++; Calc(i-1,j-c[i]-1); } if(type[i][j]==2||type[i][j]==3) { ch_w[j]++; Calc(i,j-1); } } string solve_puzzle(string s,vector<int> a) { Calc(k,n); int sum=0; string ans=""; for(int i=1;i<=n;i++) { sum+=ch_b[i]; if(sum>0&&ch_w[i]>0) ans+="?"; else { if(sum>0&&ch_w[i]==0) ans+="X"; else ans+="_"; } } return ans; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); Enter(); cout<<solve_puzzle(s,c); }

Compilation message (stderr)

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