結果
| 問題 |
No.1673 Lamps on a line
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-10 21:29:39 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 197 ms / 2,000 ms |
| コード長 | 454 bytes |
| コンパイル時間 | 1,671 ms |
| コンパイル使用メモリ | 169,432 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-11 22:33:08 |
| 合計ジャッジ時間 | 3,468 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, l, r) for (int i = (l); i < (r); i++)
using namespace std;
typedef long long ll;
int main() {
int N, Q, ans = 0;
cin >> N >> Q;
vector<int> L(Q), R(Q);
rep(i, 0, Q) cin >> L[i] >> R[i];
vector<bool> A(N + 1, 0);
rep(i, 0, Q) {
rep(j, L[i], R[i] + 1) {
A[j] = 1 - A[j];
if (A[j]) ans++;
else ans--;
}
cout << ans << endl;
}
}