Submission #771958

# Submission time Handle Problem Language Result Execution time Memory
771958 2023-07-03T12:48:11 Z Trisanu_Das Just Long Neckties (JOI20_ho_t1) C++17
Compilation error
0 ms 0 KB
#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

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]);
      |                             ^