107342024-04-10 20:57:26zsebiFőnökszámcpp17Wrong answer 15/100442ms11308 KiB
#include <iostream>
#include <queue>

#define ll long long
using namespace std;
struct alk
{
    ll els,mas;
};
priority_queue<alk>que;
bool operator<(const alk a, const alk b)
{
   if(a.els>b.els)return true;
   else if(a.els==b.els && a.mas>b.mas)return true;
   return false;
}
struct alk2
{
    ll els, mas;
};
priority_queue<alk2>que2;
bool operator<(const alk2 a, const alk2 b)
{
    if(a.els<b.els)return true;
    else if(a.els==b.els && a.mas<b.mas)return true;
    return false;
}
int main() {
    ll n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        ll a, b;
        cin >> a >> b;
        if(!que2.empty() &&(que2.top().els<=a||que2.top().mas<=b))
        {
            que2.push({a, b});
            que.push({a,b});
        }
        if(que2.empty())
        {
            que2.push({a,b});
            que.push({a,b});
        }
        while (!que.empty() && a > que.top().els && b > que.top().mas) {
            que.pop();
        }


        cout << que.size() << "\n";
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms2032 KiB
2Wrong answer180ms8720 KiB
subtask25/5
3Accepted3ms2436 KiB
4Accepted3ms2560 KiB
5Accepted4ms2508 KiB
6Accepted18ms2640 KiB
subtask30/10
7Accepted3ms2848 KiB
8Accepted3ms2988 KiB
9Accepted3ms3192 KiB
10Wrong answer3ms3464 KiB
11Wrong answer3ms3648 KiB
12Wrong answer4ms3732 KiB
13Wrong answer8ms4000 KiB
14Wrong answer12ms4428 KiB
subtask410/10
15Accepted3ms4164 KiB
16Accepted3ms4284 KiB
17Accepted4ms4380 KiB
18Accepted6ms4504 KiB
19Accepted20ms4712 KiB
20Accepted35ms4816 KiB
21Accepted54ms4728 KiB
22Accepted231ms11160 KiB
subtask50/25
23Wrong answer3ms4724 KiB
24Wrong answer4ms4752 KiB
25Wrong answer10ms4944 KiB
26Wrong answer16ms5020 KiB
27Wrong answer108ms7544 KiB
28Wrong answer167ms6492 KiB
29Wrong answer188ms7604 KiB
30Wrong answer270ms10172 KiB
subtask60/50
31Accepted3ms4752 KiB
32Wrong answer268ms11308 KiB
33Accepted3ms2436 KiB
34Accepted3ms2560 KiB
35Accepted4ms2508 KiB
36Accepted18ms2640 KiB
37Accepted3ms2848 KiB
38Accepted3ms2988 KiB
39Accepted3ms3192 KiB
40Wrong answer3ms3464 KiB
41Wrong answer3ms3648 KiB
42Wrong answer4ms3732 KiB
43Wrong answer8ms4000 KiB
44Wrong answer12ms4428 KiB
45Accepted3ms4164 KiB
46Accepted3ms4284 KiB
47Accepted4ms4380 KiB
48Accepted6ms4504 KiB
49Accepted20ms4712 KiB
50Accepted35ms4816 KiB
51Accepted54ms4728 KiB
52Accepted231ms11160 KiB
53Wrong answer3ms4724 KiB
54Wrong answer4ms4752 KiB
55Wrong answer10ms4944 KiB
56Wrong answer16ms5020 KiB
57Wrong answer108ms7544 KiB
58Wrong answer167ms6492 KiB
59Wrong answer188ms7604 KiB
60Wrong answer270ms10172 KiB
61Wrong answer16ms5072 KiB
62Wrong answer13ms5296 KiB
63Wrong answer14ms5012 KiB
64Accepted90ms8400 KiB
65Wrong answer12ms5132 KiB
66Wrong answer10ms5300 KiB
67Wrong answer14ms5292 KiB
68Wrong answer14ms5116 KiB
69Wrong answer159ms5316 KiB
70Time limit exceeded442ms10624 KiB