Submission #150807

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

long long SendInfo(std::vector<int> W, std::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 = new int[1 << 17];

	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] = -1;
	
	return ((unsigned long long)ans % (1ll << 24)) >> 8;
}
#include "vassal.h"
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int last, *ans;

void Init(long long B, std::vector<int> C){
	int N = C.size();
	ans = new int[1 << 17];
	int *past = (int*)((((ull)ans >> 24) << 24) ^ (B << 8));
	for(int i = 0, im = (1 << 17); i < im; i++)
		ans[i] = past[i];
}

int Maid(int W){
	return ans[last++];
}

Compilation message

vassal.cpp: In function 'void Init(long long int, std::vector<int>)':
vassal.cpp:10:6: warning: unused variable 'N' [-Wunused-variable]
  int N = C.size();
      ^
# Verdict Execution time Memory Grader output
1 Runtime error 11 ms 1168 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 54 ms 4848 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 61 ms 4848 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -