Submission #150281

# Submission time Handle Problem Language Result Execution time Memory
150281 2019-09-01T08:03:30 Z Solo Leveling (#3786, wzy) King of Chairs (FXCUP4_chairs) C++17
95 / 100
189 ms 10452 KB
#include "king.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;


long long SendInfo(std::vector<int> W, std::vector<int> C) {
	vector<int> orig = W;
	sort(W.begin() , W.end());
	sort(C.rbegin() , C.rend());
	ll last = 0LL;
	for(int i = 0 ; i <  W.size() ; i ++){
		while(C.size() && C.back() < W[i]){
			C.pop_back();
		}
		// cout<<i<<" " << C.back() << endl;
		if(!C.size()){
			last = W[i];
			break;
		}
		else{
			C.pop_back();
		}
	}
	return last;
}	
#include "vassal.h"
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int,int> 
#define F first
#define S second
long long BB;
vector<int> c;
set<pii> Sx;
int cntX = 0;
bool jafoi = false;
void Init(long long B, std::vector<int> C){
	int N = C.size();
	BB = B;
	for(int i =0 ; i < C.size() ; i ++){
		Sx.insert(pair<int,int>(C[i] , i));
	}
	// ToDo
}

int Maid(int W){
	if(BB !=0 && W > BB){
		return -1;
	}
	else{
		auto u = Sx.lower_bound(pii(W , -1));
		if(u == Sx.end()){
			return -1;
		}
		pii X = *u;

		Sx.erase(X);
		// cout<<W<<" " <<X.second << endl;
		return X.second;
	}
}

Compilation message

king.cpp: In function 'long long int SendInfo(std::vector<int>, std::vector<int>)':
king.cpp:12:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0 ; i <  W.size() ; i ++){
                  ~~^~~~~~~~~~~

vassal.cpp: In function 'void Init(long long int, std::vector<int>)':
vassal.cpp:15:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i =0 ; i < C.size() ; i ++){
                 ~~^~~~~~~~~~
vassal.cpp:13:6: warning: unused variable 'N' [-Wunused-variable]
  int N = C.size();
      ^
# Verdict Execution time Memory Grader output
1 Correct 10 ms 1048 KB Correct
2 Correct 11 ms 1044 KB Correct
3 Correct 11 ms 1040 KB Correct
4 Correct 11 ms 1040 KB Correct
5 Correct 11 ms 1048 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 72 ms 5788 KB Correct
2 Correct 117 ms 9680 KB Correct
3 Correct 125 ms 10452 KB Correct
4 Correct 128 ms 10160 KB Correct
5 Correct 129 ms 10420 KB Correct
6 Correct 122 ms 10424 KB Correct
7 Correct 124 ms 10428 KB Correct
# Verdict Execution time Memory Grader output
1 Partially correct 92 ms 6048 KB B = 993891
2 Partially correct 179 ms 9616 KB B = 996222
3 Partially correct 152 ms 10412 KB B = 706118
4 Partially correct 177 ms 10408 KB B = 998466
5 Partially correct 189 ms 10420 KB B = 995879
6 Partially correct 184 ms 10416 KB B = 997505
7 Partially correct 144 ms 10424 KB B = 706124
8 Partially correct 124 ms 10416 KB B = 278507