제출 #294837

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
2948372020-09-09 09:54:06shrek12357Rice Hub (IOI11_ricehub)C++14
컴파일 에러
0 ms0 KiB
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <climits>
#include <cmath>
#include <fstream>
#include <queue>
#include "ricehub.h"
using namespace std;
bool tern(int lo, int hi, vector<int> pre, long long b, int s1, int s2) {
if (hi - lo == 1) {
long long val1 = pre[hi + 1] - pre[hi] - pre[lo + 1] + pre[lo];
return val1 <= b;
}
while (hi >= lo) {
int mid1 = lo + (hi - lo) / 3;
int mid2 = hi - (hi - lo) / 3;
long long val1 = pre[s2 + 1] - pre[mid1 + 1] - (s2- mid1)*(pre[mid1 + 1] - pre[mid1]) + (mid1 - s1)*(pre[mid1 + 1] - pre[mid1]) - pre[mid1] + pre[s1];
long long val2 = pre[s2 + 1] - pre[mid2 + 1] - (s2 - mid2)*(pre[mid2 + 1] - pre[mid2]) + (mid2 - s1)*(pre[mid2 + 1] - pre[mid2]) - pre[mid2] + pre[s1];
if (val1 <= b) {
return true;
}
if (val2 <= b) {
return true;
}
if (val1 < val2) {
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

컴파일 시 표준 에러 (stderr) 메시지

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:67:21: error: could not convert 'pre' from 'vector<long long int>' to 'vector<int>'
   67 |   if (check(r, mid, pre, b)) {
      |                     ^~~
      |                     |
      |                     vector<long long int>