結果
| 問題 |
No.808 Kaiten Sushi?
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-03-31 18:10:39 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 854 bytes |
| コンパイル時間 | 1,751 ms |
| コンパイル使用メモリ | 164,848 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-22 00:58:19 |
| 合計ジャッジ時間 | 6,978 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 WA * 27 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i,N) for(i=0;i<N;i++)
typedef long long ll;
typedef pair<int, int> P;
typedef struct{
int first;
int second;
int third;
}T;
//昇順
bool comp_Se(T& l, T& r){
return l.second < r.second;
}
int main(void){
int N;
ll L;
cin >> N >> L;
vector<pair<int,int> > v(2*N);
int i;
REP(i,N){
cin >> v[i].first;
v[i].second = 0;
}
REP(i,N){
cin >> v[N+i].first;
v[N+i].second = 1;
}
sort(v.begin(),v.end());
int count=0,max=0,end = v[v.size()-1].first;
pair<int,int> p;
REP(i,v.size()){
if(!v[i].second && count >= 0) count--;
else if(v[i].second == 1){
count++;
if(count==0) p=v[i];
}
if(count>=max){
max=count;
end = p.first;
}
}
ll ans = (ll)max*L;
ans += (ll)end;
cout << ans << endl;
return 0;
}