Submission #6065215


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
const int Maxn=200005;
struct work
{
	int a,b;
	bool operator < (const work &tmp) const
	{
		if(b==tmp.b) return a>tmp.a;
		return b>tmp.b;
	}
}W[Maxn];
int n,tim;
priority_queue <work> Pr;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&W[i].a,&W[i].b),Pr.push(W[i]);
	while(!Pr.empty())
	{
		work now=Pr.top();
		Pr.pop();
		if(tim+now.a>now.b)
		{
			printf("No");
			return 0;
		}
		tim+=now.a;
	}
	printf("Yes");
	return 0;
}

Submission Info

Submission Time
Task D - Megalomania
User sys
Language C++14 (GCC 5.4.1)
Score 400
Code Size 529 Byte
Status AC
Exec Time 69 ms
Memory 3444 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:17:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
                ^
./Main.cpp:19:46: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d",&W[i].a,&W[i].b),Pr.push(W[i]);
                                              ^

Judge Result

Set Name Sample Subtask1
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 32
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
Subtask1 sample_01.txt, sample_02.txt, sample_03.txt, sub1_01.txt, sub1_02.txt, sub1_03.txt, sub1_04.txt, sub1_05.txt, sub1_06.txt, sub1_07.txt, sub1_08.txt, sub1_09.txt, sub1_10.txt, sub1_11.txt, sub1_12.txt, sub1_13.txt, sub1_14.txt, sub1_15.txt, sub1_16.txt, sub1_17.txt, sub1_18.txt, sub1_19.txt, sub1_20.txt, sub1_21.txt, sub1_22.txt, sub1_23.txt, sub1_24.txt, sub1_25.txt, sub1_26.txt, sub1_27.txt, sub1_28.txt, sub1_29.txt
Case Name Status Exec Time Memory
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
sample_03.txt AC 1 ms 256 KB
sub1_01.txt AC 1 ms 256 KB
sub1_02.txt AC 67 ms 3444 KB
sub1_03.txt AC 24 ms 1912 KB
sub1_04.txt AC 41 ms 3444 KB
sub1_05.txt AC 1 ms 256 KB
sub1_06.txt AC 1 ms 256 KB
sub1_07.txt AC 38 ms 3444 KB
sub1_08.txt AC 65 ms 3444 KB
sub1_09.txt AC 1 ms 256 KB
sub1_10.txt AC 67 ms 3444 KB
sub1_11.txt AC 67 ms 3444 KB
sub1_12.txt AC 2 ms 384 KB
sub1_13.txt AC 2 ms 256 KB
sub1_14.txt AC 38 ms 2164 KB
sub1_15.txt AC 9 ms 768 KB
sub1_16.txt AC 69 ms 3444 KB
sub1_17.txt AC 8 ms 768 KB
sub1_18.txt AC 8 ms 768 KB
sub1_19.txt AC 2 ms 384 KB
sub1_20.txt AC 67 ms 3444 KB
sub1_21.txt AC 67 ms 3444 KB
sub1_22.txt AC 68 ms 3444 KB
sub1_23.txt AC 12 ms 1148 KB
sub1_24.txt AC 1 ms 256 KB
sub1_25.txt AC 1 ms 256 KB
sub1_26.txt AC 1 ms 256 KB
sub1_27.txt AC 2 ms 256 KB
sub1_28.txt AC 39 ms 3444 KB
sub1_29.txt AC 39 ms 3444 KB