swagata93's blog

By swagata93, history, 5 years ago, In English

[contest:562 div2][problem:A] what is wrong with my solution? can anyone explain please??!!

#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,a,x,b,y;
    cin>> n>> a>> x>> b>> y;
    while(a<x && b>y){
        if(a==b){
            cout<< "YES";
            break;
        }
        if(a==n)
            a=1;
        else a++;
        if(b==1)
            b=n;
        else b--;
    }
    if(a==b)
        cout<< "YES";
    else
        cout<< "NO";
    return 0;
}
  • Vote: I like it
  • -20
  • Vote: I do not like it

| Write comment?