Submission #58986230


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

int main() {
    int n;

    cin >> n;
    vector<int> as(n);
    vector<int> bs(n - 1);

    for(int &a : as) {
        cin >> a;
    }
    for(int &b : bs) {
        cin >> b;
    }
    sort(as.begin(), as.end());
    sort(bs.begin(), bs.end());

    int over = -1;
    int ai = as.size() - 1;
    int bi = bs.size() - 1;

    while(ai >= 0) {
        if(bs[bi] >= as[ai]) {
            // cout << "in:" << as[ai] << endl;
            ai--;
            bi--;
        } else {
            if(over != -1) {
                cout << -1 << endl;
                return 0;
            }
            over = as[ai];
            ai--;
        }
    }
    cout << over << endl;

    return 0;
}

Submission Info

Submission Time
Task C - Prepare Another Box
User nnth_y
Language C++ 20 (gcc 12.2)
Score 350
Code Size 777 Byte
Status AC
Exec Time 124 ms
Memory 4888 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 350 / 350
Status
AC × 3
AC × 30
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 02_random2_03.txt, 02_random2_04.txt, 02_random2_05.txt, 02_random2_06.txt, 02_random2_07.txt, 02_random2_08.txt, 02_random2_09.txt, 02_random2_10.txt, 02_random2_11.txt, 02_random2_12.txt, 02_random2_13.txt, 02_random2_14.txt, 02_random2_15.txt, 03_random3_00.txt, 03_random3_01.txt, 03_random3_02.txt, 04_handmade_00.txt, 04_handmade_01.txt, 04_handmade_02.txt, 04_handmade_03.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3608 KiB
00_sample_01.txt AC 1 ms 3444 KiB
00_sample_02.txt AC 1 ms 3488 KiB
01_random_00.txt AC 42 ms 3740 KiB
01_random_01.txt AC 47 ms 3596 KiB
01_random_02.txt AC 121 ms 4884 KiB
01_random_03.txt AC 122 ms 4888 KiB
02_random2_00.txt AC 121 ms 4660 KiB
02_random2_01.txt AC 121 ms 4720 KiB
02_random2_02.txt AC 121 ms 4888 KiB
02_random2_03.txt AC 122 ms 4744 KiB
02_random2_04.txt AC 122 ms 4648 KiB
02_random2_05.txt AC 124 ms 4680 KiB
02_random2_06.txt AC 121 ms 4656 KiB
02_random2_07.txt AC 121 ms 4656 KiB
02_random2_08.txt AC 122 ms 4648 KiB
02_random2_09.txt AC 121 ms 4796 KiB
02_random2_10.txt AC 121 ms 4760 KiB
02_random2_11.txt AC 121 ms 4664 KiB
02_random2_12.txt AC 121 ms 4716 KiB
02_random2_13.txt AC 122 ms 4880 KiB
02_random2_14.txt AC 121 ms 4724 KiB
02_random2_15.txt AC 122 ms 4684 KiB
03_random3_00.txt AC 122 ms 4760 KiB
03_random3_01.txt AC 121 ms 4668 KiB
03_random3_02.txt AC 121 ms 4668 KiB
04_handmade_00.txt AC 1 ms 3668 KiB
04_handmade_01.txt AC 1 ms 3540 KiB
04_handmade_02.txt AC 1 ms 3604 KiB
04_handmade_03.txt AC 108 ms 4724 KiB