제출 #941690

#제출 시각아이디문제언어결과실행 시간메모리
941690SmuggingSpun앵무새 (IOI11_parrots)C++14
88 / 100
9 ms1400 KiB
#include "encoder.h" #include "encoderlib.h" #include<bits/stdc++.h> using namespace std; void encode(int N, int M[]){ if(N <= 32){ for(int i = 0; i < N; i++){ for(int j = 0; j < 8; j++){ if(1 << j & M[i]){ send((i << 3) + j); } } } return; } for(int i = 0; i < N; i++){ int m = M[i]; for(int j = 0; j < 4; j++){ int x = m & 3; m >>= 2; for(int t = 0; t < x; t++){ send((i << 2) + j); } } } }
#include "decoder.h" #include "decoderlib.h" #include<bits/stdc++.h> using namespace std; void decode(int N, int L, int X[]){ if(N <= 32){ vector<bool>bit(N << 3, false); for(int i = 0; i < L; i++){ bit[X[i]] = true; } for(int i = 0; i < N; i++){ int ans = 0; for(int j = 0; j < 8; j++){ if(bit[(i << 3) + j]){ ans |= 1 << j; } } output(ans); } return; } vector<int>cnt(N << 2, 0); for(int i = 0; i < L; i++){ cnt[X[i]]++; } for(int i = 0; i < N; i++){ int ans = 0; for(int j = 0; j < 4; j++){ ans += (1 << (j << 1)) * cnt[(i << 2) + j]; } output(ans); } }
#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...