이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "encoder.h"
#include "encoderlib.h"
#include<bits/stdc++.h>
using namespace std;
#define in insert
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
//#define int long long
typedef long long ll;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
void encode(int n, int a[]) {
int sum = 0;
for(int i = 0; i < n; i++) {
for(int j = 0; j < 4; j++) {
int times = a[i] >> (2 * j) & 3;
sum += times;
}
}
int x = 0;
if(sum > n * 6) {
x = 3;
for(int i = 0; i < 4; i++) {
send(0);
}
}
for(int i = 0; i < n; i++) {
for(int j = 0; j < 4; j++) {
int times = (a[i] >> (2 * j) & 3) ^ x;
for(int k = 0; k < times; k++) {
send(i * 4 + j);
}
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include<bits/stdc++.h>
using namespace std;
#define in insert
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
//#define int long long
typedef long long ll;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
void decode(int n, int l, int x[]) {
sort(x, x + l);
int did = 0;
vector<int> cnt(256);
if(x[4] == 0) {
did = 3;
cnt[0] -= 4;
}
for(int i = 0; i < l; i++) {
cnt[x[i]]++;
}
for(int i = 0; i < n; i++) {
int ans = 0;
for(int j = 0; j < 4; j++) {
ans = ((ans << 2) | ((cnt[i * 4 + j] ^ did) << (j * 2)));
}
output(ans);
}
}
# | 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... |