結果
問題 | No.1505 Zero-Product Ranges |
ユーザー |
![]() |
提出日時 | 2023-08-01 13:30:04 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 396 bytes |
コンパイル時間 | 1,538 ms |
コンパイル使用メモリ | 195,360 KB |
最終ジャッジ日時 | 2025-02-15 21:17:55 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 WA * 31 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> zeros; for (int i = 0; i < n; i++) { int a; cin >> a; if (a == 0) zeros.push_back(i); } zeros.push_back(n); int ans = 0; for (int i = 0; i < n; i++) { auto it = lower_bound(zeros.begin(), zeros.end(), i); ans += n - (*it); } cout << ans << '\n'; return 0; }