結果
| 問題 | No.674 n連勤 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-03-05 09:09:20 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 646 bytes |
| 記録 | |
| コンパイル時間 | 670 ms |
| コンパイル使用メモリ | 73,472 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-14 00:46:36 |
| 合計ジャッジ時間 | 2,678 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 WA * 8 |
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
7 | main()
| ^~~~
ソースコード
#include<iostream>
#include<set>
using namespace std;
long D;
int Q;
set<pair<long,long> >S;
main()
{
cin>>D>>Q;
long ans=0;
for(int i=0;i<Q;i++)
{
long A,B;cin>>A>>B;
B++;
pair<long,long>now=make_pair(A,B);
set<pair<long,long> >::iterator it=S.lower_bound(make_pair(A,-1));
while(it!=S.end()&&it->first<=now.second)
{
if(now.second<it->second)now.second=it->second;
it=S.erase(it);
}
while(it!=S.begin())
{
it--;
if(now.first>it->second)break;
if(now.first>it->first)now.first=it->first;
it=S.erase(it);
}
if(ans<now.second-now.first)ans=now.second-now.first;
S.insert(now);
cout<<ans<<endl;
}
}