File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < bits/stdc++.h>
2
+
3
+ using namespace std ;
4
+ using ll = int64_t ;
5
+ using ff = long double ;
6
+
7
+ int main () {
8
+ ios_base::sync_with_stdio (false );
9
+ cin.tie (0 ); cout.tie (0 );
10
+
11
+ int N, M, T;
12
+ cin >> N >> M >> T;
13
+
14
+ bool success = true ;
15
+ int time = 0 ;
16
+ int remaining = N;
17
+ for (int mm = 0 ; mm < M; ++mm) {
18
+ int A, B;
19
+ cin >> A >> B;
20
+ int consumed = A - time;
21
+ remaining -= consumed;
22
+ if (remaining <= 0 ) {
23
+ success = false ;
24
+ break ;
25
+ }
26
+ int charged = B - A;
27
+ remaining += charged;
28
+ remaining = min (remaining, N);
29
+ time = B;
30
+ }
31
+ int consumed = T - time;
32
+ remaining -= consumed;
33
+ if (remaining <= 0 ) success = false ;
34
+
35
+ cout << (success ? " Yes" : " No" ) << endl;
36
+
37
+ return 0 ;
38
+ }
You can’t perform that action at this time.
0 commit comments