結果

問題 No.808 Kaiten Sushi?
ユーザー 48025254802525
提出日時 2019-03-31 18:10:39
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 854 bytes
コンパイル時間 1,552 ms
コンパイル使用メモリ 150,420 KB
実行使用メモリ 4,888 KB
最終ジャッジ日時 2023-08-14 06:11:25
合計ジャッジ時間 7,148 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 WA -
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 4 ms
4,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 3 ms
4,376 KB
testcase_13 AC 3 ms
4,380 KB
testcase_14 AC 2 ms
4,384 KB
testcase_15 AC 4 ms
4,376 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 37 ms
4,380 KB
testcase_24 AC 30 ms
4,376 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 47 ms
4,384 KB
testcase_34 AC 52 ms
4,380 KB
testcase_35 WA -
testcase_36 AC 47 ms
4,376 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 85 ms
4,380 KB
testcase_40 AC 20 ms
4,380 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 32 ms
4,380 KB
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 18 ms
4,376 KB
testcase_47 WA -
testcase_48 AC 93 ms
4,568 KB
testcase_49 AC 94 ms
4,528 KB
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 AC 2 ms
4,380 KB
testcase_55 AC 2 ms
4,380 KB
testcase_56 AC 1 ms
4,380 KB
testcase_57 AC 25 ms
4,376 KB
testcase_58 AC 42 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0