結果
| 問題 |
No.1673 Lamps on a line
|
| コンテスト | |
| ユーザー |
ytft
|
| 提出日時 | 2021-09-20 17:52:03 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 196 ms / 2,000 ms |
| コード長 | 326 bytes |
| コンパイル時間 | 1,548 ms |
| コンパイル使用メモリ | 167,116 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-02 16:02:29 |
| 合計ジャッジ時間 | 3,947 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int N,Q;
cin>>N>>Q;
vector<int> lamp(N,0);
int ans=0;
for(int i=0;i<Q;++i){
int L,R;
cin>>L>>R;
for(int j=L-1;j<R;++j){
lamp[j]=1-lamp[j];
ans+=2*lamp[j]-1;
}
cout<<ans<<endl;
}
}
ytft