Submission #789222

#TimeUsernameProblemLanguageResultExecution timeMemory
789222Ronin13Parrots (IOI11_parrots)C++17
98 / 100
7 ms1392 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; void encode(int N, int M[]) { int cnt = 0; for(int i= 0; i < N; i++){ for(int j = 0; j < 8; j+=2){ int a, b; a = b = 0; if(M[i] & (1 << j)) a++; if(M[i] & (1 << (j + 1))) b++; cnt += 2 * a + b; } } //cout << cnt; if(cnt > 6 * N){ int cur = 0; send(0); send(0); send(0); send(0); for(int i= 0; i < N; i++){ for(int j = 0; j < 8; j+=2){ int a, b; a = b = 0; if(M[i] & (1 << j)) a++; if(M[i] & (1 << (j + 1))) b++; for(int x = 0; x < 3 - (2 * b + a); x++) send(cur); cur++; } } return; } int cur = 0; for(int i= 0; i < N; i++){ for(int j = 0; j < 8; j+=2){ int a, b; a = b = 0; if(M[i] & (1 << j)) a++; if(M[i] & (1 << (j + 1))) b++; // cout << a << ' ' << b << "\n"; for(int x = 0; x < 2 * b + a; ++x) send(cur); // cout << cur; cur++; } } }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; void decode(int N, int L, int x[]) { int cnt[4 * N]; fill(cnt, cnt + 4 * N, 0); for(int i = 0; i < L; i++){ // cout << x[i] << ' '; cnt[x[i]]++; } if(cnt[0] >= 4){ cnt[0] -= 4; for(int i = 0; i < 4 * N; i++){ cnt[i] = 3 - cnt[i]; } } int ans[N]; fill(ans, ans + N, 0); int cur = 0; for(int i = 0; i < N; i++){ for(int j = 0; j < 8; j += 2){ ans[i] += cnt[cur] * (1 << (j)); cur++; } output(ans[i]); } }
#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...