Submission #151662

# Submission time Handle Problem Language Result Execution time Memory
151662 2019-09-04T04:08:12 Z rose0310 King of Chairs (FXCUP4_chairs) C++17
100 / 100
252 ms 6156 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 0;
}
#include "vassal.h"
#include<algorithm>
#include<iostream>
using namespace std;

long long BB,N;
std::vector<int>CC;
void Init(long long B, std::vector<int> C){
	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(), mid;
	while (l<r) {
		mid = (l+r) / 2;
		if (CC[mid] < W) l = mid + 1;
		else r = mid;
	//	cout << l << mid << r << endl;
	}
	while (r>0 && CC[r] == CC[r - 1]) r--;
	while (r<N && v[r]) r++;
	if (r >= N) return -1;
	v[r] = 1;
//	cout << "===" << r << endl;
	return r;
}

Compilation message

king.cpp: In function 'long long int SendInfo(std::vector<int>, std::vector<int>)':
king.cpp:8:12: warning: variable 'upper' set but not used [-Wunused-but-set-variable]
  long long upper = 0;
            ^~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 760 KB Correct
2 Correct 4 ms 760 KB Correct
3 Correct 4 ms 760 KB Correct
4 Correct 4 ms 776 KB Correct
5 Correct 4 ms 888 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 48 ms 3396 KB Correct
2 Correct 96 ms 5520 KB Correct
3 Correct 221 ms 6156 KB Correct
4 Correct 99 ms 6044 KB Correct
5 Correct 100 ms 5924 KB Correct
6 Correct 100 ms 6048 KB Correct
7 Correct 228 ms 6068 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 62 ms 3392 KB Correct
2 Correct 118 ms 5648 KB Correct
3 Correct 252 ms 6072 KB Correct
4 Correct 121 ms 5956 KB Correct
5 Correct 133 ms 5956 KB Correct
6 Correct 114 ms 5992 KB Correct
7 Correct 251 ms 5952 KB Correct
8 Correct 90 ms 5684 KB Correct