Submission #363094

#TimeUsernameProblemLanguageResultExecution timeMemory
3630948e7Last supper (IOI12_supper)C++14
20 / 100
528 ms21084 KiB
//Challenge: Accepted
#include "advisor.h"
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>
#include <queue>
#define ll long long
#define maxn 100005
#define mod 1000000000
#define pii pair<int, int>
#define ff first
#define ss second
#define io ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;

int hbit(int x) {
	int ret = 0;
	while (x) {
		ret++, x >>= 1;
	}
	return ret;
}
void ComputeAdvice(int *C, int N, int K, int M) {
	int bit = max(1, hbit(N - 1));
	for (int i = 0;i < N;i++) {
		for (int j = 0;j < bit;j++) {
			WriteAdvice((C[i] & (1<<j)) ? 1 : 0);
		}
	}
}
//Challenge: Accepted
#include "assistant.h"
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>
#include <queue>
#define ll long long
#define maxn 100005
#define mod 1000000000
#define pii pair<int, int>
#define ff first
#define ss second
#define io ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
namespace {
int hbit(int x) {
	int ret = 0;
	while (x) {
		ret++, x >>= 1;
	}
	return ret;
}
int a[maxn], ind[maxn];
vector<int> ti[maxn];
bool found[maxn];
set<pii> se;
}

void Assist(unsigned char *A, int N, int K, int R) {
	int bit = max(1, hbit(N - 1));
	int id = 0;
	for (int i = 0;i < N;i++) {
		for (int j = 0;j < bit;j++) {
			a[i] += A[id] ? (1<<j) : 0;
			id++;
		}
		ti[a[i]].push_back(i);
	}
	for (int i = 0;i < N;i++) ti[i].push_back(1<<30);
	for (int i = 0;i < K;i++) {
		se.insert(make_pair(ti[i][0], i));
	}
	for (int i = 0;i < N;i++) {
		int x = GetRequest();
		if ((*se.begin()).ff == i) {
			pii cur = *se.begin();
			se.erase(se.begin());

			ind[cur.ss]++;
			cur.ff = ti[cur.ss][ind[cur.ss]];
			se.insert(cur);
		} else {
			pii cur = *prev(se.end());
			PutBack(cur.ss);
			se.erase(prev(se.end()));

			ind[x]++;
			se.insert(make_pair(ti[x][ind[x]], x));
		}
	}
}

Compilation message (stderr)

assistant.cpp:27:6: warning: '{anonymous}::found' defined but not used [-Wunused-variable]
   27 | bool found[maxn];
      |      ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...