結果

問題 No.1673 Lamps on a line
ユーザー stoqstoq
提出日時 2021-08-02 09:39:33
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 504 bytes
コンパイル時間 2,067 ms
コンパイル使用メモリ 201,648 KB
実行使用メモリ 10,580 KB
最終ジャッジ日時 2023-09-02 15:02:52
合計ジャッジ時間 10,665 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
10,580 KB
testcase_01 AC 3 ms
5,304 KB
testcase_02 AC 12 ms
5,360 KB
testcase_03 AC 12 ms
5,300 KB
testcase_04 AC 20 ms
5,432 KB
testcase_05 AC 4 ms
5,304 KB
testcase_06 AC 17 ms
5,340 KB
testcase_07 TLE -
testcase_08 AC 17 ms
5,260 KB
testcase_09 AC 339 ms
5,364 KB
testcase_10 AC 1,571 ms
5,256 KB
testcase_11 AC 147 ms
5,312 KB
testcase_12 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i, m, n) for (int i = m; i < (int)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#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;
  int a[500010] = {};
  rep(i, q)
  {
    int l, r;
    cin >> l >> r;
    l--;
    int sum = 0;
    REP(j, l, r)
    a[j] ^= 1;
    rep(j, n) sum += a[j];
    cout << sum << "\n";
  }
}
0