Submission #151661

# Submission time Handle Problem Language Result Execution time Memory
151661 2019-09-04T04:07:32 Z rose0310 King of Chairs (FXCUP4_chairs) C++17
95 / 100
244 ms 6212 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 1;
}
#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 772 KB Correct
2 Correct 4 ms 984 KB Correct
3 Correct 4 ms 864 KB Correct
4 Correct 4 ms 760 KB Correct
5 Correct 4 ms 760 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 48 ms 3376 KB Correct
2 Correct 94 ms 5360 KB Correct
3 Correct 218 ms 6048 KB Correct
4 Correct 93 ms 6056 KB Correct
5 Correct 100 ms 5980 KB Correct
6 Correct 100 ms 5912 KB Correct
7 Correct 223 ms 6192 KB Correct
# Verdict Execution time Memory Grader output
1 Partially correct 60 ms 3604 KB B = 1
2 Partially correct 112 ms 5808 KB B = 1
3 Partially correct 244 ms 5944 KB B = 1
4 Partially correct 122 ms 6092 KB B = 1
5 Partially correct 131 ms 5972 KB B = 1
6 Partially correct 113 ms 6212 KB B = 1
7 Partially correct 244 ms 5980 KB B = 1
8 Partially correct 89 ms 5688 KB B = 1