Submission #771958

#TimeUsernameProblemLanguageResultExecution timeMemory
771958Trisanu_DasJust Long Neckties (JOI20_ho_t1)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <bits/extc++.h> #define int long long #define mp make_pair #define pb push_back #define ff first #define ss second using namespace std; //limit definitions #define N 200050 int b[N], p[N], s[N], ans[N]; pair<int, int> a[N]; int main(){ int n; cin >> n; for(int i = 1; i < n + 2; i++) cin >> a[i].ff, a[i].ss = i; for(int i = 1; i < n + 1; i++) cin >> b[i]; sort(a, a + n + 2), sort(b, b + n + 1); for(int i = 1; i < n + 1; i++) p[i] = max(p[i - 1], a[i].ff - b[i]); for(int i = n; i > 0; --) s[i] = max(s[i + 1], a[i + 1].ff - b[i]); for(int i = 0; i < n + 1; i++) ans[a[i + 1].ss] = max(p[i], s[i + 1]); for(int i = 1; i < n + 2; i++) cout << ans[i] << '\n'; }

Compilation message (stderr)

cc1plus: error: '::main' must return 'int'
ho_t1.cpp: In function 'int main()':
ho_t1.cpp:21:29: error: expected primary-expression before ')' token
   21 |     for(int i = n; i > 0; --) s[i] = max(s[i + 1], a[i + 1].ff - b[i]);
      |                             ^