답안 #152847

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
152847 2019-09-10T05:34:00 Z qkxwsm 최후의 만찬 (IOI12_supper) C++14
0 / 100
2500 ms 7012 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()
#define MAXN 1000013

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;

int pos[MAXN];
bitset<MAXN> important;

void ComputeAdvice(int *C, int N, int K, int M)
{
	//some guys you get are "useless", some guys are not
	FOR(i, 0, N) pos[i] = -1;
	FOR(i, 0, K) pos[i] = i;
	FOR(i, 0, N)
	{
		int x = C[i]; //does this guy exist?
		if (pos[x] != -1)
		{
			important[pos[x]] = true;
		}
		pos[x] = i + K;
	}
	FOR(i, 0, N + K)
	{
		WriteAdvice((important[i] ? 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 1000013

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;

int arr[MAXN];
set<int> useful, useless;

void Assist(unsigned char *A, int N, int K, int R)
{
	FOR(i, 0, K)
	{
		arr[i] = i;
		if (A[i])
		{
			useful.insert(i);
		}
		else
		{
			useless.insert(i);
		}
	}
	FOR(i, 0, N)
	{
		int cur = GetRequest();
		arr[i + K] = cur;
		if (useful.find(cur) == useful.end())
		{
			int x = *useless.begin();
			useless.erase(useless.begin());
			PutBack(x);
		}
		else
		{
			useful.erase(cur);
		}
		if (A[i + K])
		{
			useful.insert(cur);
		}
		else
		{
			useless.insert(cur);
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 884 KB Output is correct
2 Correct 4 ms 756 KB Output is correct
3 Correct 5 ms 852 KB Output is correct
4 Execution timed out 2563 ms 804 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2510 ms 1288 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 100 ms 5472 KB Output is correct
2 Correct 127 ms 6652 KB Output is correct
3 Correct 127 ms 6712 KB Output is correct
4 Correct 136 ms 6752 KB Output is correct
5 Execution timed out 2581 ms 6244 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 932 KB Output is correct
2 Execution timed out 2536 ms 956 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2572 ms 6128 KB Time limit exceeded
2 Correct 126 ms 6632 KB Output is correct - 122000 bits used
3 Correct 126 ms 7012 KB Output is correct - 125000 bits used
4 Correct 127 ms 6820 KB Output is correct - 125000 bits used
5 Correct 132 ms 6912 KB Output is correct - 125000 bits used
6 Correct 126 ms 6924 KB Output is correct - 125000 bits used
7 Correct 149 ms 6776 KB Output is correct - 124828 bits used
8 Correct 129 ms 6880 KB Output is correct - 124910 bits used
9 Correct 127 ms 6768 KB Output is correct - 125000 bits used
10 Execution timed out 2577 ms 6452 KB Time limit exceeded