Submission #121320

# Submission time Handle Problem Language Result Execution time Memory
121320 2019-06-26T10:20:59 Z MAMBA Last supper (IOI12_supper) C++17
0 / 100
193 ms 23672 KB
#include <bits/stdc++.h>
#include "advisor.h"

#define rep(i , j , k) for (int i = j; i < k; i++)

using namespace std;

constexpr int MAXN = 2e5 + 10;

int ptr[MAXN];
vector<int> come[MAXN];
bitset<MAXN> a , b, mark;
set<pair<int , int>> st;

void ComputeAdvice(int *C, int N, int K, int M) {
	rep(i , 0 , N) {
		come[i].clear();
		ptr[i] = -1;
	}
	rep(i , 0 , K)
		come[i].push_back(-1);
	rep(i , 0 , N) come[C[i]].push_back(i);
	a.reset();
	b.reset();
	mark.reset();
	rep(i , 0 , K) {
		ptr[i]++;
		mark[i] = true;
		if (ptr[i] + 1 < come[i].size())
			st.insert({-come[i][ptr[i] + 1] , i});
		else st.insert({-1e9 , i});
	}
	rep(i , 0 , N) {
		ptr[C[i]]++;
		if (mark[C[i]]) continue;
		int v = st.begin()->second;
		st.erase(st.begin());
		mark[v] = false;
      mark[C[i]] = true;
		if (come[v][ptr[v]] == -1)
			a[v] = true;
		else b[come[v][ptr[v]]] = true;
		if (ptr[C[i]] + 1 < come[C[i]].size())
			st.insert({-come[C[i]][ptr[C[i]] + 1] , C[i]});
		else st.insert({-1e9 , C[i]});
	}
	for (auto e : st) {
		int v = e.second;
		if (come[v][ptr[v]] == -1)
			a[v] = true;
		else b[come[v][ptr[v]]] = true;
	}
	rep(i , 0 , K)
		WriteAdvice(a[i]);
	rep(i , 0 , N)
		WriteAdvice(b[i]);
	return;
}
#include <bits/stdc++.h>
#include "assistant.h"

#define rep(i , j , k) for (int i = j; i < k; i++)

using namespace std;

constexpr int MAXN = 2e5 + 10;

bitset<MAXN> a_ , b_, mark_;
int q[MAXN], l , r;

void Assist(unsigned char *A, int N, int K, int R) {
	l = r = 0;
	mark_.reset();
	a_.reset();
	b_.reset();
	rep(i , 0 , K) mark_[i] = true;
	rep(i , 0 , K)
		if (A[i])
			a_[i] = true;
	rep(i , 0 , N)
		if (A[i + K])
			b_[i] = true;
	rep(i , 0 , K)
		if (a_[i]) q[r++] = i;
	rep(i , 0 , N) {
		int v = GetRequest();
		if (b_[i]) q[r++] = v;
      	if (mark_[v]) continue;
		PutBack(q[l]);
		mark_[q[l++]] = false;
		mark_[v] = true;
	}
}

Compilation message

advisor.cpp: In function 'void ComputeAdvice(int*, int, int, int)':
advisor.cpp:29:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (ptr[i] + 1 < come[i].size())
       ~~~~~~~~~~~^~~~~~~~~~~~~~~~
advisor.cpp:43:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (ptr[C[i]] + 1 < come[C[i]].size())
       ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 8 ms 10240 KB Output is correct
2 Incorrect 8 ms 10240 KB Output isn't correct - not an optimal way
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 11264 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 86 ms 19432 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 10752 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 104 ms 21256 KB Error - Putting back a color that is not on the scaffold
2 Incorrect 106 ms 21296 KB Error - Putting back a color that is not on the scaffold
3 Incorrect 102 ms 21592 KB Output isn't correct - not an optimal way
4 Incorrect 111 ms 21744 KB Output isn't correct - not an optimal way
5 Incorrect 193 ms 22000 KB Output isn't correct - not an optimal way
6 Incorrect 119 ms 22000 KB Output isn't correct - not an optimal way
7 Incorrect 111 ms 22000 KB Output isn't correct - not an optimal way
8 Incorrect 106 ms 21744 KB Output isn't correct - not an optimal way
9 Incorrect 117 ms 21872 KB Output isn't correct - not an optimal way
10 Correct 102 ms 23672 KB Output is correct - 125000 bits used