結果

問題 No.1460 Max of Min
ユーザー kotatsugame
提出日時 2021-03-31 22:28:45
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 424 bytes
コンパイル時間 567 ms
コンパイル使用メモリ 74,228 KB
実行使用メモリ 11,848 KB
最終ジャッジ日時 2024-12-15 20:09:44
合計ジャッジ時間 104,886 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 87 WA * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:10:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   10 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
long N;
int K;
long A[1010],B[1010];
long F[1<<20];
main()
{
	cin>>K>>N;
	for(int i=0;i<K;i++)cin>>A[i];
	for(int i=0;i<K;i++)cin>>B[i];
	for(int i=0;i<K;i++)F[i]=A[i];
	for(int i=K;i<1<<20;i++)
	{
		long nxt=-9e18;
		for(int j=0;j<K;j++)nxt=max(nxt,min(F[i-K+j],B[j]));
		F[i]=nxt;
	}
	if(N>=1<<20)N=(1<<20)-1;
	cout<<F[N]<<endl;
}
0