QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#595759#3130. Are They All Integers?May_27th#AC ✓1ms3728kbC++201.1kb2024-09-28 14:25:212024-09-28 14:25:22

Judging History

你现在查看的是最新测评结果

  • [2024-09-28 14:25:22]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3728kb
  • [2024-09-28 14:25:21]
  • 提交

answer

// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
#include<bits/stdc++.h>
  
using namespace std;
  
#define i64 long long
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()

const int MAXN = 2e5 + 5;
int N;
int a[MAXN];
void Solve(void) {
  cin >> N;
  for (int i = 1; i <= N; i ++) {
    cin >> a[i];
  }
  for (int i = 1; i < N; i ++) {
    for (int j = i + 1; j < N; j ++) {
      for (int z = j + 1; z <= N; z ++) {
        if ((a[i] - a[j]) % a[z] != 0) {
          cout << "no" << "\n";
          return;
        }
        if ((a[i] - a[z]) % a[j] != 0) {
          cout << "no" << "\n";
          return;
        }
        if ((a[z] - a[j]) % a[i] != 0) {
          cout << "no" << "\n";
          return;
        }
      }
    }
  }
  cout << "yes" << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  cout << fixed << setprecision(10);
  int Tests = 1; // cin >> Tests; 
  for (int i = 1; i <= Tests; i ++) {
    // cout << "Case " << i << ": ";
    Solve();    
  }
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3584kb

input:

5
1 1 1 1 4

output:

yes

result:

ok single line: 'yes'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

5
1 2 4 8 16

output:

no

result:

ok single line: 'no'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3676kb

input:

3
1 1 4

output:

yes

result:

ok single line: 'yes'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3708kb

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: 3676kb

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: 3676kb

input:

7
9 9 9 9 9 9 99

output:

yes

result:

ok single line: 'yes'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3728kb

input:

7
7 7 7 77 77 77 77

output:

no

result:

ok single line: 'no'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

5
1 1 1 99 100

output:

no

result:

ok single line: 'no'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3652kb

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: 3644kb

input:

5
1 1 1 1 4

output:

yes

result:

ok single line: 'yes'

Test #11:

score: 0
Accepted
time: 1ms
memory: 3716kb

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: 3672kb

input:

3
32 64 96

output:

no

result:

ok single line: 'no'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

3
3 3 87

output:

yes

result:

ok single line: 'yes'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3728kb

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: 0ms
memory: 3676kb

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: 0ms
memory: 3716kb

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: 3592kb

input:

5
1 2 4 8 16

output:

no

result:

ok single line: 'no'