Submission #149030

# Submission time Handle Problem Language Result Execution time Memory
149030 2019-09-01T05:36:31 Z =SUM(D1:D9)(#3629, ydk1104, stet_stet, Hyperbolic) King of Chairs (FXCUP4_chairs) C++17
95 / 100
194 ms 11992 KB
#include "king.h"
#include <algorithm>

long long SendInfo(std::vector<int> W, std::vector<int> C) {
	int N = W.size();
	std::sort(W.begin(),W.end());
	std::sort(C.begin(),C.end());
	
	int min = 0, max = N;
	int ans = 0;
	
	while(min<=max)
	{
		int h = (min+max)/2;
		for(int i=0;i<h;i++) if(W[i]>C[N+i-h]) goto u;
		ans = h;
		min = h+1;
		continue;
		u:;
		max = h-1;
	}
	if(ans==0) return 0;
	else return W[ans-1];
}
#include "vassal.h"
#include <algorithm>
#include <map>

std::multimap<long long int,int> M;

long long limit;
int check[100010];

bool cmp(std::pair<int,int> A, std::pair<int,int> B)
{
	return A.first<B.first;
}

void Init(long long B, std::vector<int> C){
	int N = C.size();
	limit = B;
	
	for(int i=0;i<N;i++) M.insert(std::make_pair(C[i],i));
}

int Maid(int W){
	if(W>limit) return -1;
	else
	{
		std::map<long long int,int> ::iterator it;
		it = M.lower_bound(W);
		if(it==M.end()) return -1;
		else
		{
			int ans = it->second;
			M.erase(it);
			return ans;
		}
	}
}
# Verdict Execution time Memory Grader output
1 Correct 10 ms 1056 KB Correct
2 Correct 10 ms 1056 KB Correct
3 Correct 10 ms 1052 KB Correct
4 Correct 12 ms 1060 KB Correct
5 Correct 11 ms 1060 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 67 ms 6728 KB Correct
2 Correct 117 ms 11048 KB Correct
3 Correct 137 ms 11980 KB Correct
4 Correct 128 ms 11984 KB Correct
5 Correct 126 ms 11732 KB Correct
6 Correct 124 ms 11984 KB Correct
7 Correct 124 ms 11984 KB Correct
# Verdict Execution time Memory Grader output
1 Partially correct 83 ms 6200 KB B = 993847
2 Partially correct 155 ms 11048 KB B = 996200
3 Partially correct 151 ms 11988 KB B = 706116
4 Partially correct 189 ms 11976 KB B = 998466
5 Partially correct 169 ms 11476 KB B = 995867
6 Partially correct 194 ms 11980 KB B = 997501
7 Partially correct 143 ms 11992 KB B = 706123
8 Correct 124 ms 11980 KB Correct