제출 #1053073

#제출 시각아이디문제언어결과실행 시간메모리
1053073Zbyszek99앵무새 (IOI11_parrots)C++17
컴파일 에러
0 ms0 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i = a; i <= b; i++) void encode(int n, int M[]) { int num_of_zero = 0; int num_of_one = 0; vector<int> m; rep(i,0,n-1) m.push_back(M[i]); for(auto it:m) { rep(bit,0,7) { if(it & (1 << bit)) num_of_one++; else num_of_zero++; } } if(num_of_zero < num_of_one) { rep(i,0,n-1) m[i] ^= 255; rep(i,0,7) send(0); } if(n > 32) { rep(j,0,(n%4)-1) m.push_back(255); for(int i = 0; i < (n+3)/4; i++) { int w = 0; int poz = i*4; if(m[poz] == 255) w += 1; if(m[poz+1] == 255) w += 2; if(m[poz+2] == 255) w += 4; if(m[poz+3] == 255) w += 8; int ans = i + (w << 4); if(w == 0) continue; send(ans); send(ans); send(ans); send(ans); } rep(i,0,n/2-1) { if(m[i] == 255) { continue; } rep(bit,0,7) { if(m[i] & (1 << bit)) { send(bit + (i << 3)); } } } rep(i,n/2,n-1) { if(m[i] == 255) { continue; } rep(bit,0,7) { if(m[i] & (1 << bit)) { send(bit + ((i-(n/2)) << 3)); send(bit + ((i-(n/2)) << 3)); } } } return; } rep(i,0,n-1) { rep(bit,0,7) { if(m[i] & (1 << bit)) { send(bit + (i << 3)); } } } }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i = a; i <= b; i++) void decode(int n, int l, int x[]) { vector<int> ans(n+4,0); if(n <= 32) { rep(i,0,l-1) { int bit = 0; if(x[i] & 1) bit += 1; if(x[i] & 2) bit += 2; if(x[i] & 4) bit += 4; int poz = x[i] >> 3; ans[poz] |= (1 << bit); } } else { map<int,int> zlicz; rep(i,0,l-1) zlicz[x[i]]++; rep(i,0,l-1) { cerr << x[i] << " " << zlicz[x[i]]<< " zap\n"; if(zlicz[x[i]] & 1) { int bit = 0; if(x[i] & 1) bit += 1; if(x[i] & 2) bit += 2; if(x[i] & 4) bit += 4; int poz = x[i] >> 3; ans[poz] |= (1 << bit); } if(zlicz[x[i]] & 2) { int bit = 0; if(x[i] & 1) bit += 1; if(x[i] & 2) bit += 2; if(x[i] & 4) bit += 4; int poz = x[i] >> 3; ans[poz + n/2] |= (1 << bit); } if(zlicz[x[i]] & 4) { int blok = x[i] & (1+2+4+8); int is = x[i] & (16+32+64+128); int p = 0; cerr << blok << " " << is << " info255\n"; is = (is >> 4); rep(j,blok*4,blok*4+3) { if(is & (1 << p)) ans[j] = 255; p++; } } } } cerr << "ans: "; if(zlicz[0] & 8) { rep(i,0,n-1) ans[i] ^= 255; } rep(i,0,n-1) cerr << ans[i] << " "; cerr << "\n"; rep(i,0,n-1) output(ans[i]); }

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

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:63:6: error: 'zlicz' was not declared in this scope
   63 |   if(zlicz[0] & 8)
      |      ^~~~~