こかもと

わっしょい

AtCoder:ABC086C - Travelingを解いてみた(仮)/C++

問題は以下の通りです

atcoder.jp

f:id:KOKAMOTO:20210411173800p:plain

僕のこのコードではACされませんでした.

どこか見落としているので

わかる人は教えていただきたいです.

#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(infor (int i = 0; i < (int)(n); i++)


int main(){
  int N;
  cin >> N;
  vector<intx(N);
  vector<inty(N);
  vector<intt(N);
  vector<intstep(N);
  for(int i =0 ; i<Ni++){
    cin >> t[i] >> x[i] >> y[i];
  }
  for(int i =1 ; i<Ni++){
    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<Ni++){

    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;
  }
}