Submission #425618

#TimeUsernameProblemLanguageResultExecution timeMemory
425618ngracePaint By Numbers (IOI16_paint)C++14
32 / 100
1 ms280 KiB
#include "paint.h" #include <vector> #include <iostream> #include <utility> #include <cstdlib> using namespace std; #define v vector #define pii pair<int,int> #define fi first #define se second std::string solve_puzzle(std::string s, std::vector<int> c) { int n=s.size(); int k=c.size(); string out; //assume all . for(int i=0;i<n;i++){ bool isWhite=false; bool isBlack=false; int l=0; int cInd=0; while(l<n){ if(l>i){ l+=c[cInd]; cInd++; if(cInd==k && l<=n) { isWhite=true; break; } l++; } else if(i-l>=c[cInd]){ l+=c[cInd]; cInd++; if(cInd==k) { isWhite=true; break; } l++; } else{ l=i+1; } } l=0; cInd=0; while(l<n){ if(l>i){ l+=c[cInd]; cInd++; if(cInd==k && l<=n) { isBlack=true; break; } l++; } else if(i-l>c[cInd] && cInd!=k-1){ l+=c[cInd]; cInd++; l++; } else{ l=max(l,i-c[cInd]+1); l+=c[cInd]; cInd++; if(cInd==k && l<=n) { isBlack=true; break; } l++; } } if(isWhite&&isBlack) out.push_back('?'); else if(isWhite) out.push_back('_'); else out.push_back('X'); } return out; }
#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...