C. Koxia and Number Theory (线性同余)https://codeforces.com/contest/1770/problem/C
https://codeforces.com/contest/1770/attachments/download/18470/editorial.pdf
这个pdf都写得很明白了,这个c题终于懂了,麻了à$a_i^j \leq b^j$
本来只需要枚举n/2之内的质数,但是因为n很小,所以直接枚举n/2也可以
- 对于给定的 $x$,让我们记 $b_i = a_i + x$。条件「 $gcd(b_i,b_j) = 1$对于 恒成 $1 \leq i < j \leq n$立」等价于「每个质数 $p$ 只能整除至多一个 $b_i$」。那么,对于一个质数 $p$,我们能否判断 $p$, 是否总是整除至少两个 $b_i$(无论$x$的取值)
点通我的就是这句话
#include<bits/stdc++.h> #define debug1(a) cout<<#a<<'='<< a << endl; #define debug2(a,b) cout<<#a<<" = "<<a<<" "<<#b<<" = "<<b<<endl; #define debug3(a,b,c) cout<<#a<<" = "<<a<<" "<<#b<<" = "<<b<<" "<<#c<<" = "<<c<<endl; #define debug4(a,b,c,d) cout<<#a<<" = "<<a<<" "<<#b<<" = "<<b<<" "<<#c<<" = "<<c<<" "<<#d<<" = "<<d<<endl; #define debug5(a,b,c,d,e) cout<<#a<<" = "<<a<<" "<<#b<<" = "<<b<<" "<<#c<<" = "<<c<<" "<<#d<<" = "<<d<<" "<<#e<<" = "<<e<<endl; #define debug0(x) cout << "debug0: " << x << endl #define fr(t, i, n)for (long long i = t; i < n; i++) #define YES cout<<"Yes"<<endl #define nO cout<<"no"<<endl #define fi first #define se second #define int long long using namespace std; typedef long long LL; typedef unsigned long long ULL; typedef pair<int,int> PII; typedef pair<LL,LL> PLL; //#pragma GCC optimize(3,"Ofast","inline") //#pragma GCC optimize(2) const int N = 110; int a[N]; bool solve() { int n;cin >> n; for(int i = 0;i < n;i ++)cin >> a[i]; sort(a,a+n); for(int i = 1;i < n;i ++) if(a[i] == a[i-1]) { return 0; } bool acc = 1; for(int i = 2;i <= n;i ++) { vector<int> num(i,0); for(int j = 0;j < n;j ++)num[a[j] % i]++; if(*min_element(num.begin(),num.end()) >= 2)acc = 0; } return acc; } signed main() { /* ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); */ int T = 1;cin >> T; while(T--){ puts(solve()?"YES":"NO"); } return 0; } /* */