AtCoder:ABC086C - Travelingを解いてみた(仮)/C++
問題は以下の通りです
僕のこのコードではACされませんでした.
どこか見落としているので
わかる人は教えていただきたいです.
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
int N;
cin >> N;
for(int i =0 ; i<N; i++){
cin >> t[i] >> x[i] >> y[i];
}
for(int i =1 ; i<N; i++){
step[0] = t[0];
step[i] = t[i]-t[i-1];
}
int nowx=0,nowy=0;
int x_step,y_step;
for(int i=0;i<N; i++){
x_step = x[i] - nowx;
y_step = y[i] - nowy;
if(abs(x_step) > step[i]){
goto out;
}
step[i] -= abs(x_step);
nowx = x[i];
if(abs(y_step) > step[i] ){
goto out;
}
step[i] -= abs(y_step);
if(step[i]%2 == 0){
nowy = y[i];
}
else{
goto out;
}
}
if(nowx == x[N-1] && nowy == y[N-1]){
cout << "Yes" << endl;
}
else{
out:
cout << "No" << endl;
}
}