# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
771315 |
2023-07-02T20:07:42 Z |
iulia13 |
Parrots (IOI11_parrots) |
C++14 |
|
5 ms |
1228 KB |
#include <bits/stdc++.h>
#include "encoder.h"
#include "encoderlib.h"
using namespace std;
const int N = 513;
void encode(int n, int a[])
{
int cnt = 0, i = 0, ok = 0, tot = 3 * 128;
while (cnt <= 248 && i < n)
{
int nr = 128;
while(nr)
{
if (a[i] & nr)
ok++;
nr /= 2;
cnt++;
}
i++;
}
while (cnt <= 504 && i < n)
{
int nr = 128;
while (nr)
{
if (a[i] & nr)
{
ok += 2;
//send(cnt - 256);
//send(cnt - 256);
}
nr /= 2;
cnt++;
}
i++;
}
if (ok <= tot)
ok = 1;
else
ok = 0;
cnt = i = 0;
while (cnt <= 248 && i < n)
{
int nr = 128;
while(nr)
{
if ((a[i] & nr) == nr * ok)
send(cnt);
nr /= 2;
cnt++;
}
i++;
}
while (cnt <= 504 && i < n)
{
int nr = 128;
while (nr)
{
if ((a[i] & nr) == nr * ok)
{
send(cnt - 256);
send(cnt - 256);
}
nr /= 2;
cnt++;
}
i++;
}
if (!ok)
{
send(0);
send(0);
send(0);
send(0);
}
}
#include <bits/stdc++.h>
#include "decoder.h"
#include "decoderlib.h"
using namespace std;
const int N = 513;
int vf[N];
int ans[N];
int bits[N];
void decode(int n, int l, int a[])
{
for (int i = 0; i < 256; i++)
vf[i] = 0;
for (int i = 0; i < l; i++)
{
vf[a[i]]++;
}
for (int i = 0; i < N; i++)
bits[i] = 0;
if (vf[0] >= 4)
{
for (int i = 0; i < N; i++)
bits[i] = 1;
}
for (int i = 0; i < 256; i++)
{
if (vf[i] & 1)
bits[i] |= 1;
if (vf[i] & 2)
bits[i] |= 1;
}
int j = 0;
for (int i = 0; i < n; i++)
{
int nr = 128;
ans[i] = 0;
while (nr)
{
ans[i] += bits[j] * nr;
nr /= 2;
j++;
}
output(ans[i]);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1036 KB |
Output is correct |
2 |
Correct |
1 ms |
1044 KB |
Output is correct |
3 |
Correct |
2 ms |
1044 KB |
Output is correct |
4 |
Correct |
2 ms |
1044 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1036 KB |
Output is correct |
2 |
Correct |
1 ms |
1036 KB |
Output is correct |
3 |
Correct |
2 ms |
1044 KB |
Output is correct |
4 |
Correct |
2 ms |
1048 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1028 KB |
Output is correct |
2 |
Correct |
2 ms |
1040 KB |
Output is correct |
3 |
Correct |
3 ms |
1012 KB |
Output is correct |
4 |
Correct |
3 ms |
1056 KB |
Output is correct |
5 |
Correct |
3 ms |
1056 KB |
Output is correct |
6 |
Correct |
3 ms |
1072 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
2 ms |
1044 KB |
Output is partially correct - P = 8.000000 |
2 |
Partially correct |
3 ms |
1060 KB |
Output is partially correct - P = 8.000000 |
3 |
Incorrect |
2 ms |
1052 KB |
Error : Output is wrong |
4 |
Incorrect |
4 ms |
1072 KB |
Error : Output is wrong |
5 |
Incorrect |
4 ms |
1212 KB |
Error : Output is wrong |
6 |
Incorrect |
5 ms |
1224 KB |
Error : Output is wrong |
7 |
Incorrect |
5 ms |
1228 KB |
Error : Output is wrong |