please explain!!

Revision en1, by swagata93, 2019-05-29 07:56:00

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

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English swagata93 2019-05-29 07:56:00 610 Initial revision (published)