結果
| 問題 |
No.674 n連勤
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-04-13 23:20:58 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,194 bytes |
| コンパイル時間 | 936 ms |
| コンパイル使用メモリ | 109,056 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-26 21:54:59 |
| 合計ジャッジ時間 | 1,985 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 7 WA * 10 |
ソースコード
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;
int main()
{
long long d;
int q;
cin >> d >> q;
long long ans = 0;
set<pair<long long, long long> > s;
while(--q >= 0){
long long a, b;
cin >> a >> b;
++ b;
auto it = s.lower_bound(make_pair(a, -1));
while(it != s.end()){
if(b < it->first)
break;
b = max(b, it->second);
it = s.erase(it);
}
if(it != s.begin()){
-- it;
if(it->second < a)
break;
a = min(a, it->first);
b = max(b, it->second);
s.erase(it);
}
s.insert(make_pair(a, b));
ans = max(ans, b - a);
cout << ans << endl;
}
return 0;
}