Submission #470969

# Submission time Handle Problem Language Result Execution time Memory
470969 2021-09-06T13:28:50 Z Sad_Bus Olivander (COCI18_olivander) C++14
50 / 50
1 ms 312 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n;
    cin >> n;

    vector<int> wands(n), boxes(n);

    for (int i = 0; i < n; ++i)
    {
        cin >> wands[i];
    }

    for (int i = 0; i < n; ++i)
    {
        cin >> boxes[i];
    }

    sort(wands.begin(), wands.end());
    sort(boxes.begin(), boxes.end());

    for (int i = 0; i < n; ++i)
    {
        auto it = lower_bound(boxes.begin(), boxes.end(), wands[i]);

        if(it != boxes.end()){
            boxes.erase(it);
        }
        else{
            cout << "NE\n";
            return 0;
        }
    }

    cout << "DA\n";
    
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct