Submission #150979

# Submission time Handle Problem Language Result Execution time Memory
150979 2019-09-01T13:50:25 Z JustInCase King of Chairs (FXCUP4_chairs) C++17
78 / 100
157 ms 13004 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

const int32_t MAX_N = 1e5;

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 >= 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;
}

Compilation message

vassal.cpp: In function 'void Init(long long int, std::vector<int>)':
vassal.cpp:14:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int32_t i = c.size() - 1; i >= c.size() - b; i--) {
                                ~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 11 ms 2940 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 56 ms 7020 KB Correct
2 Correct 99 ms 11924 KB Correct
3 Correct 89 ms 10508 KB Correct
4 Correct 111 ms 12792 KB Correct
5 Correct 109 ms 12780 KB Correct
6 Correct 110 ms 12772 KB Correct
7 Correct 89 ms 10648 KB Correct
# Verdict Execution time Memory Grader output
1 Partially correct 78 ms 7180 KB B = 50991
2 Partially correct 141 ms 12044 KB B = 91406
3 Partially correct 110 ms 10548 KB B = 49847
4 Partially correct 155 ms 13004 KB B = 99850
5 Partially correct 157 ms 12820 KB B = 99598
6 Partially correct 154 ms 12944 KB B = 99746
7 Partially correct 110 ms 10640 KB B = 49910
8 Correct 84 ms 8172 KB Correct