結果
問題 |
No.1673 Lamps on a line
|
ユーザー |
![]() |
提出日時 | 2021-09-11 00:53:00 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 200 ms / 2,000 ms |
コード長 | 610 bytes |
コンパイル時間 | 1,632 ms |
コンパイル使用メモリ | 168,520 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-12 21:16:41 |
合計ジャッジ時間 | 3,758 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 11 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i, n, o) for(int i = o;i < (n);i++) #define ou(x) cout << x << endl #define ll long long #define re return 0 signed main(){ int n, q; string s; cin >> n >> q; std::vector<int> v(n, 0); int l; int r; int ans = 0; rep(i, q, 0){ cin >> l >> r; rep(j, r, l - 1){ if(v[j] == 1){ v[j] = 0; ans--; continue; } v[j] = 1; if(v[j] == 1){ ans++; } } ou(ans); } re; }