116912024-11-05 13:08:51bzyZsonglőrködéscpp17Time limit exceeded 35/1001.6s6452 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll  long long

int main()
{
    int n; cin >> n;
    vector < pair <int, int> > A(n);
    for(int i = 0; i < n; i++){
        cin >> A[i].first >> A[i].second;
    }
    sort(A.begin(), A.end());
    vector <int> G;
    for(int i = 0; i < n; i++){
        bool found = false;
        for(int j = 0; j < G.size(); j++){
            if(G[j] == A[i].first){
                found = true;
                G[j] = A[i].second;
                break;
            }
        }
        if(!found) G.push_back(A[i].second);
    }
    cout << G.size() << '\n';
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted1ms320 KiB
2Accepted1ms500 KiB
subtask20/20
3Accepted4ms424 KiB
4Accepted929ms2412 KiB
5Time limit exceeded1.598s5024 KiB
6Time limit exceeded1.598s5908 KiB
7Time limit exceeded1.598s6320 KiB
8Time limit exceeded1.583s6324 KiB
9Time limit exceeded1.588s6284 KiB
10Time limit exceeded1.588s6328 KiB
11Time limit exceeded1.6s6440 KiB
subtask335/35
12Accepted1ms320 KiB
13Accepted1ms320 KiB
14Accepted1ms320 KiB
15Accepted2ms508 KiB
16Accepted1ms320 KiB
17Accepted2ms320 KiB
18Accepted1ms320 KiB
19Accepted2ms320 KiB
20Accepted1ms320 KiB
subtask40/45
21Accepted4ms456 KiB
22Accepted382ms2412 KiB
23Time limit exceeded1.598s4908 KiB
24Time limit exceeded1.598s5776 KiB
25Time limit exceeded1.578s6316 KiB
26Time limit exceeded1.588s6324 KiB
27Time limit exceeded1.585s6368 KiB
28Time limit exceeded1.587s6324 KiB
29Time limit exceeded1.6s6452 KiB