結果
問題 |
No.1673 Lamps on a line
|
ユーザー |
![]() |
提出日時 | 2021-08-02 09:39:33 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 504 bytes |
コンパイル時間 | 2,459 ms |
コンパイル使用メモリ | 196,452 KB |
最終ジャッジ日時 | 2025-01-23 13:40:37 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 9 TLE * 2 |
ソースコード
#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"; } }