結果

問題 No.1673 Lamps on a line
ユーザー You_saku
提出日時 2021-09-16 01:00:49
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 569 bytes
コンパイル時間 668 ms
コンパイル使用メモリ 82,500 KB
実行使用メモリ 13,884 KB
最終ジャッジ日時 2024-06-29 02:57:46
合計ジャッジ時間 4,797 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5 TLE * 1 -- * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<map>
#include <ios>
#include <iomanip> 
#include<algorithm>

using namespace std;

int main(){
    int n,q;
    cin >> n >> q;
    vector<bool>lamp(n,0);
    for(int i=0; i<q; i++){
        int start,end;
        cin >> start >> end;
        for(int j = start-1; j < end; j++){
            if(lamp[j]){
                lamp[j] = false;
            }else{
                lamp[j] = true;
            }
        }
        cout << count(lamp.begin(),lamp.end(),true) << endl;
    }
    return 0;
}
0