이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>
using namespace std;
typedef int INT;
#define FOR(i,l,r) for(int i = (l); i < (r); i++)
#define snd second
#define fst first
#define V vector
#define pb push_back
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
int seed = 100;
void encode(int N, int M[]){
if(N <= 32) FOR(i, 0, N) FOR(j, 0, 8) {if(M[i]&(1<<j)) send( (i<<3)+j);}
else {
srand(seed);
int cnt = 0;
FOR(i, 0, N) {
int r = (rand() % 256);
FOR(j, 0, 4){
int m = M[i] ^ r;
int k = (m>>(2*j))& 3 ;
//cerr << cnt << endl;
FOR(_,0,k) {send( (i<<2)+j); cnt++;}
}
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;
typedef int INT;
#define FOR(i,l,r) for(int i = (l); i < (r); i++)
#define snd second
#define fst first
#define V vector
#define pb push_back
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
int Seed = 100;
void decode(int N, int L, int X[]) {
if(N <= 32){
vi msg(N, 0) ;
FOR(i, 0, L) msg[ (X[i]) >>3] |= 1<<(X[i]&7);
FOR(i, 0, N) output(msg[i]);
} else {
srand(Seed);
vi msg(4*N, 0);
FOR(i, 0, L) msg[X[i]]++;
//for(int k : msg) cout << k << " ";
//cout<<endl;
FOR(i, 0, N) {
int c = 0;
FOR(k, 0, 4) c |= msg[4*i+k] << (2*k);
c ^= (rand() % 256);
cerr<<c<<endl;
output(c);
}
}
}
# | 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... |