結果
| 問題 | 
                            No.1505 Zero-Product Ranges
                             | 
                    
| コンテスト | |
| ユーザー | 
                             kekenx
                         | 
                    
| 提出日時 | 2023-08-01 13:10:27 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 411 bytes | 
| コンパイル時間 | 1,879 ms | 
| コンパイル使用メモリ | 194,628 KB | 
| 最終ジャッジ日時 | 2025-02-15 21:17:36 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / 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);
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    auto it = lower_bound(zeros.begin(), zeros.end(), i);
    if (it != zeros.end()) {
      ans += n - (*it);
    }
  }
  cout << ans << '\n';
  return 0;
}
            
            
            
        
            
kekenx