This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define f first
#define s second
#define ent '\n';
using namespace std;
typedef long long ll;
const int mx=2e5+12;
void output(int b);
void send(int a);
int cnt[mx];
int a[mx];
void encode(int n, int daun[]){
srand(6932);
for(int i=0;i<n;i++){
a[i]=daun[i];
int x=rand()%256;
a[i]^=x;
}
for(int i=0;i<n;i++){
for(int j=0;j<=i;j++){
send(a[i]);
}
}
}
#include <bits/stdc++.h>
#define f first
#define s second
#define ent '\n';
using namespace std;
typedef long long ll;
const int mx=2e5+12;
void output(int b);
void send(int a);
int cnt[mx];
int a[mx];
void decode(int m, int n, int a[]){
srand(6932);
for(int i=0;i<256;i++){
cnt[i]=0;
}
for(int i=0;i<n;i++){
cnt[a[i]]++;
}
for(int i=0;i<m;i++){
pair<int,int> mn={1e9,0};
for(int x=0;x<256;x++){
if(cnt[x]>0)mn=min(mn,{cnt[x],x});
}
int x=(rand()%256);
output((x^mn.s));
cnt[mn.s]-=i+1;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |