結果
問題 |
No.674 n連勤
|
ユーザー |
![]() |
提出日時 | 2021-08-14 22:15:00 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 645 bytes |
コンパイル時間 | 2,242 ms |
コンパイル使用メモリ | 197,804 KB |
最終ジャッジ日時 | 2025-01-23 22:14:38 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 6 WA * 11 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll d; cin >> d; ll res=0; int n; cin >> n; set<pair<ll,ll>> st; st.insert(make_pair(-2e18,-2e18)); st.insert(make_pair(2e18,2e18)); for(int i=0;i<n;i++){ ll x,y; cin >> x >> y; y++; auto it=st.lower_bound(make_pair(x,y)); it--; if(it->first <= x and x <= it->second){ x=min(x,it->first); y=max(y,it->second); st.erase(it); } st.insert(make_pair(x,y)); res=max(res,y-x); printf("%lld\n",res); } }