답안 #349647

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
349647 2021-01-18T05:34:11 Z amunduzbaev 최후의 만찬 (IOI12_supper) C++14
0 / 100
337 ms 20916 KB
#include <bits/stdc++.h>

#ifndef EVAL
#include "grader.cpp"
#endif
#include "advisor.h"
#include "assistant.h"

using namespace std;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(),x.rend()
#define fastios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define vll vector<ll>
#define vii vector<int>	
#define vpii vector<pii>
#define vpll vector<pll>
#define cnt(a)__builtin_popcount(a)
template<class T> bool umin(T& a, const T& b) {return a > b? a = b, true:false;}
template<class T> bool umax(T& a, const T& b) {return a < b? a = b, true:false;}
 
const int NN = 1e6+5;
const int mod = 1e9+7;
const ll inf = 1e18;
const ld Pi = acos(-1);
int a[NN], used[NN], fir[NN];

void ComputeAdvice(int *c, int n, int k, int m){
	memset(used, mod, sizeof used);
	memset(fir, mod, sizeof fir);
	for(int i=n-1;i>=0;i--){
		a[i] = used[c[i]];
		if(used[c[i]] == mod) fir[c[i]] = i;
		used[c[i]] = i;
	}
	memset(used, 0, sizeof used);
	set<pii> ss;
	for(int i=0;i<k;i++){
		ss.insert({fir[i], i});
		used[i] = 1;
	}
	string s;
	for(int i=0;i<n;i++){
		//for(auto x:ss) cout<<x.ss<<" ";
		//cout<<"\n";
		//for(int i=0;i<n;i++) cout<<used[i]<<" ";
		//cout<<"\n";
		if(used[c[i]]) { s.pb(1); WriteAdvice(1); continue; }
		else { s.pb(0); WriteAdvice(0); }
 		
		auto cur = --ss.end();
		ss.erase(cur);
		int l = 0, r = k-1;
		int need = (*cur).ss, cnt = 0;
		//cout<<need<<"\n";
		while(l < r){
			cnt++;
			int m = (l + r +1)>>1;
			if(m >= need) { s.pb(0); WriteAdvice(0); l = m; }
			else { s.pb(1); WriteAdvice(1); r = m-1; }
		}
		used[need] = 0;
		used[c[i]] = 1;
		ss.insert({a[c[i]], c[i]});
	}
	
	//for(int i=0;i<sz(s); i++) cout<<(int)s[i]<<" ";
	//cout<<"\n";
}

/*

4 2 12
2 0 3 0

*/
#include <bits/stdc++.h>

#ifndef EVAL
#include "grader.cpp"
#endif
#include "advisor.h"
#include "assistant.h"

using namespace std;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(),x.rend()
#define fastios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define vll vector<ll>
#define vii vector<int>	
#define vpii vector<pii>
#define vpll vector<pll>
#define cnt(a)__builtin_popcount(a)
template<class T> bool umin(T& a, const T& b) {return a > b? a = b, true:false;}
template<class T> bool umax(T& a, const T& b) {return a < b? a = b, true:false;}
 
const int NN = 1e6+5;
const int mod = 1e9+7;
const ll inf = 1e18;
const ld Pi = acos(-1);

void Assist(unsigned char *a, int n, int k, int r) {
	int last = 0;
	vector<int> cur;
	for(int i=0;i<k;i++) cur.pb(i);
	for(int i=0;i<n;i++){
		int nw = GetRequest();
		if(a[last]) { last++;  continue; }
		last++;
		int l = 0, r = k-1;
		while(l < r){
			int m = (l + r +1)>>1;
			if(a[last]) r = m-1;
			else l = m;
			last++;
		}
		PutBack(cur[l]);
		cur[l] = nw;
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 8760 KB Output is correct
2 Incorrect 5 ms 8680 KB Error - Not putting back color when it is not on the scaffold
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 30 ms 9880 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 284 ms 18688 KB Error - Not putting back color when it is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 8896 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 329 ms 20916 KB Error - Not putting back color when it is not on the scaffold
2 Incorrect 337 ms 20820 KB Error - Putting back a color when it is already on the scaffold
3 Incorrect 315 ms 20648 KB Error - Not putting back color when it is not on the scaffold
4 Incorrect 311 ms 20648 KB Error - Putting back a color when it is already on the scaffold
5 Incorrect 316 ms 20432 KB Error - Not putting back color when it is not on the scaffold
6 Incorrect 314 ms 20436 KB Error - Not putting back color when it is not on the scaffold
7 Incorrect 322 ms 20428 KB Error - Not putting back color when it is not on the scaffold
8 Incorrect 314 ms 20652 KB Error - Not putting back color when it is not on the scaffold
9 Incorrect 323 ms 20904 KB Error - Putting back a color when it is already on the scaffold
10 Incorrect 315 ms 20472 KB Error - Not putting back color when it is not on the scaffold