結果

問題 No.1597 Matrix Sort
ユーザー Fu_LFu_L
提出日時 2021-07-09 22:24:11
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 849 bytes
コンパイル時間 4,168 ms
コンパイル使用メモリ 262,156 KB
実行使用メモリ 5,168 KB
最終ジャッジ日時 2023-09-14 09:39:07
合計ジャッジ時間 10,607 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 AC 326 ms
5,020 KB
testcase_05 AC 321 ms
5,168 KB
testcase_06 AC 308 ms
4,952 KB
testcase_07 AC 311 ms
5,012 KB
testcase_08 AC 262 ms
5,156 KB
testcase_09 AC 270 ms
5,168 KB
testcase_10 AC 166 ms
4,968 KB
testcase_11 AC 147 ms
5,084 KB
testcase_12 AC 138 ms
5,024 KB
testcase_13 AC 250 ms
5,044 KB
testcase_14 AC 278 ms
4,976 KB
testcase_15 AC 105 ms
4,972 KB
testcase_16 AC 161 ms
5,008 KB
testcase_17 AC 183 ms
4,972 KB
testcase_18 AC 304 ms
4,976 KB
testcase_19 AC 219 ms
4,968 KB
testcase_20 AC 178 ms
4,968 KB
testcase_21 AC 169 ms
4,968 KB
testcase_22 AC 172 ms
5,024 KB
testcase_23 AC 161 ms
5,008 KB
testcase_24 AC 20 ms
4,960 KB
testcase_25 AC 17 ms
4,964 KB
testcase_26 WA -
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<ll,ll> P;
typedef modint1000000007 mint;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
const ll inf=1e18;
ll n,k,p;
ll a[100005],b[100005];
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin>>n>>k>>p;
    rep(i,0,n) cin>>a[i];
    rep(i,0,n) cin>>b[i];
    sort(a,a+n);
    sort(b,b+n);
    ll l=0,r=p-1;
    while(r-l>1){
        ll m=(l+r)/2;
        ll cnt=0;
        rep(i,0,n){
            ll I=lower_bound(b,b+n,m-a[i]+1)-b;
            ll J=lower_bound(b,b+n,p-a[i])-b;
            ll K=lower_bound(b,b+n,p+m-a[i]+1)-b;
            cnt+=I+(K-J);
        }
        if(cnt>=k){
            r=m;
        }else{
            l=m;
        }
    }
    cout<<r<<endl;
}
0