結果

問題 No.1673 Lamps on a line
ユーザー laneguelanegue
提出日時 2021-09-13 13:33:00
言語 D
(dmd 2.107.1)
結果
AC  
実行時間 112 ms / 2,000 ms
コード長 314 bytes
コンパイル時間 3,356 ms
コンパイル使用メモリ 226,196 KB
実行使用メモリ 6,828 KB
最終ジャッジ日時 2023-09-04 14:05:56
合計ジャッジ時間 4,830 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 55 ms
4,472 KB
testcase_03 AC 55 ms
4,456 KB
testcase_04 AC 95 ms
4,380 KB
testcase_05 AC 7 ms
4,480 KB
testcase_06 AC 81 ms
4,460 KB
testcase_07 AC 69 ms
6,044 KB
testcase_08 AC 3 ms
4,712 KB
testcase_09 AC 101 ms
4,756 KB
testcase_10 AC 105 ms
5,524 KB
testcase_11 AC 12 ms
6,828 KB
testcase_12 AC 112 ms
6,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;
void main(){
	auto s=readln.chomp.split(" ").to!(int[]);
	auto N=s[0];
	auto Q=s[1];
	auto a=new int[N];
	auto c=0;
	for(auto q=0; q<Q; q++){
		s=readln.chomp.split(" ").to!(int[]);
		auto l=s[0]-1;
		auto r=s[1]-1;
		for(;l<=r; l++){
			a[l]^=1;
			if(a[l]) c+=1;
			else c-=1;
		}
		writeln(c);
	}
}
0