Submission #151640

# Submission time Handle Problem Language Result Execution time Memory
151640 2019-09-04T02:12:41 Z cos18 King of Chairs (FXCUP4_chairs) C++17
0 / 100
42 ms 3912 KB
#include "king.h"

long long SendInfo(std::vector<int> W, std::vector<int> C) {
	int N = W.size();
	return W[0]*100 + W[1]*10 + W[2]*1;
}
#include "vassal.h"
#include <algorithm>

std::vector<int> realC;

int find(int target, int start, int end){
	int location = (start+end)/2;
	if(target==realC[location]) return location;
	if(start==end){
		if(target>realC[location]) return location;
		return location-1;
	}
	if(target>realC[location]) return find(target, start, location-1);
	return find(target, location+1, end);
}

void Init(long long B, std::vector<int> C){
	realC = C;
	sort(realC.begin(), realC.end());
}

int Maid(int W){
	int location = find(W, 0, realC.size());
	if(location>=0){
		realC.erase(realC.begin()+location);
		return location;
	}
	return -1;
}

Compilation message

king.cpp: In function 'long long int SendInfo(std::vector<int>, std::vector<int>)':
king.cpp:4:6: warning: unused variable 'N' [-Wunused-variable]
  int N = W.size();
      ^
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 40 ms 3912 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 42 ms 3796 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -