Submission #2202537


Source Code Expand

Copy
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N; cin >> N;
  int t[N], x[N], y[N];
  FOR(i,0,N) {
    cin >> t[i] >> x[i] >> y[i];
  }
  bool ok = true;
  if(t[0]-(x[0]+y[0])<0) ok = false;
  if((t[0]-(x[0]+y[0]))%2==1) ok = false;
  FOR(i,0,N-1) {
    int nokori = (t[i+1]-t[i])-(abs(x[i+1]-x[i])+abs(y[i+1]-y[i]));
    if(nokori<0) ok = false;
    if(nokori%2==1) ok = false;
  }
  cout << (ok ? "Yes" : "No") << endl;
  return 0;
}

Submission Info

Submission Time
Task ABC086C - Traveling
User nenuon
Language C++14 (GCC 5.4.1)
Score 300
Code Size 976 Byte
Status
Exec Time 23 ms
Memory 1408 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_000.txt, 0_001.txt, 0_002.txt
All 300 / 300 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt
Case Name Status Exec Time Memory
0_000.txt 1 ms 256 KB
0_001.txt 1 ms 256 KB
0_002.txt 1 ms 256 KB
1_003.txt 1 ms 256 KB
1_004.txt 23 ms 1408 KB
1_005.txt 23 ms 1408 KB
1_006.txt 21 ms 1408 KB
1_007.txt 4 ms 384 KB
1_008.txt 1 ms 256 KB
1_009.txt 5 ms 512 KB
1_010.txt 1 ms 256 KB
1_011.txt 4 ms 384 KB
1_012.txt 1 ms 256 KB