제출 #351545

#제출 시각아이디문제언어결과실행 시간메모리
351545talant117408앵무새 (IOI11_parrots)C++17
52 / 100
6 ms1508 KiB
#include "encoder.h" #include "encoderlib.h" #ifndef EVAL #include "grader.cpp" #endif #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair <int, int> pii; typedef pair <ll, ll> pll; #define precision(n) fixed << setprecision(n) #define pb push_back #define ub upper_bound #define lb lower_bound #define mp make_pair #define eps (double)1e-9 #define PI 2*acos(0.0) #define endl "\n" #define sz(v) int((v).size()) #define all(v) v.begin(),v.end() #define rall(v) v.rbegin(),v.rend() #define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define OK cout << "OK" << endl; void encode(int N, int M[]){ vector <pii> v; for(int i = 0; i < N; i++){ v.pb(mp(M[i], i)); } sort(all(v)); for(int i = 0; i < N; i++){ int num = v[i].first, ind = v[i].second; for(int bit = 4; bit < 8; bit++){ if(i&(1<<(bit-4))){ ind |= (1<<bit); } } send(num); send(num); send(ind); } }
#include "decoder.h" #include "decoderlib.h" #ifndef EVAL #include "grader.cpp" #endif #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair <int, int> pii; typedef pair <ll, ll> pll; #define precision(n) fixed << setprecision(n) #define pb push_back #define ub upper_bound #define lb lower_bound #define mp make_pair #define eps (double)1e-9 #define PI 2*acos(0.0) #define endl "\n" #define sz(v) int((v).size()) #define all(v) v.begin(),v.end() #define rall(v) v.rbegin(),v.rend() #define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define OK cout << "OK" << endl; void decode(int N, int L, int X[]){ vector <int> cnt(256), nums; vector <pii> inds; for(int i = 0; i < L; i++){ cnt[X[i]]++; } for(int i = 0; i < 256; i++){ while(cnt[i] > 1){ nums.pb(i); cnt[i] -= 2; } if(cnt[i]){ int inc = 0, orig = 0; for(int bit = 0; bit < 4; bit++){ if(i & (1<<bit)){ orig |= 1<<bit; } if(i & (1<<(bit+4))){ inc |= 1<<bit; } } inds.pb(mp(inc, orig)); } } sort(all(nums)); sort(all(inds)); vector <pii> ans; for(int i = 0; i < N; i++){ ans.pb(mp(inds[i].second, nums[i])); } sort(all(ans)); for(auto to : ans) output(to.second); } /* 8 0 0 1 1 0 0 1 0 6 1 255 13 26 49 216 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...