| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1197503 | abdelhakim | Paint By Numbers (IOI16_paint) | C++20 | 0 ms | 328 KiB |
#include "paint.h"
#include<bits/stdc++.h>
#include <cstdlib>
#define ll long long
#define dbg(x) cerr<<#x << ' ' << x << endl;
using namespace std;
void hrrk(string& cur, ll& j)
{
string news(cur.size(),'_');
for (int i=1;i<cur.size();i++)
{
news[i]=cur[i-1];
}
j++;
cur=news;
}
bool check(string& meow, string& haw)
{
for (int i=0;i<meow.length();i++)
{
if((haw[i]=='_' && meow[i]=='X')|| (meow[i]=='_' && haw[i]=='X'))return false;
}
return true;
}
string st = "check";
std::string solve_puzzle(std::string s, std::vector<int> c) {
ll n=s.size();
vector<pair<ll,ll>> hm9(n);
string cur(n,'_');
ll j=0;
for (int i=0;i<c.size();i++)
{
for (int k=0;k<c[i];k++)
{
cur[j]='X';
j++;
}
j++;
}
j--;
j--;
while(j<n)
{
bool ch = check(cur,s);
if(ch)
{
for (int i=0;i<n;i++)
{
if(cur[i]=='X')
{
hm9[i].second=1;
}
else
{
hm9[i].first=1;
}
}
}
hrrk(cur,j);
}
string ans(n,'?');
for (int i = 0;i<n;i++)
{
if(hm9[i].first && !hm9[i].second)
{
ans[i]='_';
}
else if(hm9[i].second && !hm9[i].first)
{
ans[i]='X';
}
}
return ans;
}
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... | ||||
