TOPIC

Wrong answer (20%), mas passa por todos os casos

Luis Victor Porto Santos asked 8 months ago

include include include <bits/stdc++.h>

using namespace std; int main(){

  int p ,n, v[10];
  scanf("%d %d", &p, &n);
  //p é a altura e n é o numero de canos

  for(int i = 0; i < n; i++){
    scanf("%d", &v[i]);
  }

  for(int i = 0; i < n-1; i++){

  if(abs(v[i+1] - v[i]) <= (p)){
    printf("YOU WIN\n");
    i = n+1;

    }else{
        printf("GAME OVER\n");
        i = n+1;
    }}

  return 0;

}

This topic was solved and cannot recieve new replies.