Submission #795081

# Submission time Handle Problem Language Result Execution time Memory
795081 2023-07-27T06:06:02 Z ono_de206 Parrots (IOI11_parrots) C++14
24 / 100
8 ms 1376 KB
#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[]) {
	vector<int> cnt(256);
	for(int i = 0; i < l; i++) {
		cnt[x[i]]++;
	}
	int did = 0;
	// if(cnt[0] >= 4) {
	// 	did = 3;
	// 	cnt[0] -= 4;
	// }
	for(int i = 0; i < n; i++) {
		int ans = 0;
		for(int j = 0; j < 4; j++) {
			ans |= ((cnt[i * 4 + j] ^ did) << (j * 2));
		}
		output(ans);
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 608 KB Error : Encoded message too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 644 KB Error : Encoded message too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 612 KB Error : Encoded message too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 3 ms 1048 KB Output is partially correct - P = 12.000000
2 Partially correct 3 ms 1200 KB Output is partially correct - P = 12.000000
3 Partially correct 3 ms 1068 KB Output is partially correct - P = 12.000000
4 Partially correct 5 ms 1352 KB Output is partially correct - P = 12.000000
5 Partially correct 7 ms 1376 KB Output is partially correct - P = 12.000000
6 Partially correct 8 ms 1348 KB Output is partially correct - P = 12.000000
7 Partially correct 7 ms 1368 KB Output is partially correct - P = 12.000000