#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 = 23; //25 daje 58.75
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(N);
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 <= N; 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;
}
return 0;
}
# | 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... |