답안 #488650

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
488650 2021-11-19T21:37:46 Z fun_day 쌀 창고 (IOI11_ricehub) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

long long besthub(long long r, long long l, vector<long long> v, long long b){
  long long best = 0;
  for(int i = 0 ; i < r ; i++){
    vector<int> sz;
    long long ans = 0;
    for(int j = i + 1 ; j < r ; j++){
      if(v[j] - v[i] > b) break;
      sz.emplace_back(v[j] - v[i]);
    }
    for(int j = i - 1 ; j >= 0 ; j--){
      if(v[i] - v[j] > b) break;
      sz.emplace_back(v[i] - v[j]);
    }
    sort(sz.begin(),sz.end());
    long long len = 0;
    for(int j = 0 ; j < (int)sz.size() ; j++){
      len += sz[j];
      if(len <= b) ans++;
      else break;
    }
    best = max(best , ans);
  }
  return best + 1;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  return 0; 
}

Compilation message

/usr/bin/ld: /tmp/ccZbwsgs.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cccrxrlr.o:ricehub.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccZbwsgs.o: in function `main':
grader.cpp:(.text.startup+0xae): undefined reference to `besthub(int, int, int*, long long)'
collect2: error: ld returned 1 exit status