結果
| 問題 | No.8044 April Sum of Odd |
| コンテスト | |
| ユーザー |
a01sa01to
|
| 提出日時 | 2024-11-01 01:02:32 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 24 ms / 2,000 ms |
| + 406µs | |
| コード長 | 682 bytes |
| 記録 | |
| コンパイル時間 | 2,172 ms |
| コンパイル使用メモリ | 338,648 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-09-19 08:03:19 |
| 合計ジャッジ時間 | 3,993 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "settings/debug.cpp"
#else
#define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;
int main() {
int n, m;
cin >> n >> m;
vector<int> a(n);
rep(i, n) cin >> a[i];
vector<tuple<int, int, ll>> rle(1, { a[0] % 2, 0, 0 });
rep(i, n) {
if (get<0>(rle.back()) == a[i] % 2) {
get<1>(rle.back())++;
get<2>(rle.back()) += a[i];
}
else {
rle.push_back({ a[i] % 2, 1, a[i] });
}
}
for (auto [parity, cnt, sum] : rle) {
if (parity == 1 && cnt >= m) cout << sum << endl;
}
return 0;
}
a01sa01to