diff options
Diffstat (limited to 'codeforces/DifferenceOperations/main.cpp')
| -rw-r--r-- | codeforces/DifferenceOperations/main.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/codeforces/DifferenceOperations/main.cpp b/codeforces/DifferenceOperations/main.cpp new file mode 100644 index 0000000..7594a5c --- /dev/null +++ b/codeforces/DifferenceOperations/main.cpp @@ -0,0 +1,23 @@ +#include <bits/stdc++.h> + +using namespace std; + +int main() { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while (tt--) { + int n; + cin >> n; + vector<int> v(n); + for (int &x : v) + cin >> x; + bool ok = true; + for (int i = 1; i < n; ++i) { + if (v[i] % v[0]) + ok = false; + } + cout << (ok ? "YES" : "NO") << endl; + } +} |
