結果

問題 No.1673 Lamps on a line
ユーザー You_sakuYou_saku
提出日時 2021-09-16 01:00:49
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 569 bytes
コンパイル時間 903 ms
コンパイル使用メモリ 81,672 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-11 12:33:36
合計ジャッジ時間 5,147 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 86 ms
4,376 KB
testcase_03 AC 85 ms
4,376 KB
testcase_04 AC 149 ms
4,380 KB
testcase_05 AC 9 ms
4,376 KB
testcase_06 AC 129 ms
4,380 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます

ソースコード

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