Submission #18355

# Submission time Handle Problem Language Result Execution time Memory
18355 2016-01-28T06:08:57 Z suhgyuho_william Parrots (IOI11_parrots) C++
17 / 100
6 ms 2600 KB
#include "encoder.h"
#include "encoderlib.h"

void encode(int N, int M[]){
	int i,j,t;
	int tmp[100];

	for(i=0; i<N; i++) tmp[i] = M[i];
	for(i=0; i<N; i++){
		j = -1;
		while(M[i] != 0){
			t = M[i] % 2;
			M[i] /= 2;
			j++;
			if(t == 0) continue;
			send(8*i+j);
		}
	}
	for(i=0; i<N; i++) M[i] = tmp[i];
}
#include "decoder.h"
#include "decoderlib.h"
#include <algorithm>
#include <stdio.h>
using namespace std;

int cnt;
long long d[1000][1000];
int ans[1000];

void Init(){
	int i,j,k;
	long long t,sum;

	for(i=0; i<=255; i++) d[1][i] = 256-i;
	for(i=2; i<=10; i++) for(j=0; j<=255; j++) for(k=j; k<=255; k++) d[i][j] += d[i-1][k];

	t = 1; int tt = 7;
	sum = 0;
	for(i=1; i<=tt; i++) t *= 256;
	for(i=0; i<=255; i++) sum += d[tt][i];
	printf("%lld %lld\n",t,sum);
	double ra;
	ra = (double)t / (double)sum;
	printf("%lf\n",ra);
}

void decode(int N, int L, int X[]){
	int i;
	int t1,t2;

	for(i=L; i>=1; i--) X[i] = X[i-1];
    cnt++;
    for(i=0; i<N; i++) ans[i] = 0;
    for(i=1; i<=L; i++){
		t1 = X[i] / 8;
		t2 = X[i] % 8;
		ans[t1] += (1 << t2);
    }
    for(i=0; i<N; i++){
		output(ans[i]);
    }
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 752 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 1592 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 2024 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 2304 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 2560 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 6 ms 2600 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Incorrect 4 ms 2600 KB Error : Bad encoded integer
4 Incorrect 4 ms 2600 KB Error : Bad encoded integer
5 Incorrect 4 ms 2600 KB Error : Bad encoded integer
6 Incorrect 4 ms 2600 KB Error : Bad encoded integer
7 Incorrect 4 ms 2600 KB Error : Bad encoded integer