結果
| 問題 |
No.1673 Lamps on a line
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-21 12:40:52 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 205 ms / 2,000 ms |
| コード長 | 458 bytes |
| コンパイル時間 | 4,317 ms |
| コンパイル使用メモリ | 250,536 KB |
| 最終ジャッジ日時 | 2025-02-20 10:36:40 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ld = long double;
int N, Q;
int A[505050];
int cnt;
int main() {
cin >> N >> Q;
for (int i = 1; i <= Q; i++) {
int L, R; cin >> L >> R;
for (int j = L; j <= R; j++) {
if (A[j]) {
A[j] = 0;
cnt--;
} else {
A[j] = 1;
cnt++;
}
}
cout << cnt << endl;
}
return 0;
}