結果
| 問題 | No.719 Coprime |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-12-21 10:42:14 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 726 bytes |
| 記録 | |
| コンパイル時間 | 1,737 ms |
| コンパイル使用メモリ | 165,852 KB |
| 実行使用メモリ | 7,852 KB |
| 最終ジャッジ日時 | 2025-12-21 10:42:19 |
| 合計ジャッジ時間 | 4,518 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 WA * 44 |
ソースコード
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=10010;
const int mod=998244353;
int n;
int ans;
vector<int>D[N];
bool vis[N];
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
// freopen("score.in","r",stdin);
// freopen("score.out","w",stdout);
for(int i=2;i<=N-10;i++){
for(int j=i;j<=N-10;j+=i){
D[j].push_back(i);
}
}
cin>>n;
for(int i=2;i<=n;i++){
int cnt=i;
for(int j=1;j<=i;j++)vis[j]=0;
for(auto x:D[i])vis[x]=1;
for(int j=i-1;j>=2;j--){
bool fl=1;
for(auto x:D[j]){
if(vis[x]){
fl=0;
break;
}
}
if(!fl)continue;
cnt+=j;
for(auto x:D[j])vis[x]=1;
}
ans=max(ans,cnt);
}
cout<<ans<<"\n";
return 0;
}
/*
*/
vjudge1