結果
問題 | No.1514 Squared Matching |
ユーザー |
![]() |
提出日時 | 2021-05-21 21:54:47 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 688 bytes |
コンパイル時間 | 1,546 ms |
コンパイル使用メモリ | 168,276 KB |
実行使用メモリ | 784,848 KB |
最終ジャッジ日時 | 2024-10-10 08:28:56 |
合計ジャッジ時間 | 16,685 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 MLE * 16 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define ll long long#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)#define Pr pair<ll,ll>#define Tp tuple<ll,ll,ll>using Graph = vector<vector<Pr>>;ll mod = 998244353;int main() {ll N; cin >> N;ll nsf[N+1];rep(i,N+1){nsf[i] = i;}for(ll i=1;i<=N;i++){if(nsf[i]==i){rep(j,N){if(i*j*j>N) break;nsf[i*j*j] = i;}}}ll counter[N+1];ll k = N;rep(i,N+1){while((ll)i*k*k>N) k--;counter[i] = k;}ll ans = 0;rep(i,N){ans += counter[nsf[i+1]];}cout << ans << endl;}