Submission #152810

# Submission time Handle Problem Language Result Execution time Memory
152810 2019-09-09T15:51:48 Z qkxwsm Last supper (IOI12_supper) C++14
20 / 100
426 ms 17028 KB
#include "advisor.h"
#include <bits/stdc++.h>

using namespace std;

template<class T, class U>
void ckmin(T &a, U b)
{
	if (a > b) a = b;
}
template<class T, class U>
void ckmax(T &a, U b)
{
	if (a < b) a = b;
}

#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--)
#define SZ(x) ((int) ((x).size()))
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;



void ComputeAdvice(int *C, int N, int K, int M)
{
	//ugh lol ok lets brute force.
	int B = 32 - __builtin_clz(N);
	FOR(i, 0, N)
	{
		FORD(j, B, 0)
		{
			WriteAdvice((C[i] & (1 << j)) ? 1 : 0);
		}
	}
}
#include "assistant.h"
#include <bits/stdc++.h>

using namespace std;

template<class T, class U>
void ckmin(T &a, U b)
{
	if (a > b) a = b;
}
template<class T, class U>
void ckmax(T &a, U b)
{
	if (a < b) a = b;
}

#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--)
#define SZ(x) ((int) ((x).size()))
#define ALL(x) (x).begin(), (x).end()
#define MAXN 100013

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;

set<pii> alive;
int arr[MAXN];
int rt[MAXN], pos[MAXN];

void Assist(unsigned char *A, int N, int K, int R)
{
	int B = 32 - __builtin_clz(N);
	FOR(i, 0, N)
	{
		int num = 0;
		FOR(j, i * B, (i + 1) * B)
		{
			num *= 2; if (A[j]) num++;
		}
		arr[i] = num;
		// cerr << "arr " << i << " = " << num << endl;
	}
	FOR(i, 0, N)
	{
		pos[i] = N;
	}
	FORD(i, N, 0)
	{
		// cerr << "pos " << arr[i] << " set to " << i << endl;
		rt[i] = pos[arr[i]];
		pos[arr[i]] = i;
	}
	// FOR(i, 0, N)
	// {
	// 	cerr << pos[i] << ' ';
	// }
	// cerr << endl;
	FOR(i, 0, K)
	{
		// cerr << pos[i] << ' ';
		alive.insert({pos[i], i});
	}
	// cerr << endl;
	FOR(i, 0, N)
	{
		int cur = GetRequest();
		if (alive.find({pos[cur], cur}) == alive.end())
		{
			auto it = prev(alive.end());
			PutBack(it -> se);
			alive.erase(it);
			alive.insert({pos[cur], cur});
		}
		alive.erase({pos[cur], cur});
		pos[cur] = rt[i];
		alive.insert({pos[cur], cur});
	}
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 768 KB Output is correct
2 Correct 4 ms 632 KB Output is correct
3 Correct 6 ms 916 KB Output is correct
4 Correct 12 ms 1116 KB Output is correct
5 Correct 19 ms 1312 KB Output is correct
6 Correct 19 ms 1312 KB Output is correct
7 Correct 20 ms 1424 KB Output is correct
8 Correct 19 ms 1448 KB Output is correct
9 Correct 20 ms 1312 KB Output is correct
10 Correct 20 ms 1444 KB Output is correct
11 Correct 19 ms 1312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 37 ms 2000 KB Output is correct
2 Correct 190 ms 8012 KB Output is correct
3 Correct 406 ms 17028 KB Output is correct
4 Correct 375 ms 15456 KB Output is correct
5 Correct 379 ms 15336 KB Output is correct
6 Correct 393 ms 15636 KB Output is correct
7 Correct 414 ms 16476 KB Output is correct
8 Correct 337 ms 14240 KB Output is correct
9 Correct 367 ms 15064 KB Output is correct
10 Correct 422 ms 16892 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 323 ms 12304 KB Output is correct
2 Incorrect 25 ms 5616 KB Error - advice is too long
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 752 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 412 ms 15156 KB Output is partially correct - 1700000 bits used
2 Correct 408 ms 15424 KB Output is partially correct - 1700000 bits used
3 Correct 415 ms 15480 KB Output is partially correct - 1700000 bits used
4 Correct 426 ms 15476 KB Output is partially correct - 1700000 bits used
5 Correct 420 ms 15344 KB Output is partially correct - 1700000 bits used
6 Correct 410 ms 15688 KB Output is partially correct - 1700000 bits used
7 Correct 414 ms 15476 KB Output is partially correct - 1697263 bits used
8 Correct 411 ms 15484 KB Output is partially correct - 1700000 bits used
9 Correct 410 ms 15500 KB Output is partially correct - 1700000 bits used
10 Correct 394 ms 15372 KB Output is partially correct - 1700000 bits used