제출 #1158027

#제출 시각아이디문제언어결과실행 시간메모리
1158027sunflowerA Plus B (IOI23_aplusb)C++17
10 / 100
0 ms328 KiB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define MASK(x) (1LL << (x))
#define BIT(x, i) (((x) >> (i)) & 1)
#define SZ(x) ((int) (x).size())
#define ALL(a) (a).begin(), (a).end()
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define FORD(i, a, b) for (int i = (a); i >= (b); --i)
#define debug(x) cerr << "[" << #x << " = " << (x) << "]" << endl

#define left    __left
#define right   __right
#define prev    __prev
#define fi      first
#define se      second

template <class X, class Y>
    bool maximize(X &x, Y y) {
        if (x < y) return x = y, true;
        else return false;
    }

template <class X, class Y>
    bool minimize(X &x, Y y) {
        if (x > y) return x = y, true;
        else return false;
    }

vector <int> smallest_sums(int n, vector <int> a, vector <int> b) {
//    int l = a[0] + b[0] - 1, r = a[n - 1] + b[n - 1] + 1, g, vt = -1;
//    while (l <= r) {
//        g = (l + r) >> 1;
//
//        int val = g;
//        int rig = n - 1, ans = 0;
//        bool ok = false;
//        FOR(i, 0, n - 1) {
//            while (rig >= 0 && a[i] + b[rig] > val) --rig;
//
//            if (r >= 0) ans += rig + 1;
//
//            if (ans >= n) {ok = true; break;}
//        }
//
//        if (ok) vt = g, r = g - 1;
//        else l = g + 1;
//    }
//
    vector <int> results;
    results.push_back(a[0] + b[0]);
//    FOR(i, 0, n - 1) {
//        FOR(j, 0, n - 1) {
//            if (a[i] + b[j] >= vt) break;
//            results.push_back(a[i] + b[j]);
//        }
//    }
//
//    sort(ALL(results));
//    while (SZ(results) < n) results.push_back(vt);

    return results;
}

#ifdef SUN

int main() {
    int n;
    cin >> n;
    vector <int> a(n), b(n);
    FOR(i, 0, n - 1) cin >> a[i];
    FOR(i, 0, n - 1) cin >> b[i];

    vector <int> res = smallest_sums(n, a, b);

    for (int x : res) cout << x << " ";

    return 0;
}
#endif // SUN

/* Discipline - Calm */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...