제출 #72614

#제출 시각아이디문제언어결과실행 시간메모리
72614Bruteforceman앵무새 (IOI11_parrots)C++11
98 / 100
13 ms2784 KiB
#include "encoder.h" #include "encoderlib.h" #include "bits/stdc++.h" using namespace std; void encode(int N, int M[]) { vector <int> p; for(int i = 0; i < 4; i++) p.push_back(i); map <vector <int>, int> mp; int id = 0; do { mp[p] = id++; } while(next_permutation(p.begin(), p.end())); int cnt[4]; memset(cnt, 0, sizeof cnt); for(int i = 0; i < N; i++) { int x = M[i]; int p = x % 4; x /= 4; int q = x % 4; x /= 4; int r = x % 4; x /= 4; int s = x % 4; x /= 4; cnt[p] += 1; cnt[q] += 1; cnt[r] += 1; cnt[s] += 1; } vector <pair <int, int>> v; for(int i = 0; i < 4; i++) { v.push_back(make_pair(-cnt[i], i)); } sort(v.begin(), v.end()); vector <int> perm; vector <int> rep (4); for(auto i : v) { perm.push_back(i.second); } for(int i = 0; i < 4; i++) { rep[perm[i]] = i; } for(int i = 0; i < 4; i++) { send(mp[perm]); } int cur = 0; for(int i = 0; i < N; i++) { int x = M[i]; int p = rep[x % 4]; x /= 4; int q = rep[x % 4]; x /= 4; int r = rep[x % 4]; x /= 4; int s = rep[x % 4]; x /= 4; while(p--) send(cur); ++cur; while(q--) send(cur); ++cur; while(r--) send(cur); ++cur; while(s--) send(cur); ++cur; } }
#include "decoder.h" #include "decoderlib.h" #include "bits/stdc++.h" using namespace std; void decode(int N, int L, int X[]) { vector <int> p; vector <vector <int>> ls; for(int i = 0; i < 4; i++) p.push_back(i); int id = 0; do { ls.push_back(p); } while(next_permutation(p.begin(), p.end())); int cnt[300]; memset(cnt, 0, sizeof cnt); vector <int> perm; for(int i = 0; i < L; i++) { cnt[X[i]] += 1; } for(int i = 0; i < 4*N; i++) { if(cnt[i] >= 4) { perm = ls[i]; cnt[i] -= 4; } } for(int i = 0; i < 4 * N; i += 4) { output(perm[cnt[i]] + perm[cnt[i+1]] * 4 + perm[cnt[i+2]] * 16 + perm[cnt[i+3]] * 64); } }

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

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:11:6: warning: unused variable 'id' [-Wunused-variable]
  int id = 0;
      ^~
#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...