답안 #104842

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
104842 2019-04-09T11:02:25 Z figter001 최후의 만찬 (IOI12_supper) C++17
0 / 100
93 ms 15632 KB
#include "advisor.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const int nax = 1e5 + 50;
const int oo = 1e9;

vector<int> lst[nax];
set<pair<int,int>> st;
bool in[nax],rem[nax];

void ComputeAdvice(int *C, int n, int k, int M) {
	printf("Done\n");
	for(int i=0;i<n;i++)
		lst[i].push_back(oo);
	for(int i=n-1;i>=0;i--)
		lst[C[i]].push_back(i);
	for(int i=0;i<k;i++){
		st.insert({-lst[i].back(),i});
		lst[i].pop_back();
		in[i] = 1;
	}
	printf("Done\n");
	vector<pair<int,int>> w;

	for(int i=0;i<n;i++){
		if(in[C[i]] == 1){
			w.push_back({1,-1});
			st.erase(st.end());
			int id = C[i];
			st.insert({-lst[id].back(),id});
			lst[id].pop_back();
		}else{
			w.push_back({0,C[i]});
			int id = st.begin()->second;
			in[id] = 0;
			in[C[i]] = 1;
			if(id <= k)
				rem[id] = 1;
			st.erase(st.begin());
			st.insert({-lst[id].back(),id});
			lst[id].pop_back();
		}
	}
	for(int i=n-1;i>=0;i--){
		if(w[i].first == 0){
			w[i].second = in[C[i]];
			in[C[i]] = 0;
		}
	}
	for(int i=0;i<k;i++)
		WriteAdvice(rem[i]);

	for(int i=0;i<n;i++){
		if(w[i].first == 1){
			WriteAdvice(1);
		}else{
			WriteAdvice(0);
			WriteAdvice(w[i].second);
		}
	}
	printf("Done\n");
}
#include "assistant.h"
#include "advisor.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const int nax = 1e5 + 50;
const int oo = 1e9;

void Assist(unsigned char *A, int n, int k, int R) {
	int at = 0;
	vector<int> r;
	for(int i=0;i<k;i++){
		if(A[at] == '1')
			r.push_back(i);
		at++;
	}
	for(int i=0;i<n;i++){
    	int req = GetRequest();
    	if(A[at] == '0'){
    		at++;
    		PutBack(r.back());
    		r.pop_back();
    		if(A[at] == '0')
    			r.push_back(req);
    	}
      	at++;
  	}

}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 12 ms 5376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 14 ms 6400 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 53 ms 13560 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 25 ms 5752 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 60 ms 15120 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 68 ms 15348 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 62 ms 15608 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 80 ms 15604 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 93 ms 15632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 58 ms 15568 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 71 ms 15616 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 65 ms 15608 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 60 ms 15484 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 86 ms 15480 KB Execution killed with signal 11 (could be triggered by violating memory limits)