結果
問題 | No.1673 Lamps on a line |
ユーザー | mmn15277198 |
提出日時 | 2021-09-11 03:21:02 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 198 ms / 2,000 ms |
コード長 | 483 bytes |
コンパイル時間 | 680 ms |
コンパイル使用メモリ | 93,096 KB |
実行使用メモリ | 4,784 KB |
最終ジャッジ日時 | 2023-09-03 23:32:29 |
合計ジャッジ時間 | 2,792 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 87 ms
4,380 KB |
testcase_03 | AC | 85 ms
4,384 KB |
testcase_04 | AC | 149 ms
4,380 KB |
testcase_05 | AC | 8 ms
4,384 KB |
testcase_06 | AC | 128 ms
4,380 KB |
testcase_07 | AC | 113 ms
4,712 KB |
testcase_08 | AC | 3 ms
4,376 KB |
testcase_09 | AC | 165 ms
4,376 KB |
testcase_10 | AC | 169 ms
4,376 KB |
testcase_11 | AC | 17 ms
4,376 KB |
testcase_12 | AC | 198 ms
4,784 KB |
ソースコード
#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; }