結果
| 問題 |
No.1673 Lamps on a line
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-13 13:33:00 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 96 ms / 2,000 ms |
| コード長 | 314 bytes |
| コンパイル時間 | 1,814 ms |
| コンパイル使用メモリ | 233,344 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-22 12:28:45 |
| 合計ジャッジ時間 | 3,206 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 |
ソースコード
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);
}
}