結果
| 問題 | No.1673 Lamps on a line |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-10 21:25:13 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 225 ms / 2,000 ms |
| コード長 | 373 bytes |
| 記録 | |
| コンパイル時間 | 1,784 ms |
| コンパイル使用メモリ | 204,744 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2026-03-05 03:55:27 |
| 合計ジャッジ時間 | 3,873 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 |
ソースコード
#define _GLIBCXX_DEBUG
#define ll long long
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, Q; cin >> N >> Q;
vector<int> S(N, 0);
int ans = 0;
for(int i = 0; i < Q; i++){
int L, R; cin >> L >> R;
for(int i = L-1; i <= R-1; i++){
S[i] = (S[i]+1)%2;
if(S[i] == 1) ans++;
else ans--;
}
cout << ans << endl;
}
}