結果

問題 No.917 Make One With GCD
ユーザー 東前頭十一枚目
提出日時 2019-10-26 02:18:26
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 382 bytes
コンパイル時間 1,720 ms
コンパイル使用メモリ 176,948 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-13 13:58:04
合計ジャッジ時間 2,840 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 18 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n; cin >> n;
	int a[n]; for(int i = 0; i < n; ++i) cin >> a[i];
	map<int, int> ans;
	ans[a[0]] = 1;
	for(int i = 1; i < n; ++i) {
		map<int, int> ret;
		for(auto e : ans) {
			ret[e.first] += e.second;
			ret[__gcd(e.first, a[i])] += e.second;
		}
		ret[a[i]]++;
		ans = ret;
	}
	cout << ans[1] << '\n';
	return 0;
}
0