Submission #568009

#TimeUsernameProblemLanguageResultExecution timeMemory
568009uroskPaint By Numbers (IOI16_paint)C++14
32 / 100
1 ms324 KiB
#include "paint.h" #define here cerr<<"===========================================\n" #include <bits/stdc++.h> #define ld double #define ll int #define ull unsigned long long #define llinf 100000000000000000LL // 10^17 #define iinf 2000000000 // 2*10^9 #define pb push_back #define popb pop_back #define fi first #define sc second #define endl '\n' #define pii pair<int,int> #define pll pair<ll,ll> #define pld pair<ld,ld> #define sz(a) int(a.size()) #define all(a) a.begin(),a.end() #define ceri(a,l,r) {for(ll i_ = l;i_<=r;i_++) cerr<<a[i_]<< " ";cerr<<endl;} using namespace std; #define maxn 100005 ll n,k; ll a[maxn]; ll p[maxn]; bool w[maxn]; bool b[maxn]; string solve_puzzle(string s,vector<int> c) { n = sz(s); k = sz(c); for(ll i = 1;i<=k;i++) a[i] = c[i-1]; for(ll i = 1;i<=n;i++) p[i] = a[i] + p[i-1]; for(ll i = 1;i<=n;i++){ for(ll j = 0;j<=k;j++){ ll lenl = p[j]+(j-1); ll lenr = p[k] - p[j]+(k-j-1); if(lenl<=i-1&&lenr<=n-i) w[i] = 1; } } for(ll i = 1;i<=n;i++){ for(ll j = 1;j<=k;j++){ ll len = a[j]; ll lenl = p[j-1] + (j-1); ll lenr = p[k] - p[j] + (k-j); for(ll e = 1;e<=n;e++){ if(i<=e+len-1&&i>=e){ if(lenl<=e-1&&lenr<=n-e-len+1) b[i] = 1; } } } } string ans; for(ll i = 1;i<=n;i++){ if(w[i]&&b[i]) ans.pb('?'); else if(w[i]) ans.pb('_'); else ans.pb('X'); } return ans; } /* ........ 2 3 4 */
#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...