結果

問題 No.1036 Make One With GCD 2
ユーザー たたき@競プロたたき@競プロ
提出日時 2023-09-20 20:39:29
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,093 ms / 2,000 ms
コード長 667 bytes
コンパイル時間 6,265 ms
コンパイル使用メモリ 306,500 KB
実行使用メモリ 15,316 KB
最終ジャッジ日時 2023-09-20 20:39:59
合計ジャッジ時間 28,931 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,093 ms
15,276 KB
testcase_01 AC 363 ms
15,284 KB
testcase_02 AC 459 ms
15,156 KB
testcase_03 AC 54 ms
8,616 KB
testcase_04 AC 96 ms
13,692 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 131 ms
8,912 KB
testcase_08 AC 109 ms
8,656 KB
testcase_09 AC 358 ms
14,896 KB
testcase_10 AC 335 ms
14,772 KB
testcase_11 AC 367 ms
15,276 KB
testcase_12 AC 364 ms
15,176 KB
testcase_13 AC 552 ms
14,928 KB
testcase_14 AC 582 ms
15,060 KB
testcase_15 AC 522 ms
14,756 KB
testcase_16 AC 553 ms
15,048 KB
testcase_17 AC 542 ms
15,016 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 3 ms
4,380 KB
testcase_21 AC 3 ms
4,380 KB
testcase_22 AC 542 ms
14,800 KB
testcase_23 AC 380 ms
13,764 KB
testcase_24 AC 537 ms
14,936 KB
testcase_25 AC 513 ms
14,452 KB
testcase_26 AC 507 ms
14,732 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 1 ms
4,380 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 4 ms
4,376 KB
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 1 ms
4,376 KB
testcase_38 AC 446 ms
15,180 KB
testcase_39 AC 981 ms
15,148 KB
testcase_40 AC 381 ms
13,668 KB
testcase_41 AC 830 ms
15,316 KB
testcase_42 AC 787 ms
15,192 KB
testcase_43 AC 834 ms
15,284 KB
testcase_44 AC 887 ms
15,316 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint=modint998244353; //1000000007;
using ll=long long;
using pp=pair<int,int>;
#define sr string 
#define vc vector
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define pque priority_queue
#define bpc(a) __builtin_popcount(a)
ll op(ll a,ll b){return gcd(a,b);}
ll e(){return 0ll;}
int main(){
  int n;cin>>n;
  segtree<ll,op,e>sg(n);
  rep(i,n){
    ll a;cin>>a;
    sg.set(i,a);
  }
  ll ans=0;
  auto f=[&](ll a){return a!=1;};
  rep(i,n)ans+=n-sg.max_right(i,f);
  cout<<ans;
}
0