# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
372497 | cpp219 | Painting Squares (IOI20_squares) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
ll was[N],cur = 0;
void Init(ll n){
was[0] = 1; ans.clear();
for (ll i = 1;i <= 10;i++) ans.push_back(0);
for (ll i = 11;i <= n;i++){
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;
}
while(ans.size() > n) ans.pop_back();
return ans;
}
vector<ll> paint(ll n){
if (!ans.size()) Init(n);
vector<ll> v;
for (auto i : ans) v.push_back(i); v.push_back(10);
return v;
}
ll find_location(ll n,vector<ll> c){
if (!ans.size()) Init(n);
ll cnt = 0;
for (auto i : c) if (i >= 0) cnt++;
if (cnt != n) return n - cnt;
for (ll i = 0;i < n - 9;i++){
vector<ll> now;
for (ll j = i;j <= i + 9;j++) now.push_back(ans[j]);
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;
}
*/