(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

제출 #26948

#제출 시각아이디문제언어결과실행 시간메모리
269480xrgb앵무새 (IOI11_parrots)C++14
98 / 100
12 ms2432 KiB
#include "encoder.h" #include "encoderlib.h" static int LIB[257][7]; static void init() { int arr[7] = {-1, -1, -1, -1, -1, -1, -1}; for (int i = 0; i < 257; ++i) { for (int j = 0; j < 7; ++j) LIB[i][j] = arr[j]; int k; for (k = 6; arr[k] == 3; --k); ++arr[k]; for (int l = k + 1; l <= 6; ++l) arr[l] = arr[k]; } } void encode(int N, int M[]) { static bool isSet = true; if (isSet) { isSet = false; init(); } for (int i = 0; i < N; ++i) { for (int j = 0; j < 7; ++j) { if (LIB[M[i] + 1][j] == -1) continue; send(LIB[M[i] + 1][j] + (4 * i)); } } }
#include "decoder.h" #include "decoderlib.h" #include <algorithm> static int LIB[257][7]; static void init() { int arr[7] = {-1, -1, -1, -1, -1, -1, -1}; for (int i = 0; i < 257; ++i) { for (int j = 0; j < 7; ++j) LIB[i][j] = arr[j]; int k; for (k = 6; arr[k] == 3; --k); ++arr[k]; for (int l = k + 1; l <= 6; ++l) arr[l] = arr[k]; } } static int find_num(int arr[7]) { int l = 0, r = 256; while(l <= r) { const int m = (l + r) >> 1; int fl; for (int i = 0; i < 7; ++i) { fl = arr[i] - LIB[m][i]; if (fl != 0) break; } if (fl == 0) return m; else if (fl > 0) l = m + 1; else r = m - 1; } return -1; } void decode(int N, int L, int X[]) { static bool isSet = true; if (isSet) { isSet = false; init(); } std::sort(X, X + L); int arr[7], arl = 0, nl = 3; for (int i = 0; i < L; ++i) { if (nl < X[i]) { nl += 4; for (int j = arl; j < 7; ++j) arr[j] = -1; std::sort(arr, arr + 7); const int n = find_num(arr) - 1; if (n != -1) output(n); arl = 0; } arr[arl++] = X[i] % 4; } for (int j = arl; j < 7; ++j) arr[j] = -1; std::sort(arr, arr + 7); const int n = find_num(arr) - 1; if (n != -1) output(n); }
#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...