結果
問題 | No.1673 Lamps on a line |
ユーザー |
|
提出日時 | 2021-09-10 21:35:04 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 202 ms / 2,000 ms |
コード長 | 377 bytes |
コンパイル時間 | 583 ms |
コンパイル使用メモリ | 63,984 KB |
実行使用メモリ | 5,504 KB |
最終ジャッジ日時 | 2024-06-11 22:42:42 |
合計ジャッジ時間 | 2,554 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 11 |
ソースコード
#include <iostream> using namespace std; typedef long long ll; int main() { int n, q; cin >> n >> q; int d[500005]{0}; int ans = 0; while(q--){ int l, r; cin >> l >> r; l--; for(int i = l; i < r; i++){ if(d[i]) ans--; else ans++; d[i] ^= 1; } cout << ans << endl; } }