結果
問題 | No.1673 Lamps on a line |
ユーザー | planes |
提出日時 | 2021-09-10 21:26:11 |
言語 | C++17 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 156 ms / 2,000 ms |
コード長 | 496 bytes |
コンパイル時間 | 2,363 ms |
コンパイル使用メモリ | 199,140 KB |
実行使用メモリ | 7,000 KB |
最終ジャッジ日時 | 2023-09-02 15:50:45 |
合計ジャッジ時間 | 3,900 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,376 KB |
testcase_02 | AC | 77 ms
4,376 KB |
testcase_03 | AC | 76 ms
4,376 KB |
testcase_04 | AC | 127 ms
4,380 KB |
testcase_05 | AC | 8 ms
4,376 KB |
testcase_06 | AC | 111 ms
4,376 KB |
testcase_07 | AC | 93 ms
5,860 KB |
testcase_08 | AC | 4 ms
5,080 KB |
testcase_09 | AC | 134 ms
4,380 KB |
testcase_10 | AC | 141 ms
4,860 KB |
testcase_11 | AC | 15 ms
5,224 KB |
testcase_12 | AC | 156 ms
7,000 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll =long long; #define all(v) v.begin(),v.end() #define rep(i,a,b) for(int i=a;i<b;i++) #define rrep(i,a,b) for(int i=a;i>=b;i--) int main() { ios_base::sync_with_stdio(0); cin.tie(0); ll N,Q;cin>>N>>Q; ll count=0; vector<ll> note(N,1); for(ll i=0;i<Q;i++) { ll L,R;cin>>L>>R; L--; R--; for(ll j=L;j<=R;j++) { note[j]*=-1; if(note[j]==-1) count++; else count--; } cout<<count<<endl; } }