#include "squares.h"
#include <bits/stdc++.h>
using namespace std;
int N;
vector <int> odp;
vector <int> pusty;
void dodaj_do_odpowiedzi(int ile, int co) {
    while (ile-- && odp.size() < N) odp.push_back(co);
}
vector<int> paint(int n) {
	odp = pusty;
	N = n;
	for (int i = 1; i <= 29; i++) {
        dodaj_do_odpowiedzi(i, 1);
        dodaj_do_odpowiedzi(35 - i, 0);
	}
	odp.push_back(70);
	return odp;
}
int lokalizacja;
void jest_pod_koniec() {
    int ostatni = odp.size() - 1;
    while (odp[ostatni] == -1) ostatni--;
    lokalizacja = N - ostatni - 1;
}
int pierwsza_jedynka() {
    int wsk = 0;
    while (odp[wsk] == 1) wsk++;
    while (odp[wsk] == 0) wsk++;
    return wsk;
}
int ile_jedynek(int indeks) {
    int zlicz = 0;
    while (odp[indeks] == 1) {
        indeks++; zlicz++;
    }
    return zlicz;
}
int ktory_indeks_w_prawdziwym(int ile) {
    return (ile - 1) * 35;
}
int find_location(int n, std::vector<int> c) {
    N = n;
    odp = c;
	if (odp.back() == -1) {
        jest_pod_koniec();
        return lokalizacja;
	}
	int indeks = pierwsza_jedynka();
	int ile = ile_jedynek(indeks);
	int ktory = ktory_indeks_w_prawdziwym(ile);
    return ktory - indeks;
}
| # | 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... |