結果
| 問題 |
No.1765 While Shining
|
| コンテスト | |
| ユーザー |
houren
|
| 提出日時 | 2021-11-26 22:58:36 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 33 ms / 2,000 ms |
| コード長 | 508 bytes |
| コンパイル時間 | 1,478 ms |
| コンパイル使用メモリ | 167,624 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-29 18:25:04 |
| 合計ジャッジ時間 | 2,823 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
int main(){
int n;
cin >> n;
ll ans = 0, pls[] = {0,0};
rep(i,n-1){
int a;
cin >> a;
if(!a){
pls[i%2] = 0;
ans += pls[!(i%2)];
}
else{
pls[!(i%2)] = 0;
ans += ++pls[i%2];
}
}
cout << ans << endl;
return 0;
}
houren