Submission #150997

# Submission time Handle Problem Language Result Execution time Memory
150997 2019-09-01T14:12:35 Z JustInCase King of Chairs (FXCUP4_chairs) C++17
100 / 100
177 ms 12608 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 0;
}
#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 >= 0; 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 632 KB Correct
2 Correct 4 ms 800 KB Correct
3 Correct 4 ms 632 KB Correct
4 Correct 4 ms 760 KB Correct
5 Correct 4 ms 764 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 5424 KB Correct
2 Correct 101 ms 11340 KB Correct
3 Correct 108 ms 10208 KB Correct
4 Correct 110 ms 12268 KB Correct
5 Correct 109 ms 12096 KB Correct
6 Correct 113 ms 12060 KB Correct
7 Correct 107 ms 12224 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 76 ms 7004 KB Correct
2 Correct 143 ms 11440 KB Correct
3 Correct 138 ms 12336 KB Correct
4 Correct 159 ms 12160 KB Correct
5 Correct 157 ms 12156 KB Correct
6 Correct 177 ms 12352 KB Correct
7 Correct 137 ms 12608 KB Correct
8 Correct 112 ms 12336 KB Correct