Submission #150995

# Submission time Handle Problem Language Result Execution time Memory
150995 2019-09-01T14:09:33 Z JustInCase King of Chairs (FXCUP4_chairs) C++17
95 / 100
157 ms 12656 KB
#include <bits/stdc++.h>
#include "king.h"

#define send_info SendInfo
#define int32_t int
#define int64_t long long

int64_t send_info(std::vector< int32_t > w, std::vector< int32_t > c) {
	std::sort(w.begin(), w.end());

	int32_t indW = w.size() - 1, indC = c.size() - 1, ans = 0;
	while(indW >= 0 && indC >= 0) {	
		if(c[indC] >= w[indW]) {
			ans++;
			indW--;
			indC--;
		}
		else {
			indW--;
		}
	}

	return ans;
}
#include <bits/stdc++.h>
#include "vassal.h"

#define init Init
#define maid Maid
#define int32_t int
#define int64_t long long

std::set< std::pair< int32_t, int32_t > > s;

void init(int64_t b, std::vector< int32_t > c) {
	for(int32_t i = c.size() - 1; i >= (int32_t) c.size() - b; i--) {
		s.insert({ c[i], i });
	}
}

int32_t maid(int32_t w) {
	auto it = s.lower_bound({ w, 0 });
	if(it != s.end()) {
		int32_t ans = it->second;
		s.erase(it);
		return ans;
	}

	return -1;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 916 KB Correct
2 Correct 4 ms 892 KB Correct
3 Correct 4 ms 864 KB Correct
4 Correct 4 ms 896 KB Correct
5 Correct 4 ms 768 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 6880 KB Correct
2 Correct 105 ms 11632 KB Correct
3 Correct 88 ms 10252 KB Correct
4 Correct 110 ms 12316 KB Correct
5 Correct 110 ms 12316 KB Correct
6 Correct 110 ms 12312 KB Correct
7 Correct 90 ms 10424 KB Correct
# Verdict Execution time Memory Grader output
1 Partially correct 75 ms 7000 KB B = 50991
2 Partially correct 138 ms 11600 KB B = 91406
3 Partially correct 111 ms 10196 KB B = 49847
4 Partially correct 157 ms 12488 KB B = 99850
5 Partially correct 157 ms 12656 KB B = 99598
6 Partially correct 154 ms 12572 KB B = 99746
7 Partially correct 111 ms 10200 KB B = 49910
8 Correct 83 ms 7740 KB Correct