제출 #1182213

#제출 시각아이디문제언어결과실행 시간메모리
1182213kl0989eFlight to the Ford (BOI22_communication)C++20
0 / 100
6 ms2792 KiB
#include <bits/stdc++.h> #include"communication.h" using namespace std; #pragma GCC optimize("Ofast") #define ll long long #define fi first #define se second #define pb push_back #define vi vector<int> #define vl vector<ll> #define pi pair<int, int> #define pl pair<ll,ll> #define all(x) (x).begin(),(x).end() vi nums={0,6,9,15}; pi get(int a) { pi ret={-1,-1}; for (int i=0; i<4; i++) { if (__builtin_popcount(a^nums[i])<=2) { if (ret.fi==-1) { ret.fi=i; } else { ret.se=i; } } } return ret; } void s(int i) { if (i==0) { send(0);send(0);send(0);send(0); } else if (i==1) { send(0);send(1);send(1);send(0); } else if (i==2) { send(1);send(0);send(0);send(1); } else { send(1);send(1);send(1);send(1); } } int rec() { int ret=0; for (int i=0; i<4; i++) { ret=(ret<<1)+receive(); } return ret; } void encode(int n, int x) { s(x); } pi decode(int n) { return get(rec()); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...