Submission #20081633
Source Code Expand
#include<iostream>
using namespace std;
int distance(int x,int y,int xnow,int ynow){
return abs(x-xnow)+abs(y-ynow);
}
int main (){
int N,i,t,x,y,tnow=0,xnow=0,ynow=0;
bool flag=true;
cin >> N;
for(i=0;i<N;i++){
cin >> t >> x >> y;
if((distance(x,y,xnow,ynow)) > t-tnow) {
flag = false;
break;
}
if((distance(x,y,xnow,ynow)+t-tnow)%2){
flag = false;
break;
}
tnow=t;
xnow=x;
ynow=y;
}
if(flag) cout << "Yes" << endl;
else cout << "No" << endl;
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - Traveling |
| User | runnerof428 |
| Language | C++ (GCC 9.2.1) |
| Score | 300 |
| Code Size | 625 Byte |
| Status | AC |
| Exec Time | 63 ms |
| Memory | 3620 KiB |
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, after_contest_01.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 0_000.txt | AC | 9 ms | 3600 KiB |
| 0_001.txt | AC | 2 ms | 3404 KiB |
| 0_002.txt | AC | 2 ms | 3516 KiB |
| 1_003.txt | AC | 4 ms | 3432 KiB |
| 1_004.txt | AC | 63 ms | 3620 KiB |
| 1_005.txt | AC | 3 ms | 3432 KiB |
| 1_006.txt | AC | 58 ms | 3432 KiB |
| 1_007.txt | AC | 20 ms | 3428 KiB |
| 1_008.txt | AC | 3 ms | 3576 KiB |
| 1_009.txt | AC | 6 ms | 3604 KiB |
| 1_010.txt | AC | 5 ms | 3576 KiB |
| 1_011.txt | AC | 5 ms | 3404 KiB |
| 1_012.txt | AC | 3 ms | 3404 KiB |
| after_contest_01.txt | AC | 2 ms | 3564 KiB |