Submission #1017383

#TimeUsernameProblemLanguageResultExecution timeMemory
1017383MardonbekhazratovPaint By Numbers (IOI16_paint)C++17
32 / 100
1 ms440 KiB
#include "paint.h" #include <iostream> #include <vector> #include <set> using namespace std; int n,k; string solve_puzzle(string s, vector<int>c){ n=s.size(); k=c.size(); string ans=string(n,'?'); // cout<<ans; int sum=0; for(int x:c) sum+=x; // cout<<sum<<' '<<n<<' '; if(k+sum-1==n){ int j=0; for(int x:c){ for(int i=j;i<j+x;i++) ans[i]='X'; j+=x+1; if(j<=n) ans[j-1]='_'; } return ans; } vector<set<char>>a(n); int j=0; for(int x:c){ if(j>0) a[j-1].insert('_'); for(int i=j;i<j+x;i++) a[i].insert('X'); j+=x; // cout<<j<<' '; for(int i=j;i<j+n-sum-k+1;i++){ a[i-x].insert('_'); a[i].insert('_'),a[i].insert('X'); } j+=1; } for(int i=0;i<n;i++) if(a[i].size()==1) ans[i]=*a[i].begin(); 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...