Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ∧_∧
- ( ・ω・。)つ━☆・*。
- ⊂ ノ ・゜
- しーJ Accepted
- */
- // #pragma GCC optimize("O3")
- // #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
- #include <bits/stdc++.h>
- #include <ext/pb_ds/assoc_container.hpp>
- #include <ext/pb_ds/tree_policy.hpp>
- #define ll long long
- #define all(x) begin(x), end(x)
- #define x first
- #define y second
- #define int long long
- using namespace std;
- using namespace __gnu_pbds;
- typedef long double ld;
- template<typename T>
- using kawaii_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
- const ld PI = atan2(0, -1);
- void seriy() {
- ios::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- cout << fixed << setprecision(14);
- #ifdef _offline
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif
- }
- const int MAXN = 1e6 + 10;
- const int MAXM = 600;
- const int INF = 1e9;
- const int BASE = 47;
- const int MOD = 43200;
- const int MAXLOG = 21;
- signed main() {
- seriy();
- int n, k;
- cin >> n >> k;
- vector<int> a(n);
- for(int i = 0; i < n; i++) {
- cin >> a[i];
- }
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < n; j++) {
- if(a[i] < a[j] && a[i] % k == a[j] % k) {
- swap(a[i], a[j]);
- }
- }
- }
- bool f = 0;
- for(int i = 1; i < n; i++) {
- if(a[i] < a[i - 1]) {
- f = 1;
- }
- }
- if(f) {
- cout << "NO";
- }
- else {
- cout << "YES";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement