30712023-02-14 10:00:47CWMÁruszállítás üres szakaszaicpp11Wrong answer 6/5096ms8224 KiB
// nemesGyak000.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
    int length, q;
    cin >> length >> q;
    vector<pair<int, int>> times;
    for (size_t i = 0; i < q; i++)
    {
        int p, n;
        cin >> p >> n;
        times.push_back({p,1});
        times.push_back({n,-1 });
    }
    sort(times.begin(), times.end());
    int Index = 1;
    int SUM = 0;
    int rn = 0;
    bool Switch = true;
    for (size_t i = 0; i < times.size(); i++)
    {
        SUM += times[i].second;
        if (times[i].first != Index) {
            Index = times[i].first;
            if (Switch && SUM == 0) {
                rn++;
                Switch = false;
            }
            if (SUM != 0) {
                Switch = true;
            }
        }
    }
    cout << rn;
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
SubtaskSumTestVerdictTimeMemory
base6/50
1Accepted0/03ms1812 KiB
2Wrong answer0/096ms6136 KiB
3Wrong answer0/23ms2228 KiB
4Wrong answer0/23ms2436 KiB
5Wrong answer0/23ms2524 KiB
6Accepted2/23ms2520 KiB
7Wrong answer0/23ms2648 KiB
8Wrong answer0/23ms2864 KiB
9Accepted2/22ms2948 KiB
10Accepted2/23ms2948 KiB
11Wrong answer0/23ms3076 KiB
12Wrong answer0/23ms3332 KiB
13Wrong answer0/38ms3924 KiB
14Wrong answer0/39ms4004 KiB
15Wrong answer0/37ms3880 KiB
16Wrong answer0/371ms7676 KiB
17Wrong answer0/372ms7948 KiB
18Wrong answer0/382ms7912 KiB
19Wrong answer0/39ms4444 KiB
20Wrong answer0/310ms4540 KiB
21Wrong answer0/387ms8116 KiB
22Wrong answer0/390ms8224 KiB