답안 #382798

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
382798 2021-03-28T08:28:22 Z alireza_kaviani 최후의 만찬 (IOI12_supper) C++11
0 / 100
140 ms 14572 KB
#include <bits/stdc++.h>
#include "advisor.h"

using namespace std;

typedef pair<int, int> pii;

#define X			first
#define Y			second

const int MAXN = 2e5 + 10;
const int MOD = 1e9 + 7;

int mark[MAXN] , res[MAXN];
vector<int> vec[MAXN];
set<pii , greater<pii>> st;

void ComputeAdvice(int *C, int N, int K, int M) {
	for(int i = 0 ; i < N ; i++)	vec[i].push_back(MAXN);
	for(int i = N - 1 ; i >= 0 ; i--){
		vec[C[i]].push_back(i);
	}
	for(int i = 0 ; i < K ; i++){
		st.insert({vec[i].back() , i});
	}
	for(int i = 0 ; i < N ; i++){
		auto it = st.lower_bound({i , MOD});
		if(it != st.end() && (*it).X == i){
			res[(*it).Y] = 1;
			st.erase(it);
			vec[C[i]].pop_back();
			st.insert({vec[C[i]].back() , i + K});
		}
		else{
			vec[C[i]].pop_back();
			st.insert({vec[C[i]].back() , i + K});
			st.erase(st.begin());
		}
	}
	for(int i = 0 ; i < N + K ; i++)	WriteAdvice(res[i]);
}
#include <bits/stdc++.h>
#include "assistant.h"

using namespace std;

#define sep			' '

set<int> st0 , st1;

void Assist(unsigned char *A, int N, int K, int R) {
	for(int i = 0 ; i < K ; i++){
//		cout << i << sep << (int)A[i] << endl;
		if(A[i] == 0)	st0.insert(i);
		else	st1.insert(i);
	}
	for(int i = 0 ; i < N ; i++){
		int cur = GetRequest();
		st0.erase(cur);
		st1.erase(cur);
//		cout << i + K << sep << (int)A[i + K] << endl;
		if(A[i + K] == 0)	st0.insert(cur);
		if(A[i + K] == 1)	st1.insert(cur);
		if(st0.size() + st1.size() == K)	continue;
		assert(st0.size() + st1.size() == K + 1);
		PutBack((*st0.begin()));
//		cout << i << ' ' << (*st0.begin()) << endl;
		st0.erase(st0.begin());
	}
}

Compilation message

assistant.cpp: In function 'void Assist(unsigned char*, int, int, int)':
assistant.cpp:23:30: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   23 |   if(st0.size() + st1.size() == K) continue;
      |      ~~~~~~~~~~~~~~~~~~~~~~~~^~~~
In file included from /usr/include/c++/9/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
                 from assistant.cpp:1:
assistant.cpp:24:34: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   24 |   assert(st0.size() + st1.size() == K + 1);
      |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 5348 KB Output is correct
2 Incorrect 5 ms 5348 KB Error - Putting back a color that is not on the scaffold
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 15 ms 6188 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 120 ms 12436 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 5764 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 131 ms 14136 KB Error - Putting back a color that is not on the scaffold
2 Incorrect 132 ms 14008 KB Error - Putting back a color that is not on the scaffold
3 Incorrect 140 ms 14572 KB Error - Putting back a color that is not on the scaffold
4 Incorrect 140 ms 14268 KB Error - Putting back a color that is not on the scaffold
5 Incorrect 138 ms 14484 KB Error - Putting back a color that is not on the scaffold
6 Incorrect 137 ms 14512 KB Error - Putting back a color that is not on the scaffold
7 Incorrect 137 ms 14440 KB Error - Putting back a color that is not on the scaffold
8 Incorrect 134 ms 14268 KB Error - Putting back a color that is not on the scaffold
9 Incorrect 139 ms 14436 KB Error - Putting back a color that is not on the scaffold
10 Incorrect 114 ms 13884 KB Error - Putting back a color that is not on the scaffold