제출 #596008

#제출 시각아이디문제언어결과실행 시간메모리
596008snasibov05앵무새 (IOI11_parrots)C++14
98 / 100
8 ms1220 KiB
#include "encoder.h" #include "encoderlib.h" void encode(int n, int m[]){ const int nn = 32; int mx = 8; int cntz = 0, cnto = 0; for (int i = 0; i < n; ++i){ for (int j = 0; j < mx; ++j){ if ((1 << j) & m[i]) cnto++; else cntz++; } } if (cnto <= cntz) { for (int i = 0; i < n; ++i){ for (int j = 0; j < mx; ++j){ if (1 << j & m[i]) { if (i < nn) send(j * nn + i); else { send(j * nn + (i - nn)); send(j * nn + (i - nn)); } } } } } else{ send(0); send(0); send(0); send(0); for (int i = 0; i < n; ++i){ for (int j = 0; j < mx; ++j){ if (!(1 << j & m[i])) { if (i < nn) send(j * nn + i); else { send(j * nn + (i - nn)); send(j * nn + (i - nn)); } } } } } }
#include "decoder.h" #include "decoderlib.h" #include "bits/stdc++.h" using namespace std; void decode(int n, int l, int x[]){ const int nn = 32; map<int, int> cnt; for (int i = 0; i < l; ++i) cnt[x[i]]++; bool flag = cnt[0] > 3; if (flag) cnt[0] -= 4; vector<int> v(n); for (auto [cur, c] : cnt){ if (c == 1 || c == 3) v[cur % nn] += (1 << (cur / nn)); if (c == 2 || c == 3) v[cur % nn + nn] += (1 << (cur / nn)); } if (flag) { for (int i = 0; i < n; ++i){ v[i] = 255 - v[i]; } } for (int i = 0; i < n; ++i) output(v[i]); }

컴파일 시 표준 에러 (stderr) 메시지

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:16:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   16 |     for (auto [cur, c] : cnt){
      |               ^
#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...