Submission #909579

#TimeUsernameProblemLanguageResultExecution timeMemory
909579schzeeyWatching (JOI13_watching)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int ll int n, a, b; vector <int> arr; bool check(int ans){ vector<vector<int>> dp(a+1, vector<int>(n+1, 0)); for (int i = 0; i < a+1; ++i){ for (int j = 1; j <= n; ++j){ int pa = j, pb = j; do pa--; while(arr[j]-arr[pa] <= ans); do pb--; while(arr[j]-arr[pb] <= 2*ans); if (i == 0) dp[i][j] = dp[i][pb]+1; else dp[i][j] = min(dp[i][pb]+1, dp[i-1][pa]); } } return dp[a][n] <= b; } int main(){ cin >> n >> a >> b; arr.resize(n+1); for (int i = 1; i <= n; ++i) cin >> arr[i]; if (a+b >= n) return cout<<1, 0; arr[0] = -1e9; sort(arr.begin(), arr.end()); //for (auto e: arr) cout << e << " "; int lf = 0, ri = 1e9; while (lf <= ri){ int mid = (lf+ri)/2; //cout << mid << " "; if (check(mid)) ri = mid-1; else lf = mid+1; } cout << lf+1; }

Compilation message (stderr)

watching.cpp:3:13: error: 'll' does not name a type
    3 | #define int ll
      |             ^~
watching.cpp:4:1: note: in expansion of macro 'int'
    4 | int n, a, b;
      | ^~~
watching.cpp:3:13: error: 'll' was not declared in this scope
    3 | #define int ll
      |             ^~
watching.cpp:5:9: note: in expansion of macro 'int'
    5 | vector <int> arr;
      |         ^~~
watching.cpp:5:12: error: template argument 1 is invalid
    5 | vector <int> arr;
      |            ^
watching.cpp:5:12: error: template argument 2 is invalid
watching.cpp:3:13: error: 'll' was not declared in this scope
    3 | #define int ll
      |             ^~
watching.cpp:6:12: note: in expansion of macro 'int'
    6 | bool check(int ans){
      |            ^~~
watching.cpp:3:13: error: 'll' does not name a type
    3 | #define int ll
      |             ^~
watching.cpp:21:1: note: in expansion of macro 'int'
   21 | int main(){
      | ^~~