답안 #148808

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
148808 2019-09-01T05:09:37 Z 욱방켜!! (twitch.tv/wookje)(#3584, kig9981, cheetose, jh05013) King of Chairs (FXCUP4_chairs) C++17
95 / 100
182 ms 15616 KB
#include "king.h"
#include <bits/stdc++.h>

long long SendInfo(std::vector<int> W, std::vector<int> C) {
	int N = W.size();
	std::multiset<int> CC(C.begin(),C.end());
	std::sort(W.begin(),W.end());
	std::sort(C.begin(),C.end());
	for(int i=0;i<N;i++) {
		auto it=CC.lower_bound(W[i]);
		if(it==CC.end()) {
			if(i) return lower_bound(C.begin(),C.end(),W[i-1])-C.begin();
			return 0;
		}
		CC.erase(it);
	}
	return N-1;
}
#include "vassal.h"
#include <bits/stdc++.h>

long long BB;
int N;
std::set<std::pair<int,int>> S;
std::vector<int> CC;

void Init(long long B, std::vector<int> C){
	N = C.size();
	BB = B;
	CC=C;
	std::sort(CC.begin(),CC.end());
	for(int i=0;i<N;i++) S.insert({C[i],i});
}

int Maid(int W){
	int ret;
	auto it=S.lower_bound(std::make_pair(W,-1));
	if(BB<N && W>CC[BB] || it==S.end()) return -1;
	ret=it->second;
	S.erase(it);
	return ret;
}

Compilation message

vassal.cpp: In function 'int Maid(int)':
vassal.cpp:20:10: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
  if(BB<N && W>CC[BB] || it==S.end()) return -1;
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 1048 KB Correct
2 Correct 10 ms 1044 KB Correct
3 Correct 10 ms 972 KB Correct
4 Correct 10 ms 1044 KB Correct
5 Correct 10 ms 528 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 76 ms 7952 KB Correct
2 Correct 124 ms 14156 KB Correct
3 Correct 132 ms 15604 KB Correct
4 Correct 134 ms 15340 KB Correct
5 Correct 136 ms 15336 KB Correct
6 Correct 137 ms 15348 KB Correct
7 Correct 136 ms 15604 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 90 ms 8576 KB B = 50983
2 Partially correct 159 ms 14168 KB B = 91396
3 Partially correct 164 ms 15352 KB B = 91327
4 Partially correct 175 ms 15608 KB B = 99838
5 Partially correct 170 ms 15616 KB B = 99579
6 Partially correct 182 ms 15084 KB B = 99741
7 Partially correct 161 ms 15440 KB B = 91342
8 Correct 142 ms 15592 KB Correct