#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,2){
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,2){
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 |
19 ms |
1852 KB |
Output is correct |
2 |
Correct |
22 ms |
1600 KB |
Output is correct |
3 |
Correct |
30 ms |
1664 KB |
Output is correct |
4 |
Correct |
27 ms |
1780 KB |
Output is correct |
5 |
Correct |
56 ms |
1672 KB |
Output is correct |
6 |
Incorrect |
3 ms |
200 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
26 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |