이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <cmath>
#include <numeric>
#include <bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<int, int> pl;
typedef pair<ld, ld> pd;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<ld> vd;
typedef vector<long> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto &a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
#define len(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define nl endl
#define S second
#define lb lower_bound
#define ub upper_bound
#define aint(x) x.begin(), x.end()
#define raint(x) x.rbegin(), x.rend()
#define ins insert
const int MOD = 1000000007;
void print1(int a){
cout << bitset<8>(a) << " ";
}
void encode(int N, int M[])
{
FOR(i,0,N){
int num = i << 3;
int val = M[i];
int arr[3];
FOR(i,0,3){
arr[i] = (val%8);
val = val >> 3;
}
FOR(i,0,3){
FOR(j,0,1<<i){
// print1(num+arr[i]);
send(num+arr[i]);
}
}
// cout << endl;
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <cmath>
#include <numeric>
#include <bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<int, int> pl;
typedef pair<ld, ld> pd;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<ld> vd;
typedef vector<long> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto &a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
#define len(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define nl endl
#define S second
#define lb lower_bound
#define ub upper_bound
#define aint(x) x.begin(), x.end()
#define raint(x) x.rbegin(), x.rend()
#define ins insert
const int MOD = 1000000007;
void print(int a){
cout << bitset<8>(a) << " ";
}
void decode(int N, int L, int X[])
{
vvi arr(N,vi(8,0));
vi ans(N,0);
// sort(X,X+L);
// cout<<"############" << endl;
FOR(i,0,L){
// print(X[i]);
// cout << "pos - " << (X[i]>>3) << " val - ";
// print(X[i]%8);
// cout << endl;
arr[X[i]>>3][X[i]%8] ++;
}
// cout<<"############" << endl;
FOR(i,0,N){
int val = 0;
// FOR(j,0,8)cout << arr[i][j] << " ";
// cout << endl;
for(int j=2;j>-1;j--){
FOR(k,0,8){
if(arr[i][k]>= (1<<j)){
arr[i][k] -= (1<<j);
val += k<<(3*j);
break;
}
}
}
ans[i] = val;
}
// FOR(i,0,N)cout << i << " -> " << ans[i] << endl;
FOR(i,0,N)output(ans[i]);
}
# | 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... |