結果
| 問題 |
No.1673 Lamps on a line
|
| コンテスト | |
| ユーザー |
taisii2
|
| 提出日時 | 2021-09-10 21:46:04 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 204 ms / 2,000 ms |
| コード長 | 372 bytes |
| コンパイル時間 | 1,719 ms |
| コンパイル使用メモリ | 168,024 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-11 23:15:17 |
| 合計ジャッジ時間 | 3,738 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,Q;
cin>>N>>Q;
vector<bool>ok(N,false);
long long ans=0;
while(Q--){
int L,R;
cin>>L>>R;
L--;R--;
for(int i=L;i<=R;i++){
if(ok[i]==false){
ans++;
ok[i]=true;
}else{
ans--;
ok[i]=false;
}
}
cout<<ans<<endl;
}
}
taisii2