Submission #4050016
Source Code Expand
#include <iostream> #include <algorithm> #include <string> using namespace std; int main(){ int n, t[2], x[2], y[2]; bool ans=true; t[0] = 0; x[0] = 0; y[0] = 0; cin >> n; for(int i=0; i<n; i++){ if(i>0){ t[0] = t[1]; x[0] = x[1]; y[0] = y[1]; } cin >> t[1] >> x[1] >> y[1]; int t2, x2, y2; t2 = t[1] - t[0]; x2 = abs(x[1] - x[0]); y2 = abs(y[1] - y[0]); if(t2 < x2 + y2 || t2%2 != (x2 + y2)%2){ ans = false; } } if(ans) cout << "Yes" << endl; else cout << "No" << endl; }
Submission Info
Submission Time | |
---|---|
Task | C - Traveling |
User | noko206 |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 626 Byte |
Status | AC |
Exec Time | 89 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
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 | 89 ms | 256 KB |
1_005.txt | AC | 82 ms | 256 KB |
1_006.txt | AC | 73 ms | 256 KB |
1_007.txt | AC | 12 ms | 256 KB |
1_008.txt | AC | 1 ms | 256 KB |
1_009.txt | AC | 17 ms | 256 KB |
1_010.txt | AC | 1 ms | 256 KB |
1_011.txt | AC | 10 ms | 256 KB |
1_012.txt | AC | 1 ms | 256 KB |