Submission #759927

# Submission time Handle Problem Language Result Execution time Memory
759927 2023-06-17T05:15:45 Z denniskim King of Chairs (FXCUP4_chairs) C++17
100 / 100
129 ms 39272 KB
#include "king.h"
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef __int128 lll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
#define MAX 9223372036854775807LL
#define MIN -9223372036854775807LL
#define INF 0x3f3f3f3f3f3f3f3f
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cout << fixed; cout.precision(10);
#define sp << " "
#define en << "\n"
#define compress(v) sort(v.begin(), v.end()), v.erase(unique(v.begin(), v.end()), v.end())

ll SendInfo(vector<int> W, vector<int> C)
{
	return 0;
}
#include "vassal.h"
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef __int128 lll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
#define MAX 9223372036854775807LL
#define MIN -9223372036854775807LL
#define INF 0x3f3f3f3f3f3f3f3f
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cout << fixed; cout.precision(10);
#define sp << " "
#define en << "\n"
#define compress(v) sort(v.begin(), v.end()), v.erase(unique(v.begin(), v.end()), v.end())

ll BB;
multiset<int> st;
vector<ll> vec[1000010];

void Init(ll B, vector<int> C)
{
	int N = C.size();
	BB = B;
	
	for(ll i = 0 ; i < N ; i++)
	{
		st.insert(C[i]);
		vec[C[i]].push_back(i);
	}
}

int Maid(int W)
{
	auto p = st.lower_bound(W);
	
	if(p == st.end())
		return -1;
	
	ll gap = (*p);
	
	st.erase(st.find(gap));
	
	ll ww = vec[gap].back();
	vec[gap].pop_back();
	
	return (int)ww;
}
# Verdict Execution time Memory Grader output
1 Correct 13 ms 24072 KB Correct
2 Correct 12 ms 24076 KB Correct
3 Correct 13 ms 24064 KB Correct
4 Correct 12 ms 24056 KB Correct
5 Correct 13 ms 24096 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 51 ms 31800 KB Correct
2 Correct 87 ms 37844 KB Correct
3 Correct 81 ms 39128 KB Correct
4 Correct 87 ms 39056 KB Correct
5 Correct 90 ms 39016 KB Correct
6 Correct 83 ms 39124 KB Correct
7 Correct 82 ms 39076 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 64 ms 31784 KB Correct
2 Correct 120 ms 38028 KB Correct
3 Correct 110 ms 39088 KB Correct
4 Correct 121 ms 39100 KB Correct
5 Correct 116 ms 39272 KB Correct
6 Correct 129 ms 39164 KB Correct
7 Correct 98 ms 39068 KB Correct
8 Correct 76 ms 38708 KB Correct