結果
| 問題 |
No.1673 Lamps on a line
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-10 21:55:33 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 221 ms / 2,000 ms |
| コード長 | 379 bytes |
| コンパイル時間 | 2,471 ms |
| コンパイル使用メモリ | 192,668 KB |
| 最終ジャッジ日時 | 2025-01-24 10:24:56 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int N, Q;
cin >> N >> Q;
vector<int> A(N);
int cnt = 0;
for(int i = 0; i < Q; i++){
int R, L;
cin >> L >> R;
L--;
for(int j = L; j < R; j++){
A[j]++;
if(A[j] % 2 == 1) cnt++;
else cnt--;
}
cout << cnt << endl;
}
}