結果
問題 |
No.1505 Zero-Product Ranges
|
ユーザー |
|
提出日時 | 2021-09-09 17:14:26 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 448 bytes |
コンパイル時間 | 2,485 ms |
コンパイル使用メモリ | 190,056 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-30 18:59:35 |
合計ジャッジ時間 | 6,562 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 45 WA * 4 |
ソースコード
#define _GLIBCXX_DEBUG #define ll long long #include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<ll> S(200002); for(int i = 1; i < 200000; i++){ S[i] = S[i-1] + i; } long long ans = S[N]; int len = 0; for(int i = 0; i < N; i++){ int A; cin >> A; if(A == 1) len++; else{ ans -= S[len]; len = 0; } if(i+1 == N){ ans -= S[len]; } } cout << ans << endl; }