Submission #2868534


Source Code Expand

#include <iostream>
#include <cmath>

using namespace std;

int n;
int x=0,y=0;
int t=0,a,b,c;

int main()
{
	scanf("%d",&n);
	for (int i=0;i<n;i++)
	{
		scanf("%d %d %d",&c,&a,&b);
		if (abs(x-a)+abs(y-b)>c-t)
		{
			cout<<"No"<<endl;
			return 0;
		}
		if ((abs(x-a)+abs(y-b))%2==0&&(c-t)%2==1)
		{
			cout<<"No"<<endl;
			return 0;
		}
		if (((abs(x-a))+abs(y-b))%2==1&&(c-t)%2==0)
		{
			cout<<"No"<<endl;
			return 0;
		}
		x=a;
		y=b;
		t=c;
	}
	cout<<"Yes"<<endl;
	return 0;
}

Submission Info

Submission Time
Task C - Traveling
User luogu_bot4
Language C++ (GCC 5.4.1)
Score 0
Code Size 519 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:12:15: error: ‘scanf’ was not declared in this scope
  scanf("%d",&n);
               ^
./Main.cpp:21:27: error: invalid operands of types ‘__gnu_cxx::__enable_if<true, double>::__type {aka double}’ and ‘int’ to binary ‘operator%’
   if ((abs(x-a)+abs(y-b))%2==0&&(c-t)%2==1)
                           ^
./Main.cpp:26:29: error: invalid operands of types ‘__gnu_cxx::__enable_if<true, double>::__type {aka double}’ and ‘int’ to binary ‘operator%’
   if (((abs(x-a))+abs(y-b))%2==1&&(c-t)%2==0)
                             ^