C. Cave Painting
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Imp is watching a documentary about cave painting.

Some numbers, carved in chaotic order, immediately attracted his attention. Imp rapidly proposed a guess that they are the remainders of division of a number n by all integers i from 1 to k. Unfortunately, there are too many integers to analyze for Imp.

Imp wants you to check whether all these remainders are distinct. Formally, he wants to check, if all 1 ≤ i ≤ k, are distinct, i. e. there is no such pair (i, j) that:

  • 1 ≤ i < j ≤ k,
  • , where  is the remainder of division x by y.
Input

The only line contains two integers nk (1 ≤ n, k ≤ 1018).

Output

Print "Yes", if all the remainders are distinct, and "No" otherwise.

You can print each letter in arbitrary case (lower or upper).

Examples
input
Copy
4 4
output
No
input
Copy
5 3
output
Yes
Note

In the first sample remainders modulo 1 and 4 coincide.


题意:问是否存在2个数i,j属于1~k(i!=j),使得n%i==n%j

思路:一开始在想有没有办法用log的做法,因为数据到1E18了. 没想出来,琢磨着暴力了一发,感觉好像如果K很大,结果应该很明显不行,暴力15ms AC...始终感觉是套路


#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define bug cout << "bug" << endl
#pragma comment(linker, "/STACK:102400000,102400000")


using namespace std;
typedef long long ll;

const int MAX_N=1e5+5;
map<ll,int>mp;

int main(void){
    ll n,k;
    cin >> n>>k;
    for(ll i=1;i<=k;i++){
        ll t=n%i;
        if(mp[t]){
            cout <<"NO"<<endl;
            return 0;
        }
        mp[t]=1;
    }
    cout <<"YES"<<endl;
}