Submission #626170

#TimeUsernameProblemLanguageResultExecution timeMemory
626170zaneyuData Transfer (IOI19_transfer)C++14
100 / 100
121 ms2504 KiB
#include "transfer.h" #include<bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; typedef tree<long long,null_type,less_equal<long long>,rb_tree_tag,tree_order_statistics_node_update> indexed_set; //order_of_key #of elements less than x // find_by_order kth element using ll=long double; using ld=long double; using pii=pair<ll,ll>; #define f first #define s second #define pb push_back #define REP(i,n) for(int i=0;i<n;i++) #define REP1(i,n) for(int i=1;i<=n;i++) #define FILL(n,x) memset(n,x,sizeof(n)) #define ALL(_a) _a.begin(),_a.end() #define sz(x) (int)x.size() #define SORT_UNIQUE(c) (sort(c.begin(),c.end()),c.resize(distance(c.begin(),unique(c.begin(),c.end())))) #define GET(v,x) lower_bound(ALL(v),x)-v.begin() const int maxn=5e5+5; const int INF=0x3f3f3f3f; int MOD=1e9+7; const ld PI=acos(-1.0l); const ld eps=1e-6; #define lowb(x) x&(-x) #define MNTO(x,y) x=min(x,(__typeof__(x))y) #define MXTO(x,y) x=max(x,(__typeof__(x))y) template<typename T1,typename T2> ostream& operator<<(ostream& out,pair<T1,T2> P){ out<<P.f<<' '<<P.s; return out; } template<typename T> ostream& operator<<(ostream& out,vector<T> V){ REP(i,sz(V)) out<<V[i]<<((i!=sz(V)-1)?" ":"\n"); return out; } std::vector<int> get_attachment(std::vector<int> v) { int n=sz(v); int len=__lg(n+1); int c=0; REP(i,n) if(v[i]) c^=(i+1); vector<int> vv; REP(i,len) vv.pb((bool)(c&(1<<i))); vv.pb(__builtin_popcount(c)%2); return vv; } std::vector<int> retrieve(std::vector<int> v) { int n=sz(v); int k=8; if(n==70) k=6; int c=0,cur=0; REP(i,k) c+=v[n-i-2],cur=cur*2+v[n-i-2]; vector<int> ans; if(c%2==v.back()){ REP(i,n-k-1) if(v[i]) cur^=(i+1); if(cur) v[cur-1]^=1; } REP(i,n-k-1) ans.pb(v[i]); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...