結果
| 問題 |
No.1673 Lamps on a line
|
| コンテスト | |
| ユーザー |
planes
|
| 提出日時 | 2021-09-10 21:26:11 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 164 ms / 2,000 ms |
| コード長 | 496 bytes |
| コンパイル時間 | 2,239 ms |
| コンパイル使用メモリ | 193,948 KB |
| 最終ジャッジ日時 | 2025-01-24 09:36:45 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 |
ソースコード
#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;
}
}
planes