Submission #2983333


Source Code Expand

#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e15;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> t(n + 1), x(n + 1), y(n + 1);
    t[0] = x[0] = y[0] = 0;
    rep(i, 1, n + 1) cin >> t[i] >> x[i] >> y[i];
    bool f = true;
    rep(i, 1, n + 1){
        int diff = abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]);
        int tm = t[i] - t[i - 1];
        if(diff <= tm && diff % 2 == tm % 2) ;
        else f = false;
    }
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Submission Info

Submission Time
Task C - Traveling
User treeone
Language C++14 (GCC 5.4.1)
Score 300
Code Size 868 Byte
Status AC
Exec Time 23 ms
Memory 2560 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 13
Set Name Test Cases
Sample 0_000.txt, 0_001.txt, 0_002.txt
All 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 AC 1 ms 256 KB
0_001.txt AC 1 ms 256 KB
0_002.txt AC 1 ms 256 KB
1_003.txt AC 1 ms 256 KB
1_004.txt AC 22 ms 2560 KB
1_005.txt AC 23 ms 2560 KB
1_006.txt AC 20 ms 2560 KB
1_007.txt AC 4 ms 640 KB
1_008.txt AC 1 ms 256 KB
1_009.txt AC 5 ms 768 KB
1_010.txt AC 1 ms 256 KB
1_011.txt AC 4 ms 512 KB
1_012.txt AC 1 ms 256 KB