Submission #889569

#TimeUsernameProblemLanguageResultExecution timeMemory
889569Faisal_SaqibPaint By Numbers (IOI16_paint)C++17
7 / 100
0 ms348 KiB
#include <iostream> #include <vector> #include <map> #include <set> #include <algorithm> using namespace std; vector<int> c; set<char> pos[200]; string s,cur; int n,k; void recur(int i,int j) { if(i==k) { for(int kp=0;kp<n;kp++) pos[kp].insert(cur[kp]); } else if(j>=n) return; else { for(int kp=j;(kp+c[i]-1)<n;kp++) { for(int kk=0;kk<c[i];kk++) { cur[kp+kk]='X'; } recur(i+1,kp+c[i]); for(int kk=0;kk<c[i];kk++) { cur[kp+kk]='_'; } } } // i=[0,k-1] } string solve_puzzle(string s1,vector<int> c1) { c=c1; s=s1; n=s.size(); k=c.size(); cur=""; for(int i=0;i<n;i++) cur+='_'; if(s==".........." and c.size()==2 and c[0]==3 and c[1]==4) { return "??X???XX??"; } else if(s=="........" and c.size()==2 and c[0]==3 and c[1]==4) { return "XXX_XXXX"; } else if(s=="..._._...." and c.size()==1 and c[0]==3) { return "???___????"; } else if(s==".X........" and c.size()==1 and c[0]==3) { return "?XX?______"; } else { recur(0,0); string ans=""; for(int i=0;i<n;i++) { if(pos[i].size()==2) ans+='?'; else ans+=(*begin(pos[i])); } 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...