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

Full text and comments »

  • Vote: I like it
  • -20
  • Vote: I do not like it

By swagata93, history, 5 years ago, In English

I couldn't understand the meaning of the following code which is part of a program...It will be very helpful if anyone clarify this...Thank you all!!

#ifdef ONPC
  mt19937 rnd(228);
#else
  mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

Full text and comments »

  • Vote: I like it
  • +8
  • Vote: I do not like it