Advertisement
GerONSo

Untitled

Nov 22nd, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. /*
  2.  
  3. ∧_∧
  4. ( ・ω・。)つ━☆・*。
  5. ⊂  ノ    ・゜
  6. しーJ   Accepted
  7.  
  8. */
  9.  
  10.  
  11.  
  12. // #pragma GCC optimize("O3")
  13. // #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
  14.  
  15. #include <bits/stdc++.h>
  16. #include <ext/pb_ds/assoc_container.hpp>
  17. #include <ext/pb_ds/tree_policy.hpp>
  18.  
  19. #define ll long long
  20. #define all(x) begin(x), end(x)
  21. #define x first
  22. #define y second
  23. #define int long long
  24.  
  25. using namespace std;
  26. using namespace __gnu_pbds;
  27.  
  28. typedef long double ld;
  29. template<typename T>
  30. using kawaii_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
  31.  
  32. const ld PI = atan2(0, -1);
  33.  
  34. void seriy() {
  35. ios::sync_with_stdio(0);
  36. cin.tie(0);
  37. cout.tie(0);
  38. cout << fixed << setprecision(14);
  39. #ifdef _offline
  40. freopen("input.txt", "r", stdin);
  41. freopen("output.txt", "w", stdout);
  42. #endif
  43. }
  44.  
  45. const int MAXN = 1e6 + 10;
  46. const int MAXM = 600;
  47. const int INF = 1e9;
  48. const int BASE = 47;
  49. const int MOD = 43200;
  50. const int MAXLOG = 21;
  51.  
  52. signed main() {
  53. seriy();
  54. int n, k;
  55. cin >> n >> k;
  56. vector<int> a(n);
  57. for(int i = 0; i < n; i++) {
  58. cin >> a[i];
  59. }
  60. for(int i = 0; i < n; i++) {
  61. for(int j = 0; j < n; j++) {
  62. if(a[i] < a[j] && a[i] % k == a[j] % k) {
  63. swap(a[i], a[j]);
  64. }
  65. }
  66. }
  67. bool f = 0;
  68. for(int i = 1; i < n; i++) {
  69. if(a[i] < a[i - 1]) {
  70. f = 1;
  71. }
  72. }
  73. if(f) {
  74. cout << "NO";
  75. }
  76. else {
  77. cout << "YES";
  78. }
  79. return 0;
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement