#include <bits/stdc++.h>
#include "communication.h"
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef vector<P> vp;
typedef vector<vp> vvp;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define REP(i,k,n) for(ll i=(ll)(k);i<(ll)(n);i++)
#define all(a) a.begin(),a.end()
#define fi first
#define se second
#define pb emplace_back
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> void outvv(T v){for(auto x:v)outv(x);}
template<class T> void outvp(T v){rep(i,v.size()){cout<<'('<<v[i].fi<<','<<v[i].se<<')';}cout<<endl;}
template<class T> void outvvp(T v){for(auto x:v)outvp(x);}
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
void encode(int N,int X){
vi v={1,0,0,0,0,1,1,0,0,0,1,1,0,1,0,0,0,0,1,0,1,1,0,0,0,0,0,1,1,1,0,0,1,1,1,1,1,0,1,1,1,1,0,0,0,0,1,1,1,1,1,0,1,0,0,0,0,1,0,1,1,0,1,1,1,0,0,0,1,0,1,0,0,0,0,1,0,1,1,0,1,0,1,1,0,0,1,0,0,1,0,1,0,1,0,1,1,0,1,0,0,0,0,1,0,0,1,0,1,0,0,0,1,1,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,1,0,0,1,0,1,0,0,0,0,0,0,1,1,1,0,0,1,1,0,0,0,1,0,0,0,0,1,0,0,1,0,1,1,0,1,0,1,0,0,0,0,0,1,1,0,0,0,0,0,1,1,1,0,1,0,1,1,1,1,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,1,0,1,0,0,0,1,1,0,0,1,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,1,1};
vi v2={1,0,1,0,0,1,1,0,1,1,0,1,1,1,0,1,1,1,1,0,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,1,1,0,1,1,0,0,0,0,1,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,0,1,1,0,1,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,1,0,1,1,0,0,1,0,0,0,1,0,0,0,1,1,0,0,1,1,1,1,0,0,0,0,0,1,0,0,1,0,0,1,0,1,1,1,1,1,0,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,1,1,0,1,1,0,1,1,0,0,1,0,1,1,1,1,1,0,1,0,0,1,1,0,1,0,0,1,0,1,0,1,0,0,0,1,1,1,1,1,1,0,1,1,1,1,0,1,0,1,0,0,0,1,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,0,0,1,1,0,0,0,0,1,0,1,1,0,1,1,1,0,0,1,1,1,0,0,1,0,0,1,0,0,1,0,1,0,1,0,1,1,1,1,0,0,0,0,1,0,0,1,1,0,1,0,1,1,0,1,1,0,1,1,1,1,1,1,0,1,1};
ll cnt=0;
rep(i,30){
int d=X>>i&1;
while(true){
if(v[cnt]==1){
if(send(v2[cnt])==v2[cnt]){
cnt++;
continue;
}
else{
send(d);
cnt++;
break;
}
}
else{
if(send(d)==d){
if(send(v2[cnt])==v2[cnt]){
cnt++;
break;
}
else{
cnt++;continue;
}
}
else{
send(1-v2[cnt]);
cnt++;continue;
}
}
}
}
}
pair<int,int> decode(int N){
vi v={1,0,0,0,0,1,1,0,0,0,1,1,0,1,0,0,0,0,1,0,1,1,0,0,0,0,0,1,1,1,0,0,1,1,1,1,1,0,1,1,1,1,0,0,0,0,1,1,1,1,1,0,1,0,0,0,0,1,0,1,1,0,1,1,1,0,0,0,1,0,1,0,0,0,0,1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,1,1,0,1,1,0,1,1,1,1,1,1,0,1,1};
ll cnt=0;
int res=0;
rep(i,30){
while(true){
if(v[cnt]==1){
if(receive()==v2[cnt]){
cnt++;continue;
}
else{
res+=receive()<<i;
cnt++;break;
}
}
else{
int tmp=receive();
if(receive()==v2[cnt]){
res+=tmp<<i;
cnt++;break;
}
else{
cnt++;continue;
}
}
}
}
return make_pair(res,res);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
152 ms |
1680 KB |
Output is correct |
2 |
Correct |
222 ms |
1724 KB |
Output is correct |
3 |
Correct |
251 ms |
1676 KB |
Output is correct |
4 |
Correct |
137 ms |
1664 KB |
Output is correct |
5 |
Incorrect |
35 ms |
288 KB |
Not correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1053 ms |
1668 KB |
Output is partially correct |
2 |
Incorrect |
114 ms |
200 KB |
Not correct |
3 |
Halted |
0 ms |
0 KB |
- |