Submission #1169013

#TimeUsernameProblemLanguageResultExecution timeMemory
1169013mateuszwesPainting Squares (IOI20_squares)C++20
0 / 100
93 ms424 KiB
#include "squares.h"
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
#define ll long long
#define ull unsigned ll
#define pb push_back
#define pii pair<int,int>
#define pl pair<ll,ll>
#define F first
#define S second
#define pq priority_queue
#define all(x) x.begin(), x.end()
#define deb(x) cout << #x << " = " << x << '\n';
#define deb2(x,y) cout << #x << " = " << x << ", " << #y << " = " << y << '\n';

constexpr int N = 30;
vector<int> bob;
	
vector<int> dec(int ob){			//raczej git
	vector<int> sus;
	while(ob > 0){
		sus.pb(ob&1);
		ob >>= 1;
	}
	reverse(all(sus));
	return sus;
}

vector<int> topaint(int n){
	int ob = 0;
	int ind = 0;
	vector<int> sas;
	while(ind < n){
		vector<int> nu = dec(++ob);
		for(auto k: nu){
			sas.pb(k);
			++ind;
			if(ind >= n) return sas;
		}
		sas.pb(1);
		++ind;
		if(ind >= n) return sas;

		for(int i = 0; i < 9; i++){
			sas.pb(0);
			++ind;
			if(ind >= n) return sas;
		}
	}
	return sas;
}

vector<int> paint(int n) {
	vector<int> ok = topaint(n);
	ok.pb(30);
	return ok;
}

bool comp(int i, vector<int> c){
	//deb(c.size());
	for(int j = 0; j < c.size(); j++){
		if(bob[i+j] != c[j]) return 0;
	}
	return 1;
}

int find_location(int n, vector<int> c){
	//odtwarzamy malowanie
	
	/*
	vector<int> bbb = dec(19);
	for(auto k: bbb) cout << k << ' ';
	cout << '\n';
	*/

	bob = topaint(n);
	for(int i = 0; i <= 30; i++) bob.pb(-1);

	/*
	for(int i = 0; i < 30; i++) cout << bob[i] << ' ';
	cout << '\n';
	for(int i = 0; i < 30; i++) cout << c[i] << ' ';
	cout << "\n\n";
	*/

	for(int i = 0; i < n; i++){
		if(comp(i, c)) return i+1;
	}	
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...