# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
959238 |
2024-04-07T18:02:19 Z |
d4xn |
Parrots (IOI11_parrots) |
C++17 |
|
7 ms |
1576 KB |
#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>
using namespace std;
void encode(int n, int m[]) {
pair<int, int> a[256];
int curr = 0;
for (int i = 0; i < 64; i++) {
a[curr++] = make_pair(i, -1);
for (int j = 0; j < 3; j++) {
a[curr++] = make_pair(i, j);
}
}
for(int i = 0; i < n; i++) {
vector<int> b(3, 0);
for (int j = 0; j < 3; j++) {
b[j] = m[i] % 8;
m[i] /= 8;
}
int sum = b[0] + b[1] + b[2];
if (sum <= 18 - sum) {
int y = 0;
while (a[y].first != i || a[y].second != 0) y++;
for (int j = 0; j < b[0]; j++) send(y);
for (int j = 0; j < b[1]; j++) send(y+1);
for (int j = 0; j < b[2]; j++) send(y+2);
}
else {
int y = 0;
while (a[y].first != i || a[y].second != -1) y++;
send(y);
for (int j = 0; j < 7-b[0]; j++) send(y+1);
for (int j = 0; j < 7-b[1]; j++) send(y+2);
for (int j = 0; j < 3-b[2]; j++) send(y+3);
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;
void decode(int N, int L, int X[]) {
pair<int, int> a[256];
int curr = 0;
for (int i = 0; i < 64; i++) {
a[curr++] = make_pair(i, -1);
for (int j = 0; j < 3; j++) {
a[curr++] = make_pair(i, j);
}
}
int pw[3];
pw[0] = 1;
for (int i = 1; i < 3; i++) {
pw[i] = pw[i-1]*8;
}
vector<int> ans(N, 0), rev(N, 0);
for (int i = 0; i < L; i++) {
int x = X[i];
if (a[x].second == -1) {
rev[a[x].first] = 1;
ans[a[x].first] = pw[0]*7 + pw[1]*7 + pw[2]*3;
}
}
for (int i = 0; i < L; i++) {
int x = X[i];
if (a[x].second == -1) continue;
ans[a[x].first] += (rev[a[x].first] ? -pw[a[x].second] : pw[a[x].second]);
}
for (int i = 0; i < N; i++) {
output(ans[i]);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
780 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1312 KB |
Output is correct |
2 |
Correct |
2 ms |
1308 KB |
Output is correct |
3 |
Correct |
2 ms |
1324 KB |
Output is correct |
4 |
Correct |
3 ms |
1320 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1312 KB |
Output is correct |
2 |
Correct |
1 ms |
1312 KB |
Output is correct |
3 |
Correct |
2 ms |
1576 KB |
Output is correct |
4 |
Correct |
2 ms |
1320 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1304 KB |
Output is correct |
2 |
Correct |
2 ms |
1320 KB |
Output is correct |
3 |
Correct |
3 ms |
1316 KB |
Output is correct |
4 |
Correct |
3 ms |
1332 KB |
Output is correct |
5 |
Correct |
4 ms |
1328 KB |
Output is correct |
6 |
Correct |
3 ms |
1340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
2 ms |
1312 KB |
partially correct P=7.187500 |
2 |
Partially correct |
3 ms |
1332 KB |
partially correct P=6.750000 |
3 |
Partially correct |
4 ms |
1340 KB |
partially correct P=7.060606 |
4 |
Partially correct |
4 ms |
1352 KB |
partially correct P=6.700000 |
5 |
Partially correct |
6 ms |
1360 KB |
partially correct P=7.000000 |
6 |
Partially correct |
7 ms |
1372 KB |
partially correct P=6.809524 |
7 |
Partially correct |
6 ms |
1364 KB |
partially correct P=6.765625 |