답안 #481704

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
481704 2021-10-21T12:02:43 Z Lobo Just Long Neckties (JOI20_ho_t1) C++17
0 / 100
1 ms 332 KB
#include <bits/stdc++.h>
 
using namespace std;

const long long INFll = (long long) 1e18 + 10;
const int INFii = (int) 1e9 + 10;
typedef long long ll;
typedef int ii;
typedef long double dbl;
#define endl '\n'
#define sc second
#define fr first
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()

#define maxn 220000

ii n, a[maxn], b[maxn], ps[maxn], sf[maxn];

int main() {
    ios::sync_with_stdio(false); cin.tie(0);

    //freopen("in.in", "r", stdin);
    //freopen("out.out", "w", stdout);

    cin >> n;

    for(ii i = 1; i <= n+1; i++)
        cin >> a[i];

    for(ii i = 1; i <= n; i++)
        cin >> b[i];
    
    sort(a+1,a+n+2);
    sort(b+1,b+n+1);
    
    for(ii i = 1; i <= n; i++) {
        ps[i] = ps[i-1];
        ps[i] = max(ps[i],a[i]-b[i]);
    }

    for(ii i = n; i >= 1; i--) {
        sf[i] = sf[i+1];
        sf[i] = max(sf[i],a[i+1]-b[i]);
    }

    ii ans = INFii;

    for(ii i = 0; i <= n; i++) {
        cout << max(ps[i],sf[i+1]) << " ";
    }

    cout << endl;
}

Compilation message

ho_t1.cpp: In function 'int main()':
ho_t1.cpp:49:8: warning: unused variable 'ans' [-Wunused-variable]
   49 |     ii ans = INFii;
      |        ^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -