Submission #19724961


Source Code Expand

Copy
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <algorithm>

using namespace std;

#define rep(i,s,N) for(int i=s;i<N;i++)
typedef long long int lli;

int main(void)
{
	int N, M, T; cin >> N >> M >> T;
	int maxN = N;
	vector<int> A(M + 1), B(M + 1);
	rep(i, 0, M)cin >> A[i] >> B[i+1];
	A[M] = T, B[0] = 0;
	string ans = "Yes";
	rep(i, 0, M + 1) {
		if (N <= A[i] - B[i]) {
			ans = "No";
			break;
		}
		N -= A[i] - B[i];
		if (i < M)N = min(N + B[i + 1] - A[i], maxN);
	}
	cout << ans << endl;

	return 0;
}

Submission Info

Submission Time
Task B - Smartphone Addiction
User negativethinker
Language C++ (GCC 9.2.1)
Score 200
Code Size 629 Byte
Status AC
Exec Time 7 ms
Memory 3612 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 5
AC × 21
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_05.txt
All handmade_00.txt, handmade_01.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_05.txt
Case Name Status Exec Time Memory
handmade_00.txt AC 7 ms 3548 KB
handmade_01.txt AC 3 ms 3496 KB
random_00.txt AC 7 ms 3504 KB
random_01.txt AC 2 ms 3472 KB
random_02.txt AC 3 ms 3612 KB
random_03.txt AC 4 ms 3408 KB
random_04.txt AC 2 ms 3472 KB
random_05.txt AC 5 ms 3496 KB
random_06.txt AC 2 ms 3600 KB
random_07.txt AC 2 ms 3468 KB
random_08.txt AC 4 ms 3472 KB
random_09.txt AC 6 ms 3540 KB
random_10.txt AC 3 ms 3472 KB
random_11.txt AC 4 ms 3404 KB
random_12.txt AC 4 ms 3560 KB
random_13.txt AC 4 ms 3560 KB
sample_01.txt AC 2 ms 3472 KB
sample_02.txt AC 2 ms 3460 KB
sample_03.txt AC 2 ms 3472 KB
sample_04.txt AC 2 ms 3548 KB
sample_05.txt AC 2 ms 3472 KB