Submission #1254149

#TimeUsernameProblemLanguageResultExecution timeMemory
1254149asimRice Hub (IOI11_ricehub)C++20
Compilation error
0 ms0 KiB
#pragma GCC optimize ("O3") #include <bits/stdc++.h> using namespace std; #define endl "\n" #define IOS \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); // 10 ^ 8 bool check(int m, long long n, long long b, const vector<long long> &arr) { if (m > n) { return false; } for (int i = 1; i <= n - m + 1; i++) { long long a = 0; for (int j = i; j <i+m; j++) { a += (abs(arr[j] - arr[i + m / 2])); } if (a <= b) { return true; } } return false; } void solve() { long long n, r, b; cin >> n >> r >> b; vector<ll> arr(n + 10); for (int i = 1; i <= n; i++) { cin >> arr[i]; } long long l1 = 1; long long best = 1; while (l1 <= r) { int m = (r + l1) / 2; if (check(m, n, b,arr)) { l1 = m + 1; best = m; } else { r = m - 1; } } cout << best << endl; } signed main() { IOS solve(); }

Compilation message (stderr)

ricehub.cpp: In function 'void solve()':
ricehub.cpp:34:12: error: 'll' was not declared in this scope
   34 |     vector<ll> arr(n + 10);
      |            ^~
ricehub.cpp:34:14: error: template argument 1 is invalid
   34 |     vector<ll> arr(n + 10);
      |              ^
ricehub.cpp:34:14: error: template argument 2 is invalid
ricehub.cpp:37:19: error: invalid types 'int[int]' for array subscript
   37 |         cin >> arr[i];
      |                   ^
ricehub.cpp:44:27: error: invalid initialization of reference of type 'const std::vector<long long int>&' from expression of type 'int'
   44 |         if (check(m, n, b,arr))
      |                           ^~~
ricehub.cpp:10:70: note: in passing argument 4 of 'bool check(int, long long int, long long int, const std::vector<long long int>&)'
   10 | bool check(int m, long long n, long long b, const vector<long long> &arr)
      |                                             ~~~~~~~~~~~~~~~~~~~~~~~~~^~~