Submission #61094

# Submission time Handle Problem Language Result Execution time Memory
61094 2018-07-25T08:01:48 Z mhnd Parrots (IOI11_parrots) C++14
81 / 100
17 ms 2784 KB
#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
const int N = 1e5+50;
const ll oo = 1e18;
const ll mod = 1e9+7;

void encode(int N, int M[]) {
	if(N<=32){
		for(int i=0;i<N;i++)
			for(int k=0;k<8;k++)
				if((M[i]>>k)&1)send(N*k+i);
	}else{
		 for (int i = 0; i < N && i < 32; i++) {
      for (int j = 0, k = 1; j < 8; j++, k <<= 1) {

        if (N > 32 && i + 32 < N) {
          if ((M[i] & k) && (M[i + 32] & k)) {
            send(i * 8 + j);
          } else if (M[i + 32] & k) {
            send(i * 8 + j);
            send(i * 8 + j);
            send(i * 8 + j);
          } else if (M[i] & k) {
            send(i * 8 + j);
            send(i * 8 + j);
          }

        } else {
          if (M[i] & k) {
            send(i * 8 + j);
          }
        }
      }
    }
	}
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
const int N = 1e5+50;
const ll oo = 1e18;
const ll mod = 1e9+7;
 
int num[200],f[300];
void decode(int N, int L, int X[]){
	int message[64] = {0};
  memset(num,0,sizeof(num));
	memset(f,0,sizeof(f));
	if(N<=32){
		for(int i=0;i<L;i++)num[X[i]%N] += (1<<(X[i]/N));
	}else{
		
    int bitCount[256] = {0};

    for (int i = 0; i < L; i++) {
      bitCount[X[i]]++;
    }

    for (int i = 0; i < 256; i++) {
      if (N > 32) {
        switch (bitCount[i]) {
        case 2:
          message[i / 8] |= (1 << (i % 8));
          break;
        case 3:
          message[i / 8 + 32] |= 1 << (i % 8);
          break;
        case 1:
          message[i / 8 + 32] |= 1 << (i % 8);
          message[i / 8] |= 1 << (i % 8);
          break;
        }
      } else if (bitCount[i]) {
        message[i / 8] |= (1 << (i % 8));
      }
    }
	}
	for(int i=0;i<N;i++)output(num[i]);
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 752 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1992 KB Output is correct
2 Correct 7 ms 1992 KB Output is correct
3 Correct 7 ms 2016 KB Output is correct
4 Correct 7 ms 2168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 2200 KB Output is correct
2 Correct 8 ms 2488 KB Output is correct
3 Correct 9 ms 2488 KB Output is correct
4 Correct 8 ms 2488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2488 KB Output is correct
2 Correct 7 ms 2488 KB Output is correct
3 Correct 8 ms 2488 KB Output is correct
4 Correct 11 ms 2488 KB Output is correct
5 Correct 9 ms 2488 KB Output is correct
6 Correct 11 ms 2488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 4 ms 2488 KB Output is partially correct - P = 8.000000
2 Partially correct 10 ms 2488 KB Output is partially correct - P = 8.000000
3 Incorrect 9 ms 2488 KB Error : Output is wrong
4 Incorrect 13 ms 2528 KB Error : Output is wrong
5 Incorrect 12 ms 2528 KB Error : Output is wrong
6 Incorrect 17 ms 2784 KB Error : Output is wrong
7 Incorrect 13 ms 2784 KB Error : Output is wrong