Submission #153533

# Submission time Handle Problem Language Result Execution time Memory
153533 2019-09-14T14:52:33 Z phpark King of Chairs (FXCUP4_chairs) C++17
95 / 100
156 ms 13364 KB
#include "king.h"
using namespace std;
long long SendInfo(vector <int> W, vector <int> C)
{
	return 1;
}
#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 1004 KB Correct
2 Correct 4 ms 892 KB Correct
3 Correct 4 ms 636 KB Correct
4 Correct 4 ms 872 KB Correct
5 Correct 4 ms 892 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 55 ms 7148 KB Correct
2 Correct 99 ms 12492 KB Correct
3 Correct 107 ms 13364 KB Correct
4 Correct 108 ms 13124 KB Correct
5 Correct 104 ms 13136 KB Correct
6 Correct 107 ms 13236 KB Correct
7 Correct 108 ms 13228 KB Correct
# Verdict Execution time Memory Grader output
1 Partially correct 80 ms 7284 KB B = 1
2 Partially correct 133 ms 12176 KB B = 1
3 Partially correct 134 ms 13284 KB B = 1
4 Partially correct 156 ms 13180 KB B = 1
5 Partially correct 150 ms 13200 KB B = 1
6 Partially correct 152 ms 13352 KB B = 1
7 Partially correct 131 ms 13204 KB B = 1
8 Partially correct 121 ms 13288 KB B = 1