#include "encoder.h"
#include "encoderlib.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sz size()
void encode(int N, int M[])
{
vector<pair<ll,ll> > v;
for(int i = 0; i < N; i++) v.push_back({M[i],i});
sort(v.begin(),v.end());
for(int i = 0; i < N; i++)
{
send(M[i]);
send(M[i]);
}
for(int i = 0; i < N; i++)
{
send(v[i].second+i*16);
}
}
#include "decoder.h"
#include "decoderlib.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sz size()
const int M = 256;
ll ans[M+2];
ll freq[M+2];
void decode(int N, int L, int X[])
{
//for(int i = 0; i < L; i++) cout << X[i] << " "; cout << endl;
//return;
for(int i = 0; i < M; i++) freq[i] = 0;
for(int i = 0; i < L; i++) freq[X[i]]++;
vector<ll> v,vv;
for(int i = 0; i < M; i++){
for(int j = 0 ; j < freq[i]/2; j++) v.push_back(i);
if(freq[i]&1) vv.push_back(i);}
//sort(v.begin(),v.end());
// cout << v.sz << " " << vv.sz << endl; return;
ll l = 0;
for(int i = 0; i < N; i++)
{
//cout << vv[l]%16 << " " << v[i]<< endl;
ans[vv[l++]%16] = v[i];
}
for(int i=0; i< N; i++) {
output(ans[i]);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
788 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1312 KB |
Output is correct |
2 |
Correct |
1 ms |
1312 KB |
Output is correct |
3 |
Correct |
1 ms |
1308 KB |
Output is correct |
4 |
Correct |
2 ms |
1308 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1308 KB |
Output is correct |
2 |
Correct |
2 ms |
1296 KB |
Output is correct |
3 |
Correct |
1 ms |
1316 KB |
Output is correct |
4 |
Correct |
2 ms |
1312 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1312 KB |
Output is correct |
2 |
Correct |
2 ms |
1388 KB |
Output is correct |
3 |
Incorrect |
0 ms |
796 KB |
Error : Bad encoded integer |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1300 KB |
Output is correct - P = 3.000000 |
2 |
Incorrect |
0 ms |
788 KB |
Error : Bad encoded integer |
3 |
Halted |
0 ms |
0 KB |
- |