답안 #151659

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
151659 2019-09-04T03:59:40 Z rose0310 King of Chairs (FXCUP4_chairs) C++17
55 / 100
149 ms 6104 KB
#include "king.h"
#include<algorithm>
#include<iostream>
using namespace std;

long long SendInfo(std::vector<int> W, std::vector<int> C) {
	int N = W.size();
	long long upper = 0;
	sort(W.begin(), W.end());
	sort(C.begin(), C.end());
	int cnt = 0;
	for (auto i : W) {
		while (cnt<N && i > C[cnt]) cnt++;
		if (cnt < N && i <= C[cnt]) { upper = i; cnt++; }
		if (cnt >= N) break;
	}
//	cout<<"*"<<upper<<endl;
	return upper;
}
#include "vassal.h"
#include<algorithm>
#include<iostream>
using namespace std;

long long BB;
std::vector<int>CC;
void Init(long long B, std::vector<int> C){
	int N = C.size();
	BB = B;
	CC= C;
	sort(CC.begin(), CC.end());
}

bool v[101010];
int Maid(int W){
	if (BB < W) return -1;
	int l=0, r=CC.size()-1, mid;
	while (l<r) {
		mid = (l+r) / 2;
		//cout << l << mid << r << endl;
		if (CC[mid] < W) l = mid + 1;
		else r = mid;
	}
	while (r>0 && CC[r] == CC[r - 1]) r--;
	while (v[r]) r++;
	v[r] = 1;
	//cout << "===" << r << endl;
	return r;
}

Compilation message

vassal.cpp: In function 'void Init(long long int, std::vector<int>)':
vassal.cpp:9:6: warning: unused variable 'N' [-Wunused-variable]
  int N = C.size();
      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 760 KB Correct
2 Correct 4 ms 632 KB Correct
3 Correct 4 ms 632 KB Correct
4 Correct 4 ms 892 KB Correct
5 Correct 4 ms 632 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 3384 KB Correct
2 Correct 95 ms 5580 KB Correct
3 Correct 132 ms 6088 KB Correct
4 Correct 93 ms 5908 KB Correct
5 Correct 100 ms 6048 KB Correct
6 Correct 100 ms 5920 KB Correct
7 Correct 134 ms 5960 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 58 ms 3412 KB B = 993847
2 Partially correct 112 ms 5680 KB B = 996200
3 Partially correct 149 ms 6104 KB B = 706116
4 Runtime error 123 ms 6016 KB Execution failed because the return code was nonzero
5 Halted 0 ms 0 KB -