Submission #153534

# Submission time Handle Problem Language Result Execution time Memory
153534 2019-09-14T14:53:26 Z phpark King of Chairs (FXCUP4_chairs) C++17
100 / 100
149 ms 10728 KB
#include "king.h"
using namespace std;
long long SendInfo(vector <int> W, vector <int> C)
{
	return 0;
}
#include <set>
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include "vassal.h"
using namespace std;
static multiset <pair<int, int>> sit;
static vector <int> chair;
static int N;
typedef pair <int, int> pii;
pii p;
void Init(long long B, vector <int> C)
{
	N = C.size();
	
	chair = C;
	
	for (int i = 0; i < N; i++) {
		p.first = chair[i];
		p.second = i;
		sit.insert(p);
	}

}

int Maid(int w)
{
	int left = 0, right = N;
	auto itr = sit.lower_bound(make_pair(w, 0));
	if (itr == sit.end()) {
		
		return -1;
	}
	else {
		pair <int, int> ans = *itr;    //고른 의자 무게
		
		int answer = ans.second;
		sit.erase(itr);
		
		return answer;
	}
	
}

Compilation message

vassal.cpp: In function 'int Maid(int)':
vassal.cpp:29:6: warning: unused variable 'left' [-Wunused-variable]
  int left = 0, right = N;
      ^~~~
vassal.cpp:29:16: warning: unused variable 'right' [-Wunused-variable]
  int left = 0, right = N;
                ^~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 628 KB Correct
2 Correct 4 ms 872 KB Correct
3 Correct 4 ms 784 KB Correct
4 Correct 4 ms 756 KB Correct
5 Correct 4 ms 892 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 55 ms 5684 KB Correct
2 Correct 96 ms 9612 KB Correct
3 Correct 107 ms 10672 KB Correct
4 Correct 107 ms 10524 KB Correct
5 Correct 107 ms 10556 KB Correct
6 Correct 106 ms 10528 KB Correct
7 Correct 106 ms 10376 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 73 ms 5848 KB Correct
2 Correct 132 ms 9772 KB Correct
3 Correct 130 ms 10644 KB Correct
4 Correct 148 ms 10656 KB Correct
5 Correct 148 ms 10556 KB Correct
6 Correct 149 ms 10728 KB Correct
7 Correct 131 ms 10492 KB Correct
8 Correct 122 ms 10420 KB Correct