답안 #150748

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
150748 2019-09-01T08:53:25 Z 준표야 함수컵은 캐리해줄거지?(#3588, Acka, spectaclehong, heiler) King of Chairs (FXCUP4_chairs) C++17
컴파일 오류
0 ms 0 KB
#include "king.h"
#include <algorithm>
using namespace std;

typedef long long ll;
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;

int last, *ans;

void Init(long long B, std::vector<int> C){
	int N = C.size();
	ans = new int[1 << 17];
	int *past = ((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:9:20: error: invalid operands of types 'int*' and 'int' to binary 'operator>>'
  int *past = ((ans >> 24) << 24) ^ (B << 8);
                ~~~~^~~~~
vassal.cpp:7:6: warning: unused variable 'N' [-Wunused-variable]
  int N = C.size();
      ^