結果
| 問題 |
No.1673 Lamps on a line
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-10 21:25:13 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 208 ms / 2,000 ms |
| コード長 | 373 bytes |
| コンパイル時間 | 2,033 ms |
| コンパイル使用メモリ | 190,784 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-11 22:22:01 |
| 合計ジャッジ時間 | 4,099 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
}
}