結果
問題 |
No.1673 Lamps on a line
|
ユーザー |
![]() |
提出日時 | 2021-09-11 03:21:02 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 202 ms / 2,000 ms |
コード長 | 483 bytes |
コンパイル時間 | 919 ms |
コンパイル使用メモリ | 94,392 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-13 04:05:00 |
合計ジャッジ時間 | 3,404 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 11 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <functional> #include <queue> #include <map> #include <cmath> #include <iomanip> using namespace std; int main() { int n , q; cin >> n >> q; vector<int> v(n + 1 , 0); int sum = 0; for (int i = 0; i < q; i++) { int a , b; cin >> a >> b; a--; b--; for (int j = a; j <= b; j++) { v[j] ^= 1; if (v[j]) sum++; else sum--; } cout << sum << endl; } return 0; }