Submission #759927

#TimeUsernameProblemLanguageResultExecution timeMemory
759927denniskimKing of Chairs (FXCUP4_chairs)C++17
100 / 100
129 ms39272 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...