제출 #97200

#제출 시각아이디문제언어결과실행 시간메모리
97200Alexa2001앵무새 (IOI11_parrots)C++17
98 / 100
15 ms1792 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; void encode(int N, int M[]) { vector<int> bits; int i, j; for(i=0; i<N; ++i) for(j=0; j<8; ++j) bits.push_back((M[i] >> j)&1); int cnt = 0; for(i=0; 2*i<bits.size(); ++i) { int a, b; a = bits[2*i]; b = bits[2*i+1]; if(a == 0) cnt += 1; if(b == 0) cnt += 2; } bool rev = (cnt > 6*N); for(i=0; 2*i<bits.size(); ++i) { int a, b; a = bits[2*i]; b = bits[2*i+1]; if(a == rev) send(i); if(b == rev) { send(i); send(i); } } if(rev) { send(0); send(0); send(0); send(0); } }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; static int cnt[300]; void decode(int N, int L, int X[]) { memset(cnt, 0, sizeof(cnt)); int i, j; for(i=0; i<L; ++i) ++cnt[X[i]]; bool rev = 0; if(cnt[0] >= 4) rev = 1, cnt[0] -= 4; vector<int> bits(8*N, rev ^ 1); for(i=0; i<4*N; ++i) { if(cnt[i] & 1) bits[2*i] = rev; if(cnt[i] & 2) bits[2*i+1] = rev; } for(i=0; i<N; ++i) { int x = 0; for(j=0; j<8; ++j) x += (1<<j) * bits[8*i+j]; output(x); } }

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

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:16:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(i=0; 2*i<bits.size(); ++i)
              ~~~^~~~~~~~~~~~
encoder.cpp:28:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(i=0; 2*i<bits.size(); ++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...