제출 #1043075

#제출 시각아이디문제언어결과실행 시간메모리
1043075XJP12Paint By Numbers (IOI16_paint)C++14
10 / 100
2096 ms416 KiB
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; vi v; vi d; int n,k; void solve(int u, int o, int j, int sum){ int u1=u; if(sum>n) return; for(int i=u1; i<u1+o; i++){ if(u>=n) return; if(v[i]==2){ v[i]=3; }else{ if(v[i]!=3) v[i]=1; } u++; } if(u>=n) return; u1=u; for(int i=u1; i<u1+d[j]; i++){ //cout<<u<<" "<<d[j]<<endl; if(u>=n) return; if(v[i]==1){ v[i]=3; }else{ if(v[i]!=3) v[i]=2; } u++; } j++; if(j>=k){ for(int i=u1+d[j-1]; i<n; i++){ if(v[i]==2){ v[i]=3; }else{ if(v[i]!=3) v[i]=1; } } } for(int i=1; i<n; i++){ /* for(int i=0; i<n; i++){ cout<<v[i]<<" "; } cout<<endl;*/ solve(u,i,j,sum+i-1); } } string solve_puzzle(string s, vi c) { k = (int)c.size(); n = (int)s.size(); v.resize(n,0); int sum=0; d=c; for(int i=0; i<k; i++){ sum+=c[i]+1; } sum--; for(int i=0; i<n; i++){ /* for(int i=0; i<n; i++){ cout<<v[i]<<" "; }*/ //cout<<endl; solve(0,i,0,sum+i); } string ans; for(int i=0; i<n; i++){ if(v[i]==1){ ans+='_'; } if(v[i]==2){ ans+='X'; } if(v[i]==3){ ans+='?'; } } return ans; }
#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...