Submission #1118093

# Submission time Handle Problem Language Result Execution time Memory
1118093 2024-11-24T23:26:26 Z SN0WM4N Just Long Neckties (JOI20_ho_t1) C++14
0 / 100
2 ms 336 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define sort undefined_function // To use stable_sort instead sort 
#define bpc __builtin_popcount
#define ull unsigned long long
#define ld double
#define ll long long
#define mp make_pair
#define F first
#define S second

# pragma GCC optimize("O2")
//pragma GCC optimize("my solution")

using namespace __gnu_pbds;
using namespace std;

typedef tree<long long, null_type, less_equal<long long>,
    rb_tree_tag, tree_order_statistics_node_update> Tree;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll INF = 9223372036854775807LL;
const ll inf = 2147483647;
const ll MOD = 1e9 + 7; //[998244353, 1e9 + 7, 1e9 + 13]

ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b) {return a * b / gcd(a, b);}
ll ceil(ll a, ll b) {return (a + b - 1) / b;}

int32_t main() {
        ios_base::sync_with_stdio(0);
        cin.tie(0);

        int n;
        cin >> n;

        vector<int> a(n + 1), b(n);

        for (auto &x : a)
                cin >> x;
        for (auto &x : b)
                cin >> x;

        stable_sort(b.begin(), b.end());

        for (int i = 0; i <= n; i ++) {
                vector<int> aux;
                for (int j = 0; j <= n; j ++) {
                        if (i == j)
                                continue;
                        aux.push_back(a[j]);
                }

                stable_sort(aux.begin(), aux.end());

                int ans = 0;
                for (int j = 0; j < n; j ++) 
                        ans = max(ans, abs(aux[j] - b[j]));

                cout << ans << " ";
        }

        return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 336 KB Output is correct
2 Incorrect 1 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 336 KB Output is correct
2 Incorrect 1 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 336 KB Output is correct
2 Incorrect 1 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -