結果

問題 No.1361 [Zelkova 4th Tune *] QUADRUPLE-SEQUENCEの詩
ユーザー n_vipn_vip
提出日時 2021-01-22 22:47:10
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 4,128 bytes
コンパイル時間 1,798 ms
コンパイル使用メモリ 142,980 KB
実行使用メモリ 15,228 KB
最終ジャッジ日時 2023-08-27 21:05:26
合計ジャッジ時間 47,669 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 3 ms
4,384 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 5 ms
4,376 KB
testcase_11 AC 4 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 6 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 8 ms
4,376 KB
testcase_16 AC 3 ms
4,376 KB
testcase_17 AC 5 ms
4,376 KB
testcase_18 AC 102 ms
4,376 KB
testcase_19 AC 41 ms
4,376 KB
testcase_20 AC 130 ms
4,380 KB
testcase_21 AC 20 ms
4,376 KB
testcase_22 AC 46 ms
4,380 KB
testcase_23 AC 72 ms
4,380 KB
testcase_24 AC 59 ms
4,376 KB
testcase_25 AC 69 ms
4,376 KB
testcase_26 AC 87 ms
4,380 KB
testcase_27 AC 64 ms
4,380 KB
testcase_28 RE -
testcase_29 AC 797 ms
5,400 KB
testcase_30 AC 759 ms
5,220 KB
testcase_31 AC 792 ms
7,432 KB
testcase_32 AC 663 ms
13,044 KB
testcase_33 AC 625 ms
5,468 KB
testcase_34 AC 795 ms
8,012 KB
testcase_35 AC 1,438 ms
7,220 KB
testcase_36 AC 1,794 ms
13,336 KB
testcase_37 AC 253 ms
5,592 KB
testcase_38 AC 1,129 ms
5,472 KB
testcase_39 AC 639 ms
5,156 KB
testcase_40 AC 647 ms
5,500 KB
testcase_41 AC 1,016 ms
7,748 KB
testcase_42 TLE -
testcase_43 AC 1,004 ms
7,256 KB
testcase_44 AC 1,398 ms
7,176 KB
testcase_45 AC 1,198 ms
5,332 KB
testcase_46 AC 983 ms
8,168 KB
testcase_47 AC 492 ms
5,592 KB
testcase_48 AC 1,357 ms
12,956 KB
testcase_49 AC 949 ms
15,228 KB
testcase_50 AC 1,494 ms
12,328 KB
testcase_51 AC 1,257 ms
13,700 KB
testcase_52 AC 923 ms
12,480 KB
testcase_53 TLE -
testcase_54 TLE -
testcase_55 TLE -
testcase_56 TLE -
testcase_57 AC 1,284 ms
12,224 KB
testcase_58 AC 769 ms
14,648 KB
testcase_59 AC 775 ms
13,612 KB
testcase_60 AC 710 ms
12,712 KB
testcase_61 AC 709 ms
14,288 KB
testcase_62 AC 712 ms
13,908 KB
testcase_63 RE -
testcase_64 RE -
testcase_65 RE -
testcase_66 RE -
testcase_67 RE -
testcase_68 RE -
testcase_69 RE -
testcase_70 AC 2 ms
4,384 KB
testcase_71 AC 1 ms
4,376 KB
testcase_72 AC 2 ms
4,376 KB
testcase_73 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#include<random>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (int)(Y);++(X))
#define reps(X,S,Y) for (int (X) = (int)(S);(X) < (int)(Y);++(X))
#define rrep(X,Y) for (int (X) = (int)(Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (int)(Y)-1;(X) >= (int)(S);--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl
#define NL <<"\n"
#define cauto const auto

using namespace std;
using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
//#undef NUIP
#ifdef NUIP
#include "benri.h"
#else
#define out(args...)
#endif
void ouT(ll x,int d=3){auto re=to_string(x);if((int)re.size()>d) re=x>0?"oo":"-oo";cout<<string(d-re.size(),' ')<<re<<",";}
#ifdef __cpp_init_captures
template<typename T>vector<T> table(int n, T v){ return vector<T>(n, v);}
template <class... Args> auto table(int n, Args... args){auto val = table(args...); return vector<decltype(val)>(n, move(val));}
#endif
template<class A,class B> pair<A,B> operator+(const pair<A,B> &p,const pair<A,B> &q){ return {p.X+q.X,p.Y+q.Y};}
template<class A,class B,class C,class D> pair<A,B>& operator+=(pair<A,B> &p,const pair<C,D> &q){ p.X+=q.X; p.Y+=q.Y; return p;}
template<class A,class B> pair<A,B> operator-(const pair<A,B> &p,const pair<A,B> &q){ return {p.X-q.X,p.Y-q.Y};}
template<class A,class B,class C,class D> pair<A,B>& operator-=(pair<A,B> &p,const pair<C,D> &q){ p.X-=q.X; p.Y-=q.Y; return p;}
template<class A,class B> istream& operator>>(istream &is, pair<A,B> &p){ is>>p.X>>p.Y; return is;}
template<class T=ll> T read(){ T re; cin>>re; return move(re);}
template<class T=ll> T read(const T &dec){ T re; cin>>re; return re-dec;}
template<class T=ll> vector<T> readV(const int sz){ vector<T> re(sz); for(auto &x:re) x=read<T>(); return move(re);}
template<class T=ll> vector<T> readV(const int sz, const T &dec){ vector<T> re(sz); for(auto &x:re) x=read<T>(dec); return move(re);}
vv<int> readG(const int &n,const int &m){ vv<int> g(n); rep(_,m){ cauto a=read<int>(1),b=read<int>(1); g[a].pb(b); g[b].pb(a);} return move(g);}
vv<int> readG(const int &n){ return readG(n,n-1);}
#define TT cauto TTT=read();rep(_,TTT)
const ll MOD=1e9+7; //998244353;

int main(){
  ios_base::sync_with_stdio(false); cin.tie(0);
  cout<<fixed<<setprecision(0);
	vv<int> vs(4);
	rep(i,4) vs[i].resize(read());
	cauto ord=read();
	rep(i,4)for(auto &v:vs[i]) cin>>v;
	vector<ll> ps;
	for(cauto &v:vs[2])for(cauto &w:vs[3]) ps.eb(v*w);
	sort(all(ps));
	vector<ll> ns;
	for(cauto &p:ps) ns.eb(-p);
	reverse(all(ns));
	cauto get=
		[&](cauto &s)->ll{ //<s
			ll re=0;
			for(cauto &v:vs[0])for(cauto &w:vs[1]){
					auto p=v*w;
					if(p==0){
						if(s>0) re+=ps.size();
					}else if(p>0){
						re+=lower_bound(all(ps),(s+(s<0?0:p-1))/p)-ps.begin();
					}else{
						p=-p;
						re+=lower_bound(all(ns),(s+(s<0?0:p-1))/p)-ns.begin();
					}
				}
			return re;
		};
	// out(get(0),1); return 0;
	ll l=-1e18,r=1e18;
	while(r-l>1){
		cauto m=(l+r)/2;
		(get(m)<ord?l:r)=m;
	}
	cout<<l NL;
	for(cauto &v:vs[0])for(cauto &w:vs[1]){
			if(l%(v*w)) continue;
			cauto rem=l/v/w;
			cauto it=lower_bound(all(ps),rem);
			if(it!=ps.end() && *it==rem){
				cout<<v<<" "<<w<<" ";
				for(cauto &v:vs[2])for(cauto &w:vs[3])if(v*w==rem){
							cout<<v<<" "<<w NL;
							exit(0);
						}

			}
		}
  return 0;
}
0