結果

問題 No.1673 Lamps on a line
ユーザー kazu107kazu107
提出日時 2021-09-10 22:09:47
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 532 bytes
コンパイル時間 1,576 ms
コンパイル使用メモリ 144,920 KB
実行使用メモリ 11,980 KB
最終ジャッジ日時 2023-09-02 17:59:20
合計ジャッジ時間 7,742 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N, Q;
    cin >> N >> Q;
    vector<int> vec(N, 0);
    for (int i = 0; i < Q; i ++) {
        int a, b;
        cin >> a >> b;
        int ans = 0;
        for (int j = a; j <= b; a ++) {
            if (vec.at(j - 1) == '0') {
                vec.at(j - 1) = 1;
                ans++;
            }
            else {
                vec.at(j - 1) = 0;
            }
            if (j == b) {
                cout << ans << endl;
            }
        }
    }
}
0