| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 942117 | dshfjka | Remittance (JOI19_remittance) | C++14 | 0 ms | 600 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define LL long long
using namespace std;
int main()
{
	LL n;
	scanf("%lld",&n);
	LL arr[n+5],tmp=-1;
	for(LL a=1;a<=n;a++)
	{
		LL x,y;
		scanf("%lld %lld",&x,&y);
		arr[a]=x-y;
		if(arr[a]<0)tmp=a;
	}
	LL now=0;
	if(tmp!=-1)
	{
		 now=arr[tmp];
		arr[tmp]=0;
	//	printf("tmp=%lld\n",tmp);
		for(LL a=tmp-1;a>=1;a--)
		{
			now*=2;
			arr[a]+=now;
			if(arr[a]<0)
			{
				now=arr[a];
				arr[a]=0;
			}
			else{
				now=0;
			}
			if(now<=-1e16)
			{
				printf("No\n");
				exit(0);
			}
		//	printf("arr[%lld] = %lld dan %lld\n",a,arr[a],now);
		}
		for(LL b=1;b<=60;b++)
		{
			for(LL a=n;a>=1;a--)
			{
			//	printf("now=%lld\n",now);
				now*=2;
				arr[a]+=now;
				if(arr[a]<0)
				{
					now=arr[a];
					arr[a]=0;
				}
				else{
					now=0;
				}
				if(now<=-1e16)
				{
					printf("No\n");
					exit(0);
				}
			}
			
			if(now==0)break;
		}
	}
	if(now<0){
		printf("No\n");
		exit(0);
	}
//	printf("SINI\n");
	for(LL b=1;b<=n;b++)
	{
		if(arr[b]>0 || arr[b]<0){
			printf("No\n");
			exit(0);
		}
	}
	printf("Yes\n");
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
