結果
| 問題 | 
                            No.1505 Zero-Product Ranges
                             | 
                    
| コンテスト | |
| ユーザー | 
                             rieaaddlreiuu
                         | 
                    
| 提出日時 | 2022-11-05 13:52:04 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 408 bytes | 
| コンパイル時間 | 1,323 ms | 
| コンパイル使用メモリ | 166,660 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-07-19 07:28:30 | 
| 合計ジャッジ時間 | 3,052 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 48 WA * 1 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    long sum = 0;
    int length = 0;
    int t;
    scanf("%d",&N);
    for(int i=0;i<N;i++){
        scanf("%d",&t);
        if(t == 1){
            length++;
        } else {
            sum += length*(length+1)/2;
            length = 0;
        }
    }
    sum += length*(length+1)/2;
    printf("%ld",(long)N*((long)N + 1)/2-sum);
}
            
            
            
        
            
rieaaddlreiuu