40802023-03-13 08:42:12DragonoidOmegaA lehető legkevesebb átszállás (50 pont)cpp11Wrong answer 48/5064ms64424 KiB
#include <iostream>
#include <vector>
#include <queue>


#define F first
#define S second


using namespace std;

queue <int> q;
int n,veg,i,maxi,m,fe;

int main()
{
    cin>>n>>m;
    vector <pair <int,int> > x(n+1);

    for(i=1;i<=n;++i)
    {
        cin>>x[i].F>>x[i].S;
    }

    veg=1;
    i=1;
    while(i<=n)
    {
        while(x[i].F<=veg)
        {
            if(maxi<x[i].S)
            {
                maxi=x[i].S;
                fe=i;
            }
            ++i;
        }
        veg=maxi;
        q.push(fe);
        if(veg==m)
        {
            cout<<q.size()-1<<"\n";
            while(!q.empty())
            {
                cout<<q.front()<<" ";
                q.pop();
            }
            return 0;
        }
    }
  //  cout<<-1;

}
SubtaskSumTestVerdictTimeMemory
base48/50
1Accepted0/03ms1812 KiB
2Accepted0/08ms2260 KiB
3Wrong answer0/13ms2348 KiB
4Runtime error0/164ms64424 KiB
5Accepted2/23ms2660 KiB
6Accepted2/23ms2892 KiB
7Accepted2/23ms3100 KiB
8Accepted2/23ms3212 KiB
9Accepted2/24ms3212 KiB
10Accepted2/24ms3224 KiB
11Accepted2/24ms3508 KiB
12Accepted2/26ms3484 KiB
13Accepted2/23ms3628 KiB
14Accepted2/24ms3644 KiB
15Accepted2/24ms3652 KiB
16Accepted2/26ms3928 KiB
17Accepted2/27ms4068 KiB
18Accepted2/28ms4156 KiB
19Accepted2/28ms4032 KiB
20Accepted2/28ms4164 KiB
21Accepted2/28ms4216 KiB
22Accepted2/28ms4212 KiB
23Accepted2/28ms4464 KiB
24Accepted2/28ms4352 KiB
25Accepted2/28ms4388 KiB
26Accepted2/28ms4520 KiB
27Accepted2/28ms4556 KiB
28Accepted2/28ms4712 KiB