結果
| 問題 | No.1036 Make One With GCD 2 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-24 21:31:16 |
| 言語 | C++17(gcc12) (gcc 12.4.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 1,142 ms / 2,000 ms |
| コード長 | 790 bytes |
| 記録 | |
| コンパイル時間 | 811 ms |
| コンパイル使用メモリ | 119,716 KB |
| 実行使用メモリ | 7,424 KB |
| 最終ジャッジ日時 | 2026-06-09 16:52:45 |
| 合計ジャッジ時間 | 7,885 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 41 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:23:29: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
23 | for (auto &&k : v) scanf("%lld", &k);
| ~~~~~^~~~~~~~~~~~
ソースコード
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>
static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;
template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;
int main() {
int n;
cin >> n;
vector<ll> v(n);
for (auto &&k : v) scanf("%lld", &k);
ll ans = 0;
vector<map<ll, ll>> X(2);
for (int i = 0; i < n; ++i) {
int now = i&1, nxt = now^1;
X[now].clear();
for (auto &&j : X[nxt]) {
X[now][__gcd(j.first, v[i])] += j.second;
}
X[now][v[i]]++;
ans += X[now][1];
}
cout << ans << "\n";
return 0;
}