Submission #796027

# Submission time Handle Problem Language Result Execution time Memory
796027 2023-07-28T05:01:25 Z khshg Parrots (IOI11_parrots) C++14
98 / 100
7 ms 1356 KB
#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>
using namespace std;
 
void encode(int N, int M[]) {
	vector<array<int, 4>> H;
	for(int Os = 0; Os <= 7; ++Os) {
		for(int Is = 0; Is + Os <= 7; ++Is) {
			for(int Zs = 0; Zs + Is + Os <= 7; ++Zs) {
				for(int Es = 0; Es + Zs + Is + Os <= 7; ++Es) {
					H.push_back({Os, Is, Zs, Es});
				}
			}
		}
	}
	sort(begin(H), end(H));
	for(int i = 0; i < N; ++i) {
		array<int, 4> k = H[M[i]];
		for(int x : {0, 1, 2, 3}) while(k[x]--) send(((i << 2) ^ x));
	}
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;
 
void decode(int N, int L, int X[]) {
	int H[8][8][8][8];
	memset(H, -1, sizeof(H));
	for(int Os = 0, C = 0; Os <= 7; ++Os) {
		for(int Is = 0; Is + Os <= 7; ++Is) {
			for(int Zs = 0; Zs + Is + Os <= 7; ++Zs) {
				for(int Es = 0; Es + Zs + Is + Os <= 7; ++Es) {
					H[Os][Is][Zs][Es] = C++;
				}
			}
		}
	}
	vector<array<int, 4>> cnt(N);
	for(int i = 0; i < L; ++i) {
		++cnt[(X[i] >> 2)][(X[i] & 3)];
	}
	for(int i = 0; i < N; ++i) {
		output(H[cnt[i][0]][cnt[i][1]][cnt[i][2]][cnt[i][3]]);
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1028 KB Output is correct
2 Correct 3 ms 1028 KB Output is correct
3 Correct 3 ms 1040 KB Output is correct
4 Correct 3 ms 1036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1028 KB Output is correct
2 Correct 3 ms 1064 KB Output is correct
3 Correct 3 ms 1036 KB Output is correct
4 Correct 3 ms 1040 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1036 KB Output is correct
2 Correct 3 ms 1036 KB Output is correct
3 Correct 3 ms 1048 KB Output is correct
4 Correct 4 ms 1156 KB Output is correct
5 Correct 4 ms 1196 KB Output is correct
6 Correct 4 ms 1188 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 3 ms 1044 KB Output is partially correct - P = 7.000000
2 Partially correct 4 ms 1180 KB Output is partially correct - P = 7.000000
3 Partially correct 4 ms 1180 KB Output is partially correct - P = 7.000000
4 Partially correct 5 ms 1328 KB Output is partially correct - P = 7.000000
5 Partially correct 7 ms 1340 KB Output is partially correct - P = 7.000000
6 Partially correct 7 ms 1356 KB Output is partially correct - P = 7.000000
7 Partially correct 7 ms 1356 KB Output is partially correct - P = 7.000000