제출 #488651

#제출 시각아이디문제언어결과실행 시간메모리
488651fun_day쌀 창고 (IOI11_ricehub)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int besthub(int R, int L, int[] X, long long B){ int best = 0; for(int i = 0 ; i < R ; i++){ vector<int> sz; int ans = 0; for(int j = i + 1 ; j < R ; j++){ if(X[j] - X[i] > B) break; sz.emplace_back(X[j] - X[i]); } for(int j = i - 1 ; j >= 0 ; j--){ if(X[i] - X[j] > B) break; sz.emplace_back(X[i] - X[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; }

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

ricehub.cpp:5:33: error: expected ',' or '...' before 'X'
    5 | int besthub(int R, int L, int[] X, long long B){
      |                                 ^
ricehub.cpp: In function 'int besthub(int, int, int*)':
ricehub.cpp:11:10: error: 'X' was not declared in this scope
   11 |       if(X[j] - X[i] > B) break;
      |          ^
ricehub.cpp:11:24: error: 'B' was not declared in this scope
   11 |       if(X[j] - X[i] > B) break;
      |                        ^
ricehub.cpp:12:23: error: 'X' was not declared in this scope
   12 |       sz.emplace_back(X[j] - X[i]);
      |                       ^
ricehub.cpp:15:10: error: 'X' was not declared in this scope
   15 |       if(X[i] - X[j] > B) break;
      |          ^
ricehub.cpp:15:24: error: 'B' was not declared in this scope
   15 |       if(X[i] - X[j] > B) break;
      |                        ^
ricehub.cpp:16:23: error: 'X' was not declared in this scope
   16 |       sz.emplace_back(X[i] - X[j]);
      |                       ^
ricehub.cpp:22:17: error: 'b' was not declared in this scope
   22 |       if(len <= b) ans++;
      |                 ^