제출 #230371

#제출 시각아이디문제언어결과실행 시간메모리
230371Bruteforceman앵무새 (IOI11_parrots)C++11
98 / 100
19 ms2048 KiB
#include "encoder.h" #include "encoderlib.h" #include "bits/stdc++.h" using namespace std; namespace { vector <vector <int>> can; vector <int> v; int cnt; void backtrack(int cur, int last) { if(can.size() > 256) return ; if(cur == 0) { can.push_back(v); ++cnt; return ; } for(int i = last; i < 4; i++) { v.push_back(i); backtrack(cur - 1, i); v.pop_back(); } } } void encode(int N, int M[]) { for(int i = 1; i <= 7; i++) { backtrack(i, 0); } int i; for(i=0; i<N; i++) { vector <int> v = can[M[i]]; for(int j : v) { send(4 * i + j); } } }
#include "decoder.h" #include "decoderlib.h" #include "bits/stdc++.h" using namespace std; namespace { vector <vector <int>> can; vector <int> v; int cnt; void backtrack(int cur, int last) { if(can.size() > 256) return ; if(cur == 0) { can.push_back(v); ++cnt; return ; } for(int i = last; i < 4; i++) { v.push_back(i); backtrack(cur - 1, i); v.pop_back(); } } } void decode(int N, int L, int X[]) { for(int i = 1; i <= 7; i++) { backtrack(i, 0); } vector <int> v[N + 1]; for(int i = 0; i < L; i++) { v[X[i] / 4].push_back(X[i] % 4); } for(int i = 0; i < N; i++) { sort(v[i].begin(), v[i].end()); for(int j = 0; j < can.size(); j++) { if(can[j] == v[i]) { output(j); break; } } } }

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

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:35:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int j = 0; j < can.size(); j++) {
                    ~~^~~~~~~~~~~~
#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...