結果

問題 No.1361 [Zelkova 4th Tune *] QUADRUPLE-SEQUENCEの詩
ユーザー moririn2528_cmoririn2528_c
提出日時 2021-01-23 02:02:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 2,907 bytes
コンパイル時間 1,424 ms
コンパイル使用メモリ 109,968 KB
実行使用メモリ 55,216 KB
最終ジャッジ日時 2023-08-28 12:11:54
合計ジャッジ時間 47,236 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 5 ms
4,376 KB
testcase_11 AC 4 ms
4,380 KB
testcase_12 AC 3 ms
4,380 KB
testcase_13 AC 5 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 8 ms
4,376 KB
testcase_16 AC 4 ms
4,380 KB
testcase_17 AC 5 ms
4,380 KB
testcase_18 AC 80 ms
6,204 KB
testcase_19 AC 30 ms
4,376 KB
testcase_20 AC 87 ms
5,792 KB
testcase_21 AC 25 ms
4,912 KB
testcase_22 AC 40 ms
4,832 KB
testcase_23 AC 61 ms
5,696 KB
testcase_24 AC 55 ms
5,656 KB
testcase_25 AC 58 ms
5,476 KB
testcase_26 AC 72 ms
5,792 KB
testcase_27 AC 46 ms
4,888 KB
testcase_28 AC 646 ms
24,280 KB
testcase_29 AC 547 ms
19,468 KB
testcase_30 AC 487 ms
16,956 KB
testcase_31 AC 678 ms
25,840 KB
testcase_32 AC 649 ms
32,048 KB
testcase_33 AC 463 ms
17,208 KB
testcase_34 AC 751 ms
30,496 KB
testcase_35 AC 905 ms
27,348 KB
testcase_36 AC 1,352 ms
42,628 KB
testcase_37 AC 257 ms
15,328 KB
testcase_38 AC 714 ms
21,492 KB
testcase_39 AC 385 ms
14,796 KB
testcase_40 AC 487 ms
19,300 KB
testcase_41 AC 698 ms
25,720 KB
testcase_42 AC 1,358 ms
36,216 KB
testcase_43 AC 691 ms
23,988 KB
testcase_44 AC 936 ms
28,928 KB
testcase_45 AC 805 ms
24,076 KB
testcase_46 AC 716 ms
33,088 KB
testcase_47 AC 367 ms
16,616 KB
testcase_48 AC 1,407 ms
53,940 KB
testcase_49 AC 1,276 ms
53,824 KB
testcase_50 AC 1,434 ms
53,648 KB
testcase_51 AC 1,387 ms
54,004 KB
testcase_52 AC 1,181 ms
53,872 KB
testcase_53 AC 1,816 ms
53,300 KB
testcase_54 AC 1,702 ms
53,656 KB
testcase_55 AC 1,884 ms
53,496 KB
testcase_56 AC 1,691 ms
54,476 KB
testcase_57 AC 1,340 ms
55,216 KB
testcase_58 AC 740 ms
13,608 KB
testcase_59 AC 754 ms
12,600 KB
testcase_60 AC 713 ms
12,080 KB
testcase_61 AC 711 ms
12,116 KB
testcase_62 AC 712 ms
12,044 KB
testcase_63 RE -
testcase_64 RE -
testcase_65 RE -
testcase_66 RE -
testcase_67 RE -
testcase_68 RE -
testcase_69 AC 1 ms
4,380 KB
testcase_70 RE -
testcase_71 AC 2 ms
4,380 KB
testcase_72 AC 2 ms
4,380 KB
testcase_73 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
#include<set>
#include<complex>
#include<numeric>
#include<functional>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const LL INF=1LL<<60;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
    for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
    for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
    if(vec_n==-1)vec_n=vec_s.size();
    for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
    if(vec_n==-1)vec_n=vec_s.size();
    for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}

int main(){
    LL n,m,p,q,r;
    int i,j,k;
    LL a,b,c;
    cin>>n>>m>>p>>q>>r;
    vector<LL> v1,v2;
    vector<LL> va(n),vb(m),vc(p),vd(q);
    map<LL,LL> m1,m2;
    for(i=0;i<n;i++)cin>>va[i];
    for(i=0;i<m;i++)cin>>vb[i];
    for(i=0;i<p;i++)cin>>vc[i];
    for(i=0;i<q;i++)cin>>vd[i];
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            v1.push_back(va[i]*vb[j]);
            m1[va[i]*vb[j]]=va[i];
        }
    }
    for(i=0;i<p;i++){
        for(j=0;j<q;j++){
            v2.push_back(vc[i]*vd[j]);
            m2[vc[i]*vd[j]]=vc[i];
        }
    }
    sort(v1.begin(),v1.end());
    sort(v2.begin(),v2.end());
    LL z[3]={-INF,INF};
    while(z[1]-z[0]>1){
        z[2]=(z[0]+z[1])/2;
        a=0;
        for(i=0;i<v1.size();i++){
            if(v1[i]==0){
                if(z[2]>=0)a+=v2.size();
                continue;
            }
            if(v1[i]>0){
                if(z[2]>=0)b=z[2]/v1[i];
                else b=-((-z[2]-1)/v1[i])-1;
                auto itr=upper_bound(v2.begin(),v2.end(),b);
                a+=distance(v2.begin(),itr);
            }else{
                if(z[2]>=0)b=-(z[2]/(-v1[i]));
                else b=(-z[2]-1)/(-v1[i])+1;
                auto itr=lower_bound(v2.begin(),v2.end(),b);
                a+=distance(itr,v2.end());
            }
        }
        if(a<r)z[0]=z[2];
        else z[1]=z[2];
    }
    cout<<z[1]<<endl;
    for(auto node:m1){
        auto itr=m2.begin();
        if(node.first==0){
            if(z[1])continue;
        }else{
            if(abs(z[1])%node.first)continue;
            a=z[1]/node.first;
            itr=m2.find(a);
            if(itr==m2.end())continue;
        }
        cout<<node.second<<" "<<node.first/node.second<<" ";
        cout<<itr->second<<" "<<itr->first/itr->second<<endl;
        return 0;
    }
}
0