Submission #149017

# Submission time Handle Problem Language Result Execution time Memory
149017 2019-09-01T05:35:00 Z 준표야 함수컵은 캐리해줄거지?(#3588, Acka, spectaclehong, heiler) King of Chairs (FXCUP4_chairs) C++17
0 / 100
30 ms 2416 KB
#include "king.h"
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
using namespace std;

typedef pair<int, int> pii;

long long SendInfo(vector<int> W, vector<int> C) {
	int N = W.size();
	
	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++) {
		ws.push_back({W[i], i});
	}
	sort(ws.begin(), ws.end());
	
	int ans[12]={};
	
	int wi=0;
	int ci=0;
	for(;wi<N && ci<N;) {
		while(ci<N && ws[wi].first>cs[ci].first) {
			ci++;
		}
		if(ci==N) break;
		
		ans[ws[wi].second] = cs[ci].second;
		wi++;
	}
	for(int i=wi;i<N;i++)
		ans[ws[i].second] = 10;
	
	
	long long ret = 0;
	long long K = 1;
	for(int i=0;i<N;i++) {
		ret += K*ans[i];
		K *= 11;
	}
	
	
	return ret;
}
#include "vassal.h"
#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;

long long BB;
void Init(long long B, vector<int> C){
	int N = C.size();
	BB = B;
	// ToDo
	
}

int Maid(int W){
	int ret = BB%11;
	BB/=11;
	if(ret==10) return -1;
	return ret;
}

Compilation message

vassal.cpp: In function 'void Init(long long int, std::vector<int>)':
vassal.cpp:9: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 Runtime error 10 ms 1040 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 27 ms 2416 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 30 ms 2416 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -