QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#741964 | #3130. Are They All Integers? | ucup-team5226# | AC ✓ | 1ms | 3784kb | C++20 | 1.0kb | 2024-11-13 15:32:59 | 2024-11-13 15:33:00 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define ov4(a, b, c, d, name, ...) name
#define rep3(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define rep2(i, a, b) rep3(i, a, b, 1)
#define rep1(i, n) rep2(i, 0, n)
#define rep0(n) rep1(aaaaa, n)
#define rep(...) ov4(__VA_ARGS__, rep3, rep2, rep1, rep0)(__VA_ARGS__)
const ll INF = LLONG_MAX / 4;
template <class T>
using vc = vector<T>;
template <class T>
using vvc = vc<vector<T>>;
void solve() {
ll n;
cin >> n;
vc<ll> a(n);
rep(i, n) cin >> a[i];
bool ok = true;
rep(i, n) rep(j, n) rep(k, n) {
if (i == j) continue;
if (i == k) continue;
if (k == j) continue;
ll v1 = abs(a[i] - a[j]), v2 = a[k];
if (v1 % v2) ok = false;
}
cout << (ok ? "yes" : "no") << endl;
}
int main() {
cin.tie(0)->sync_with_stdio(0);
cout << fixed << setprecision(20);
ll t = 1;
// cin >> t;
for (int i = 1; i <= t; i++) solve();
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3456kb
input:
5 1 1 1 1 4
output:
yes
result:
ok single line: 'yes'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
5 1 2 4 8 16
output:
no
result:
ok single line: 'no'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3440kb
input:
3 1 1 4
output:
yes
result:
ok single line: 'yes'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3560kb
input:
50 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 96
output:
yes
result:
ok single line: 'yes'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
12 9 10 11 12 13 13 13 13 13 14 14 14
output:
no
result:
ok single line: 'no'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
7 9 9 9 9 9 9 99
output:
yes
result:
ok single line: 'yes'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
7 7 7 7 77 77 77 77
output:
no
result:
ok single line: 'no'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3516kb
input:
5 1 1 1 99 100
output:
no
result:
ok single line: 'no'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
8 100 100 100 100 100 100 100 100
output:
yes
result:
ok single line: 'yes'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
5 1 1 1 1 4
output:
yes
result:
ok single line: 'yes'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3452kb
input:
50 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96
output:
yes
result:
ok single line: 'yes'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
3 32 64 96
output:
no
result:
ok single line: 'no'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
3 3 3 87
output:
yes
result:
ok single line: 'yes'
Test #14:
score: 0
Accepted
time: 1ms
memory: 3520kb
input:
50 2 5 9 10 12 14 14 15 17 17 18 18 18 19 20 23 24 26 27 27 27 33 34 37 45 47 47 49 50 53 56 61 62 63 65 66 67 70 76 80 82 85 87 90 90 91 98 98 99 99
output:
no
result:
ok single line: 'no'
Test #15:
score: 0
Accepted
time: 1ms
memory: 3560kb
input:
50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 100
output:
yes
result:
ok single line: 'yes'
Test #16:
score: 0
Accepted
time: 1ms
memory: 3448kb
input:
50 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 97
output:
no
result:
ok single line: 'no'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
5 1 2 4 8 16
output:
no
result:
ok single line: 'no'