답안 #626170

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
626170 2022-08-11T09:21:31 Z zaneyu Data Transfer (IOI19_transfer) C++14
100 / 100
121 ms 2504 KB
#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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 640 KB Output is correct
2 Correct 5 ms 724 KB Output is correct
3 Correct 4 ms 652 KB Output is correct
4 Correct 4 ms 644 KB Output is correct
5 Correct 4 ms 648 KB Output is correct
6 Correct 4 ms 732 KB Output is correct
7 Correct 4 ms 652 KB Output is correct
8 Correct 4 ms 640 KB Output is correct
9 Correct 4 ms 652 KB Output is correct
10 Correct 4 ms 740 KB Output is correct
11 Correct 4 ms 652 KB Output is correct
12 Correct 4 ms 652 KB Output is correct
13 Correct 3 ms 732 KB Output is correct
14 Correct 4 ms 652 KB Output is correct
15 Correct 4 ms 644 KB Output is correct
16 Correct 4 ms 772 KB Output is correct
17 Correct 3 ms 652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 106 ms 2496 KB Output is correct
2 Correct 102 ms 2488 KB Output is correct
3 Correct 104 ms 2504 KB Output is correct
4 Correct 118 ms 2500 KB Output is correct
5 Correct 121 ms 2500 KB Output is correct
6 Correct 113 ms 2504 KB Output is correct
7 Correct 109 ms 2500 KB Output is correct
8 Correct 112 ms 2500 KB Output is correct
9 Correct 109 ms 2500 KB Output is correct
10 Correct 101 ms 2500 KB Output is correct
11 Correct 99 ms 2500 KB Output is correct
12 Correct 105 ms 2488 KB Output is correct
13 Correct 108 ms 2504 KB Output is correct
14 Correct 106 ms 2500 KB Output is correct
15 Correct 105 ms 2504 KB Output is correct
16 Correct 104 ms 2488 KB Output is correct
17 Correct 107 ms 2492 KB Output is correct
18 Correct 112 ms 2488 KB Output is correct
19 Correct 104 ms 2504 KB Output is correct