#include <bits/stdc++.h>
#include "encoder.h"
#include "encoderlib.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int,int> pi;
#define REP(i,a,b) for(int i=a;i<b;i++)
#define F first
#define S second
#define PB push_back
#define MP make_pair
void encode(int N, int M[])
{
if(N<=32){
REP(i,0,N){
int k=i<<3;
REP(j,0,8){
int t=M[i]&(1<<j);
if(t!=0){
send(k+j);
}
}
}
}
else{
REP(i,0,N){
int k=i<<2;
REP(j,0,4){
int t=M[i]&(1<<j);
if(t!=0){
send(k+j);
}
}
REP(j,4,8){
int t=M[i]&(1<<j);
if(t!=0){
send(k+j-4);
send(k+j-4);
}
}
}
}
}
#include <bits/stdc++.h>
#include "decoder.h"
#include "decoderlib.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int,int> pi;
#define REP(i,a,b) for(int i=a;i<b;i++)
#define F first
#define S second
#define PB push_back
#define MP make_pair
void decode(int N, int L, int X[])
{
vi a(L);
REP(i,0,L)a[i]=X[i];
sort(a.begin(),a.end());
if(N<=32){
REP(i,0,N){
int k=i<<3;
int ans=0;
REP(j,0,8){
bool flag=binary_search(a.begin(),a.end(),k+j);
if(flag)ans|=(1<<j);
}
output(ans);
}
}
else{
REP(i,0,N){
int k=i<<2;
int ans=0;
REP(j,0,4){
int c=upper_bound(a.begin(),a.end(),k+j)-lower_bound(a.begin(),a.end(),k+j);
if(c%2==1)ans|=(1<<j);
if(c>1)ans|=(1<<(j+4));
}
output(ans);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
784 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1304 KB |
Output is correct |
2 |
Correct |
2 ms |
1308 KB |
Output is correct |
3 |
Correct |
2 ms |
1316 KB |
Output is correct |
4 |
Correct |
2 ms |
1312 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1304 KB |
Output is correct |
2 |
Correct |
1 ms |
1300 KB |
Output is correct |
3 |
Correct |
2 ms |
1300 KB |
Output is correct |
4 |
Correct |
2 ms |
1308 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1296 KB |
Output is correct |
2 |
Correct |
2 ms |
1312 KB |
Output is correct |
3 |
Correct |
2 ms |
1324 KB |
Output is correct |
4 |
Correct |
3 ms |
1332 KB |
Output is correct |
5 |
Correct |
2 ms |
1332 KB |
Output is correct |
6 |
Correct |
3 ms |
1328 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
2 ms |
1320 KB |
Output is partially correct - P = 8.000000 |
2 |
Partially correct |
3 ms |
1328 KB |
Output is partially correct - P = 8.000000 |
3 |
Partially correct |
4 ms |
1336 KB |
Output is partially correct - P = 12.000000 |
4 |
Partially correct |
6 ms |
1368 KB |
Output is partially correct - P = 12.000000 |
5 |
Partially correct |
11 ms |
1648 KB |
Output is partially correct - P = 12.000000 |
6 |
Partially correct |
8 ms |
1516 KB |
Output is partially correct - P = 12.000000 |
7 |
Partially correct |
9 ms |
1396 KB |
Output is partially correct - P = 12.000000 |