# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
700867 | Doncho_Bonboncho | Paint By Numbers (IOI16_paint) | C++14 | 1 ms | 340 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "paint.h"
#include <bits/stdc++.h>
#include <cstdlib>
int pref[128];
std::string nas = "";
void f( int l, int r, int n ){
int size = r - l + 1;
// std::cerr<<" ! "<<size<<" "<<n<<"\n";
for( int i=0 ; i < size - n ; i++ ) nas[l+i] = nas[r-i] = '?';
}
std::string solve_puzzle(std::string s, std::vector<int> c) {
for( int i=0 ; i<s.size() ; i++ ) nas += 'X';
for( int i=0 ; i<c.size() ; i++ ) pref[i] = ( i ? pref[i-1] : 0 ) + c[i];
/*
std::cerr<<"\n";
for( int i=0 ; i<c.size() ; i++ ) std::cerr<<pref[i]<<"\n";
std::cerr<<"\n";
*/
for( int i=0 ; i <c.size() ; i++ ){
int l = ( i ? pref[i-1] + i : 0 );
int r = s.size() - ( pref[c.size()-1]-pref[i] + c.size() - i -1 )-1;
// std::cerr<<s.size()<<" - ( "<<pref[c.size()-1]<<" - "<<pref[i]<<" + "<<c.size()<<" - "<<i<<" - "<<1<<")\n";
// std::cerr<<l<<" "<<r<<" , "<<c[i]<<"\n";
f( l, r, c[i] );
}
return nas;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |