結果
問題 | No.1673 Lamps on a line |
ユーザー | 杨娵隅 |
提出日時 | 2021-09-10 21:48:43 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 394 bytes |
コンパイル時間 | 2,014 ms |
コンパイル使用メモリ | 197,308 KB |
実行使用メモリ | 9,024 KB |
最終ジャッジ日時 | 2023-09-02 16:50:54 |
合計ジャッジ時間 | 5,855 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
9,024 KB |
testcase_01 | AC | 1 ms
4,376 KB |
testcase_02 | AC | 12 ms
4,380 KB |
testcase_03 | AC | 13 ms
4,380 KB |
testcase_04 | AC | 21 ms
4,380 KB |
testcase_05 | AC | 2 ms
4,380 KB |
testcase_06 | AC | 19 ms
4,376 KB |
testcase_07 | TLE | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
ソースコード
#include <bits/stdc++.h> using namespace std; const int maxn = 5e5 + 10; int a[maxn]; int main() { int N, Q; cin >> N >> Q; while (Q --) { int l, r; scanf("%d %d", &l, &r); for (int i = l; i <= r; i ++) { if (a[i]) a[i] = 0; else a[i] = 1; }int cnt = 0; for (int i = 1; i <= N; i ++) if (a[i]) cnt ++; cout << cnt << "\n"; } return 0; }