Submission #149031

# Submission time Handle Problem Language Result Execution time Memory
149031 2019-09-01T05:36:41 Z 준표야 함수컵은 캐리해줄거지?(#3588, Acka, spectaclehong, heiler) King of Chairs (FXCUP4_chairs) C++17
17 / 100
33 ms 2296 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++; ci++;
	}
	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 Correct 10 ms 1048 KB Correct
3 Correct 11 ms 788 KB Correct
4 Correct 11 ms 1048 KB Correct
5 Correct 10 ms 1048 KB Correct
# Verdict Execution time Memory Grader output
1 Runtime error 33 ms 2288 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 2296 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -