Advertisement
erfanul007

Untitled

Feb 21st, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. typedef unsigned long long int ull;
  5. typedef long long int ll;
  6. typedef vector<int> vi;
  7. typedef vector<ll> vll;
  8. typedef vector<vi> vvi;
  9. typedef pair<ll,ll> pll;
  10. typedef vector< pll > vpll;
  11. typedef set<int> sti;
  12.  
  13. #define sc scanf
  14. #define pf printf
  15. #define sci(n) scanf("%d",&n)
  16. #define scl(n) scanf("%lld",&n)
  17. #define scd(n) scanf("%lf",&n)
  18. #define scs(s) scanf("%s",s)
  19. #define pfi(n) printf("%d",n)
  20. #define pfl(n) printf("%lld",n)
  21. #define pff(n) cout<<n
  22. #define line printf("\n")
  23. #define spc printf(" ")
  24. #define loop(i,x,y) for(int i=int(x); i<=int(y); i++)
  25. #define rloop(i,y,x) for(int i=int(y); i>=int(x); i--)
  26. #define cspf(i) printf("Case %d: ", i)
  27. #define pb push_back
  28. #define mp make_pair
  29. #define ff first
  30. #define ss second
  31. #define all(v) v.begin(),v.end()
  32. #define rall(v) v.rbegin(),v.rend()
  33. #define read() freopen("input.txt", "r", stdin)
  34. #define write() freopen("output.txt", "w", stdout)
  35. /// Constants
  36. #define eps 1e-9
  37. #define PI acos(-1.0) // 3.1415926535897932
  38. #define MAX 1000009
  39.  
  40.  
  41. int main()
  42. {
  43. ll n,k;
  44. scl(n),scl(k);
  45. ll x=(k*k)-k;
  46. if(x<n){
  47. pf("NO\n");
  48. return 0;
  49. }
  50. ll cnt=0;
  51. pf("YES\n");
  52. for(int i=1;i<=k;i++){
  53. for(int j=i+1;j<=k;j++){
  54. if(cnt==n)
  55. return 0;
  56. cnt++;
  57. pfi(i);spc;pfi(j);line;
  58. if(cnt==n)
  59. return 0;
  60. cnt++;
  61. pfi(j);spc;pfi(i);line;
  62. }
  63. }
  64. return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement