結果
問題 | No.1673 Lamps on a line |
ユーザー | nebukuro09 |
提出日時 | 2021-09-10 22:15:15 |
言語 | D (dmd 2.107.1) |
結果 |
AC
|
実行時間 | 91 ms / 2,000 ms |
コード長 | 665 bytes |
コンパイル時間 | 1,960 ms |
コンパイル使用メモリ | 100,896 KB |
実行使用メモリ | 5,916 KB |
最終ジャッジ日時 | 2023-09-04 14:04:08 |
合計ジャッジ時間 | 2,296 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,380 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 41 ms
4,376 KB |
testcase_03 | AC | 41 ms
4,380 KB |
testcase_04 | AC | 70 ms
4,376 KB |
testcase_05 | AC | 6 ms
4,380 KB |
testcase_06 | AC | 60 ms
4,376 KB |
testcase_07 | AC | 57 ms
5,896 KB |
testcase_08 | AC | 2 ms
4,864 KB |
testcase_09 | AC | 81 ms
4,380 KB |
testcase_10 | AC | 87 ms
4,376 KB |
testcase_11 | AC | 10 ms
4,628 KB |
testcase_12 | AC | 91 ms
5,916 KB |
ソースコード
import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop; immutable long MOD = 998244353; void main() { auto s = readln.split.map!(to!int); auto N = s[0]; auto Q = s[1]; auto A = new int[](N); int ans = 0; while (Q--) { s = readln.split.map!(to!int); auto l = s[0] - 1; auto r = s[1] - 1; foreach (i; l..r+1) { A[i] ^= 1; if (A[i]) { ans += 1; } else { ans -= 1; } } ans.writeln; } }