| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 382144 | Iwanttobreakfree | Painting Squares (IOI20_squares) | C++17 | 252 ms | 468 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 "squares.h"
#include <vector>
using namespace std;
vector<int> paint(int n) {
	vector<int> labels;
	vector<int> potencias(10);
	potencias[9]=1;
	for(int i=8;i>=0;i--)potencias[i]=potencias[i+1]*2;
	int num=1;
	int x=1;
	int cont=0;
	while(labels.size()!=n){
		if(num>=potencias[cont]){
			num-=potencias[cont];
			labels.push_back(1);
		}
		else{
			labels.push_back(0);
		}
		cont++;
		if(cont==10){
			x+=2;
			num=x;
			cont=0;
		}
	}
	labels.push_back(18);
	return labels;
}
 
int find_location(int n, vector<int> c) {
	bool posi;
	int k=c.size();
	vector<int> guardado=paint(n);
	for(int i=0;i<n;i++){
		posi=true;
		for(int j=0;j<k;j++){
			if(c[j]==-1)return n-j;
			if(guardado[i+j]!=c[j]){
				posi=false;
				break;
			}
		}
		if(posi)return i;
	}
	return 0;
}
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... | ||||
