제출 #425163

#제출 시각아이디문제언어결과실행 시간메모리
425163vanicPaint By Numbers (IOI16_paint)C++14
10 / 100
2086 ms300 KiB
#include "paint.h" #include <cstdlib> #include <cmath> #include <algorithm> #include <iostream> #include <vector> using namespace std; const int maxn=21; bool boja[maxn]; int n, k; vector < int > v; bool bijela[maxn]; bool crna[maxn]; void probaj(){ int br=0, pos=0; for(int i=0; i<n; i++){ if(boja[i]){ br++; } else{ if(br){ if(pos<k && v[pos]==br){ pos++; } else{ return; } br=0; } } } if(br){ if(pos<k && v[pos]==br){ pos++; } else{ return; } } if(pos!=k){ return; } for(int i=0; i<n; i++){ // cout << boja[i]; if(boja[i]){ crna[i]=1; } else{ bijela[i]=1; } } // cout << endl; } void rek(int x){ if(x==n){ probaj(); return; } boja[x]=1; rek(x+1); boja[x]=0; rek(x+1); } string solve_puzzle(string s, vector < int > c){ n=s.size(); k=c.size(); v=c; rek(0); string sol; for(int i=0; i<n; i++){ if(bijela[i] && crna[i]){ sol.push_back('?'); } else if(bijela[i]){ sol.push_back('_'); } else{ sol.push_back('X'); } } return sol; }
#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...