結果

問題 No.1673 Lamps on a line
ユーザー stoqstoq
提出日時 2021-08-02 03:53:22
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 403 ms / 2,000 ms
コード長 415 bytes
コンパイル時間 2,066 ms
コンパイル使用メモリ 201,920 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-02 15:01:51
合計ジャッジ時間 6,654 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 229 ms
4,376 KB
testcase_03 AC 232 ms
4,380 KB
testcase_04 AC 403 ms
4,380 KB
testcase_05 AC 18 ms
4,376 KB
testcase_06 AC 304 ms
4,380 KB
testcase_07 AC 204 ms
4,380 KB
testcase_08 AC 4 ms
4,376 KB
testcase_09 AC 312 ms
4,376 KB
testcase_10 AC 317 ms
4,380 KB
testcase_11 AC 28 ms
4,376 KB
testcase_12 AC 345 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

int main()
{
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, q;
  cin >> n >> q;
  bitset<500000> bs;
  for (int _ = 0; _ < q; _++)
  {
    int l, r;
    cin >> l >> r;
    l--;
    for (int i = l; i < r; i++)
      bs.flip(i);
    cout << bs.count() << "\n";
  }
}
0