제출 #1297895

#제출 시각아이디문제언어결과실행 시간메모리
1297895bangchan메시지 (IOI24_message)C++20
0 / 100
3284 ms800 KiB
#include "message.h" #include <iostream> #include <vector> #include <map> #include <algorithm> #include <limits.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<bool> vb; typedef vector<double> vd; typedef vector<string> vs; typedef vector<char> vc; typedef vector<vi> vvi; typedef pair<int,int> pii; typedef vector<pii> vii; typedef map<int, int> mii; typedef vector<vl> vvl; typedef pair<ll, ll> pll; typedef vector<pll> vpl; #define F first #define S second #define yes cout << "YES" << endl #define no cout << "NO" << endl #define pb push_back #define forn(i, x, n) for (ll i = x; i < ll(n); i++) #define fornl(i, x, n) for(ll i = x; i >= ll(n); i--) #define all(x) x.begin(), x.end() #define mod 1000000007 #define inf 10000000000000 void send_message(const vector<bool> M, vector<bool> C) { vl idx; forn(i, 0, 31){ vb a(31, C[i]); send_packet(a); if(!C[i]) idx.pb(i); } vb b(31); forn(i, 0, 10){ if(M.size() - 1 & (1 << i)) b[idx[i]] = 1; } send_packet(b); for(ll i = 0; i < M.size(); i += 16){ vb v(31); forn(j, i, min(i + 15, ll(M.size() - 1) + 1)) v[idx[j - i]] = M[j]; send_packet(v); } } vector<bool> receive_message(vector<vector<bool>> R) { vb a; vl idx; forn(i, 0, R.size()){ ll qo = 0, qn = 0; forn(j, 0, 31){ if(R[i][j] == 0) qo++; else qn++; } if(qo > qn) a.pb(0); else a.pb(1); } ll x = 0; fornl(i, 9, 0) x = x * 2 + R[31][idx[i]]; forn(i, 32, R.size()){ forn(j, 0, min(ll(15), x)) a.pb(R[i][idx[j]]); x -= 16; } return a; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...