-
Notifications
You must be signed in to change notification settings - Fork 0
/
SVAREA11.cpp
45 lines (42 loc) · 945 Bytes
/
SVAREA11.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int t;
scanf("%d",&t);
for(int j=1;j<=t;j++)
{
long long n,a,pfinal,ans=0,p,q;
scanf("%lld%lld",&n,&a);
for(int i=1;i<=a;i++)
{
scanf("%lld%lld",&p,&q);
if(i==1)
{
ans++;
pfinal=q;
}
else
{
if(p>=pfinal)
{
pfinal=q;
}
else
{
pfinal=q;
ans++;
}
}
}
if(ans<=n)
printf("Plan %d: Yes\n",j);
else
printf("Plan %d: No\n",j);
}
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
return 0;
}