結果
| 問題 |
No.674 n連勤
|
| コンテスト | |
| ユーザー |
ama_nuko
|
| 提出日時 | 2018-07-13 17:55:43 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,167 bytes |
| コンパイル時間 | 1,211 ms |
| コンパイル使用メモリ | 104,784 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-08 17:37:17 |
| 合計ジャッジ時間 | 3,285 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 WA * 9 |
ソースコード
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>
#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef pair<int, int> P;
const int INF = 1e18;
const int MOD = 1e9+7;
signed main(){
int d, q;
cin >> d >> q;
set<P> range;
range.emplace(-INF-10, -INF-10);
range.emplace(INF+10, INF+10);
int ans = 0;
rep(i, q){
int a, b;
cin >> a >> b;
P r = make_pair(a, b);
auto x_ = range.lower_bound(r);
x_--;
P x = *x_;
P y = *(range.upper_bound(r));
if(x.second + 1 >= r.first){
r.first = x.first;
range.erase(x);
}
if(y.first <= r.second + 1){
r.second = y.second;
range.erase(y);
}
range.insert(r);
int len = r.second - r.first + 1;
if(ans < len){
ans = len;
}
cout << ans << endl;
}
return 0;
}
ama_nuko