This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define ll int
#define ld long double
#define fs first
#define sc second
using namespace std;
typedef pair<ll,ll> LL;
const ll N = 2e3 + 9;
const ll mod = 1e9 + 7;
vector<ll> ans;
void Init(){
ll was[N],cur = 0;
was[0] = 1; ans.clear(); memset(was,0,sizeof(was));
for (ll i = 1;i <= 10;i++) ans.push_back(0);
while(ans.size() < 1000){
cur &= ((1 << 9) - 1);
if (!was[cur*2]) cur *= 2,ans.push_back(0);
else cur = cur * 2 + 1,ans.push_back(1);
was[cur] = 1;
}
}
vector<ll> paint(ll n){
if (!ans.size()) Init();
vector<ll> v(n + 1); v[n] = 10;
for (ll i = 0;i < n;i++) v[i] = ans[i];
return v;
}
ll find_location(ll n,vector<ll> c){
if (!ans.size()) Init();
for (ll i = 0;i < n;i++){
vector<ll> now;
for (ll j = 0;j < 10;j++){
if (i + j >= n) now.push_back(-1);
else now.push_back(ans[j + i]);
}
if (now == c) return i;
}
}
/*
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
#define task "tst"
if (fopen(task".INP","r")){
freopen(task".INP","r",stdin);
//freopen(task".OUT","w",stdout);
}
ll len; cin>>len; paint(len); /// 00000000001000000001
for (auto i : ans) cout<<i;
}
*/
Compilation message (stderr)
squares.cpp:2: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
2 | #pragma GCC optimization ("O3")
|
squares.cpp:3: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
3 | #pragma GCC optimization ("unroll-loops")
|
squares.cpp: In function 'int find_location(int, std::vector<int>)':
squares.cpp:46:1: warning: control reaches end of non-void function [-Wreturn-type]
46 | }
| ^
# | 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... |