Submission #62161

#TimeUsernameProblemLanguageResultExecution timeMemory
62161realityParrots (IOI11_parrots)C++17
98 / 100
55 ms52168 KiB
#include "encoder.h" #include "encoderlib.h" # include <bits/stdc++.h> using namespace std; # define x first # define y second # define ll long long # define vi vector < int > # define vl vector < ll > # define pii pair < int , int > # define mp make_pair # define vii vector < pii > # define pb push_back template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;} template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;} void encode(int N, int M[]) { int n = N; static vi v[1 << 20]; int cnt = -1; for (int i = 0;i <= 7;++i) for (int j = 0;j <= 7;++j) for (int k = 0;k <= 7;++k) for (int l = 0;l <= 7;++l) if (i + j + k + l <= 7) ++cnt,v[cnt] = {i,j,k,l}; for (int i = 0; i < n; i++) { const int cur = M[i]; for (int j = 0;j < 4;++j) for (int k = 0;k < v[cur][j];++k) send(i * 4 + j); } }
#include "decoder.h" #include "decoderlib.h" # include <bits/stdc++.h> using namespace std; # define x first # define y second # define ll long long # define vi vector < int > # define vl vector < ll > # define pii pair < int , int > # define mp make_pair # define vii vector < pii > # define pb push_back template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;} template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;} void decode(int N, int L, int X[]) { static map < vi , int > M; M.clear(); int cnt = -1; for (int i = 0;i <= 7;++i) for (int j = 0;j <= 7;++j) for (int k = 0;k <= 7;++k) for (int l = 0;l <= 7;++l) if (i + j + k + l <= 7) M[{i,j,k,l}] = ++cnt; int n = N; vi ss[n]; for (int i = 0;i < n;++i) ss[i].resize(4); for (int i = 0;i < n;++i) for (int j = 0;j < 4;++j) ss[i][j] = 0; for (int i = 0;i < L;++i) { int cnt = X[i]; int pos = cnt / 4; cnt %= 4; ss[pos][cnt] += 1; } for (int i = 0; i < n; i++) output(M[{ss[i][0],ss[i][1],ss[i][2],ss[i][3]}]); }
#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...