結果

問題 No.1262 グラフを作ろう!
ユーザー kiyoshi0205kiyoshi0205
提出日時 2020-10-16 23:19:27
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 2,345 bytes
コンパイル時間 2,224 ms
コンパイル使用メモリ 181,292 KB
実行使用メモリ 121,784 KB
最終ジャッジ日時 2023-09-28 05:32:12
合計ジャッジ時間 225,287 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,301 ms
121,496 KB
testcase_01 AC 2,245 ms
121,564 KB
testcase_02 AC 2,332 ms
121,516 KB
testcase_03 AC 2,309 ms
121,468 KB
testcase_04 AC 1,939 ms
121,484 KB
testcase_05 AC 2,128 ms
121,548 KB
testcase_06 AC 1,972 ms
121,464 KB
testcase_07 AC 2,033 ms
121,436 KB
testcase_08 AC 2,285 ms
121,516 KB
testcase_09 AC 2,217 ms
121,488 KB
testcase_10 AC 2,153 ms
121,784 KB
testcase_11 AC 2,194 ms
121,508 KB
testcase_12 AC 2,346 ms
121,544 KB
testcase_13 AC 2,350 ms
121,456 KB
testcase_14 AC 2,128 ms
121,724 KB
testcase_15 AC 2,121 ms
121,568 KB
testcase_16 AC 2,274 ms
121,464 KB
testcase_17 AC 2,258 ms
121,460 KB
testcase_18 AC 2,366 ms
121,508 KB
testcase_19 AC 2,012 ms
121,444 KB
testcase_20 AC 2,104 ms
121,484 KB
testcase_21 AC 2,424 ms
121,500 KB
testcase_22 AC 2,016 ms
121,444 KB
testcase_23 AC 2,195 ms
121,448 KB
testcase_24 AC 2,288 ms
121,584 KB
testcase_25 AC 2,145 ms
121,724 KB
testcase_26 AC 2,089 ms
121,452 KB
testcase_27 AC 2,130 ms
121,492 KB
testcase_28 AC 2,130 ms
121,636 KB
testcase_29 AC 2,025 ms
121,640 KB
testcase_30 AC 2,144 ms
121,516 KB
testcase_31 AC 2,408 ms
121,472 KB
testcase_32 AC 2,217 ms
121,492 KB
testcase_33 AC 2,084 ms
121,460 KB
testcase_34 AC 2,152 ms
121,468 KB
testcase_35 AC 2,331 ms
121,504 KB
testcase_36 AC 2,039 ms
121,520 KB
testcase_37 AC 2,415 ms
121,456 KB
testcase_38 AC 2,189 ms
121,488 KB
testcase_39 AC 2,214 ms
121,632 KB
testcase_40 AC 2,197 ms
121,464 KB
testcase_41 AC 2,167 ms
121,468 KB
testcase_42 AC 2,349 ms
121,464 KB
testcase_43 AC 2,153 ms
121,544 KB
testcase_44 AC 2,210 ms
121,464 KB
testcase_45 AC 2,261 ms
121,488 KB
testcase_46 AC 2,074 ms
121,492 KB
testcase_47 AC 2,243 ms
121,468 KB
testcase_48 AC 2,258 ms
121,724 KB
testcase_49 AC 2,358 ms
121,728 KB
testcase_50 AC 2,302 ms
121,480 KB
testcase_51 AC 2,206 ms
121,456 KB
testcase_52 AC 2,302 ms
121,448 KB
testcase_53 AC 2,071 ms
121,476 KB
testcase_54 AC 2,314 ms
121,728 KB
testcase_55 AC 2,230 ms
121,504 KB
testcase_56 AC 2,064 ms
121,460 KB
testcase_57 AC 2,436 ms
121,724 KB
testcase_58 AC 2,285 ms
121,440 KB
testcase_59 AC 2,098 ms
121,456 KB
testcase_60 AC 2,429 ms
121,456 KB
testcase_61 AC 2,145 ms
121,516 KB
testcase_62 AC 2,393 ms
121,552 KB
testcase_63 AC 2,303 ms
121,552 KB
testcase_64 AC 2,243 ms
121,636 KB
testcase_65 AC 2,072 ms
121,660 KB
testcase_66 AC 2,209 ms
121,444 KB
testcase_67 AC 2,098 ms
121,728 KB
testcase_68 AC 2,044 ms
121,480 KB
testcase_69 AC 2,109 ms
121,476 KB
testcase_70 AC 2,263 ms
121,464 KB
testcase_71 AC 2,220 ms
121,520 KB
testcase_72 AC 2,243 ms
121,516 KB
testcase_73 AC 2,340 ms
121,492 KB
testcase_74 AC 2,133 ms
121,468 KB
testcase_75 AC 2,214 ms
121,456 KB
testcase_76 AC 2,266 ms
121,588 KB
testcase_77 AC 2,222 ms
121,720 KB
testcase_78 AC 2,214 ms
121,460 KB
testcase_79 AC 2,412 ms
121,452 KB
testcase_80 AC 2,227 ms
121,476 KB
testcase_81 AC 2,187 ms
121,520 KB
testcase_82 AC 2,327 ms
121,480 KB
testcase_83 AC 2,274 ms
121,656 KB
testcase_84 AC 2,140 ms
121,460 KB
testcase_85 AC 2,357 ms
121,496 KB
testcase_86 AC 2,256 ms
121,640 KB
testcase_87 AC 2,356 ms
121,460 KB
testcase_88 AC 2,275 ms
121,464 KB
testcase_89 AC 2,309 ms
121,472 KB
testcase_90 AC 2,100 ms
121,584 KB
testcase_91 AC 2,104 ms
121,448 KB
testcase_92 AC 2,163 ms
121,720 KB
testcase_93 AC 2,421 ms
121,460 KB
testcase_94 TLE -
testcase_95 AC 2,345 ms
121,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// #include<ext/pb_ds/tag_and_trait.hpp>
// using namespace __gnu_pbds;
// #include<boost/multiprecision/cpp_int.hpp>
// namespace multiprecisioninteger = boost::multiprecision;
// using cint=multiprecisioninteger::cpp_int;
using namespace std;
using ll=long long;
#define double long double
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
// using llset=tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>;
#define For(i,a,b) for(i=a;i<(ll)b;++i)
#define bFor(i,b,a) for(i=b,--i;i>=(ll)a;--i)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N,0)
#define brep1(i,N) bFor(i,N,1)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define eb emplace_back
#define print(x) cout<<x<<endl
#define printyes print("Yes")
#define printno print("No")
#define printYES print("YES")
#define printNO print("NO")
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
#define matoutput(v) do{for(auto outimat:v)output(outimat);}while(0)
const ll mod=1000000007;
// const ll mod=998244353;
const ll inf=1LL<<60;
const double PI=acos(-1);
const double eps=1e-9;
template<class T,class E> ostream& operator<<(ostream& os,pair<T,E>& p){return os<<"{"<<p.first<<","<<p.second<<"}";}
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;}
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;}

void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}

int M,phi[1000001];
ll ans;
vector<int> divisor[1000001];
int main(){
  startupcpp();
  int i,j;
  for(i=1;i<1000001;++i){
    phi[i]=i-phi[i];
    for(j=i;j<1000001;j+=i){
      divisor[j].eb(i);
      if(j!=i)phi[j]+=phi[i];
    }
  }
  cin>>M>>M;
  while(M--){
    cin>>i;
    // ans=0;
    for(auto d:divisor[i]){
      ans+=(i-1)%d*phi[i/d];
    }
    // print(ans);
  }
  print(ans);
}
0