Submission #229256

# Submission time Handle Problem Language Result Execution time Memory
229256 2020-05-03T23:49:22 Z 534351 King of Chairs (FXCUP4_chairs) C++17
100 / 100
134 ms 13220 KB
#include "king.h"
#include <bits/stdc++.h>

using namespace std;

template<class T, class U>
void ckmin(T &a, U b)
{
    if (a > b) a = b;
}

template<class T, class U>
void ckmax(T &a, U b)
{
    if (a < b) a = b;
}

#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define SZ(x) ((int) (x).size())
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--)

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;

ll SendInfo(vi w, vi c)
{
    return 0;
	// int N = W.size();
	// return W[0]*100 + W[1]*10 + W[2]*1;
}
#include "vassal.h"
#include <bits/stdc++.h>

using namespace std;

template<class T, class U>
void ckmin(T &a, U b)
{
    if (a > b) a = b;
}

template<class T, class U>
void ckmax(T &a, U b)
{
    if (a < b) a = b;
}

#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define SZ(x) ((int) (x).size())
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--)

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;

const int MAXN = 100013;

int N;
set<pii> rem;

void Init(long long B, std::vector<int> C)
{
    N = SZ(C);
    FOR(i, 0, N)
    {
        int x = C[i];
        rem.insert({x, i});
    }
	// int N = C.size();
	// BB = B;
	// ToDo
}

int Maid(int w)
{
    auto it = rem.LB({w, -1});
    if (it == rem.end()) return -1;
    int res = it -> se;
    rem.erase(it);
    return res;
	// if(W == BB%10) return 2;
	// if(W == BB/100) return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 9 ms 776 KB Correct
2 Correct 9 ms 776 KB Correct
3 Correct 9 ms 784 KB Correct
4 Correct 8 ms 784 KB Correct
5 Correct 8 ms 776 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 57 ms 7116 KB Correct
2 Correct 103 ms 11924 KB Correct
3 Correct 104 ms 12992 KB Correct
4 Correct 105 ms 12988 KB Correct
5 Correct 106 ms 12868 KB Correct
6 Correct 106 ms 12964 KB Correct
7 Correct 105 ms 12996 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 7236 KB Correct
2 Correct 123 ms 12156 KB Correct
3 Correct 120 ms 12992 KB Correct
4 Correct 134 ms 12992 KB Correct
5 Correct 134 ms 12992 KB Correct
6 Correct 132 ms 13220 KB Correct
7 Correct 117 ms 12984 KB Correct
8 Correct 111 ms 12992 KB Correct