# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
799276 |
2023-07-31T11:36:40 Z |
Liudas |
Parrots (IOI11_parrots) |
C++17 |
|
2 ms |
1052 KB |
#include <bits/stdc++.h>
#include "encoder.h"
#include "encoderlib.h"
//#include "decoder.h"
//#include "decoderlib.h"
using namespace std;
void encode(int N, int M[]){
for(int i = 0; i < N; i ++){
send(M[i]);
send(M[i]);
}
vector<int> arr;
for(int i = 0; i < N; i ++){
arr.push_back(M[i]);
}
sort(arr.begin(), arr.end());
for(int i = 0; i < N; i ++){
for(int j = 0; j < N; j ++){
if(arr[j] == M[i]){
send(i * 16 + j);
M[i] = -1;
break;
}
}
}
}
#include <bits/stdc++.h>
//#include "encoder.h"
//#include "encoderlib.h"
#include "decoder.h"
#include "decoderlib.h"
using namespace std;
void decode(int N, int L, int X[]){
map<int, int> arr;
for(int i = 0; i < L; i++){
arr[X[i]]++;
}
vector<int> ord, ans(N), brr;
for(auto[l, r] : arr){
for(int i = 0; i < r/2; i ++){
brr.push_back(l);
}
if(r % 2){
ord.push_back(l);
}
}
for(int k : ord){
int i = k / 16, j = k % 16;
ans[i] = brr[j];
}
for(int i : ans){
output(i);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
644 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
972 KB |
Output is correct |
2 |
Correct |
1 ms |
1008 KB |
Output is correct |
3 |
Correct |
2 ms |
1048 KB |
Output is correct |
4 |
Correct |
2 ms |
1036 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1032 KB |
Output is correct |
2 |
Correct |
1 ms |
1032 KB |
Output is correct |
3 |
Correct |
2 ms |
1036 KB |
Output is correct |
4 |
Correct |
2 ms |
1036 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1052 KB |
Output is correct |
2 |
Correct |
2 ms |
1036 KB |
Output is correct |
3 |
Incorrect |
0 ms |
524 KB |
Error : Bad encoded integer |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1044 KB |
Output is correct - P = 3.000000 |
2 |
Incorrect |
1 ms |
624 KB |
Error : Bad encoded integer |
3 |
Incorrect |
0 ms |
616 KB |
Error : Bad encoded integer |
4 |
Incorrect |
1 ms |
524 KB |
Error : Bad encoded integer |
5 |
Incorrect |
1 ms |
524 KB |
Error : Bad encoded integer |
6 |
Incorrect |
0 ms |
520 KB |
Error : Bad encoded integer |
7 |
Incorrect |
0 ms |
660 KB |
Error : Bad encoded integer |