258142026-03-03 18:30:26algoproRMI eredményekcpp17Wrong answer 0/1001.1s1144 KiB
// UUID: 5b802466-0f0c-4295-99ad-aca258a7ca22
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;

int main() {
    //vector<int>v = {1 , 2 , 10};
    //auto it = lower_bound(v.begin() , v.end() , 2);
    //cout << it - v.begin();
    //return 0;
	int elso , masodik , n;
    cin >> elso >> masodik >> n;
    int en = elso + masodik;
    vector<int> a(n) , b(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 0; i < n; i++){
        cin >> b[i];
    }
    sort(a.begin() , a.end());
    sort(b.begin() , b.end());

    vector<bool> ures(n , 1); // 0 nyitott , 1 foglalt

    int ans1 = 1 , ans2 = 1;
    for(int i = 0; i < n; i++){
        int kene = en - a[i]; // ennel egyel tobb kell
        auto it = upper_bound(b.begin() , b.end() , kene);
        while (it - b.begin() < n && ures[it - b.begin()] == 0) {
            it++;
        }
        if(it - b.begin() == n){
            auto it2 = upper_bound(ures.begin() , ures.end() , 0);
            ures[it2 - ures.begin()] = 0;
        }
        else{
            ures [it - b.begin()] = 0;
            ans2++;
        }
        
    }

    for(int i = 0; i < n; i++){
        int kene = en - a[i] + 1; // ennel egyel kevesebb kell
        auto it = lower_bound(b.begin() , b.end() , kene);
        it--;
        while (it - b.begin() >= 0 && ures[it - b.begin()] == 1) {
            it--;
        }
        if(it - b.begin() == -1){
            int x = n - 1;
            while(ures[x] == 1) {
                x --;
            }
            ures[x] = 1;
            ans1++;
        }
        else{
            ures [it - b.begin()] = 0;
            
        }
        
    }

    cout << ans1 << " " << ans2; // legjobb hely , legrosszabb hely



    // vegigmegy osszes 1. napon
    // keres egy olyan 2. napot ami elottem vegez
    // ha nem talal akkor a legkisebbet veszi el
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted1ms316 KiB
2Accepted1ms316 KiB
3Accepted1ms316 KiB
subtask20/30
4Accepted1ms316 KiB
5Accepted1ms316 KiB
6Accepted1ms316 KiB
7Wrong answer1ms316 KiB
8Wrong answer1ms316 KiB
9Wrong answer1ms500 KiB
10Accepted1ms316 KiB
11Accepted1ms316 KiB
12Wrong answer1ms316 KiB
13Wrong answer1ms316 KiB
subtask30/20
14Accepted1ms316 KiB
15Accepted1ms316 KiB
16Accepted1ms316 KiB
17Wrong answer1ms316 KiB
18Wrong answer1ms316 KiB
19Wrong answer1ms500 KiB
20Accepted1ms316 KiB
21Accepted1ms316 KiB
22Wrong answer1ms316 KiB
23Wrong answer1ms316 KiB
24Wrong answer1ms316 KiB
25Wrong answer1ms316 KiB
26Wrong answer1ms316 KiB
27Wrong answer1ms316 KiB
28Accepted1ms316 KiB
29Wrong answer1ms316 KiB
30Wrong answer1ms316 KiB
31Wrong answer1ms508 KiB
32Accepted1ms316 KiB
subtask40/50
33Accepted1ms324 KiB
34Accepted1ms316 KiB
35Accepted1ms316 KiB
36Accepted1ms316 KiB
37Accepted1ms316 KiB
38Accepted1ms316 KiB
39Wrong answer1ms316 KiB
40Wrong answer1ms316 KiB
41Wrong answer1ms500 KiB
42Accepted1ms316 KiB
43Accepted1ms316 KiB
44Wrong answer1ms316 KiB
45Wrong answer1ms316 KiB
46Wrong answer1ms316 KiB
47Wrong answer1ms316 KiB
48Wrong answer1ms316 KiB
49Wrong answer1ms316 KiB
50Accepted1ms316 KiB
51Wrong answer1ms316 KiB
52Wrong answer1ms316 KiB
53Wrong answer1ms508 KiB
54Accepted1ms316 KiB
55Accepted1ms500 KiB
56Wrong answer1ms500 KiB
57Accepted2ms508 KiB
58Wrong answer3ms384 KiB
59Wrong answer63ms464 KiB
60Accepted13ms508 KiB
61Accepted215ms1144 KiB
62Accepted915ms1012 KiB
63Accepted263ms1080 KiB
64Time limit exceeded1.1s1084 KiB
65Wrong answer282ms564 KiB
66Time limit exceeded1.078s820 KiB
67Accepted136ms1076 KiB
68Accepted421ms1076 KiB