답안 #148473

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
148473 2019-09-01T04:29:59 Z 준표야 함수컵은 캐리해줄거지?(#3588, Acka, spectaclehong, heiler) King of Chairs (FXCUP4_chairs) C++17
0 / 100
41 ms 3008 KB
#include "king.h"
#include <algorithm>
using namespace std;


long long SendInfo(vector<int> W, vector<int> C) {
	int N = W.size();
	long long ret = 0;
	for(int i=N-1;i>=0;i--) {
		ret += W[i];
		if(i==0) break;
		ret *= 10;
	}
	return ret;
}
#include "vassal.h"
#include <algorithm>
#include <vector>
using namespace std;

typedef pair<int, int> pii;


vector<int> ans[12];

long long BB;
void Init(long long B, vector<int> C){
	int N = C.size();
	BB = B;
	// ToDo
	int W[12]= {};
	vector<pii> ws, cs;
	for(int i=0;i<N;i++) {
		cs.push_back({C[i], i});
	}
	sort(cs.begin(), cs.end());
	
	for(int i=0;i<N;i++) {
		W[i] = B%10;
		B/=10;
		ws.push_back({W[i], i});
	}
	sort(ws.begin(), ws.end());
	
	for(int i=0;i<N;i++) {
		if(ws[i].first<=cs[i].first) {
			ans[ws[i].first].push_back(cs[i].second);
		}
	}
}

int Maid(int W){
	
	if(ans[W].size()==0) return -1;
	
	int ret = ans[W][ans[W].size()-1];
	ans[W].pop_back();
	return ret;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 11 ms 1044 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 41 ms 3008 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 38 ms 2872 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -