結果
| 問題 |
No.1460 Max of Min
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-31 22:31:57 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 467 bytes |
| コンパイル時間 | 666 ms |
| コンパイル使用メモリ | 74,784 KB |
| 実行使用メモリ | 11,868 KB |
| 最終ジャッジ日時 | 2024-12-15 20:18:06 |
| 合計ジャッジ時間 | 105,231 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 85 WA * 6 |
コンパイルメッセージ
main.cpp:11:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
11 | main()
| ^~~~
ソースコード
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
long N;
int K;
long A[1010],B[1010];
const int LIM=1<<20;
long F[LIM+1];
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<=LIM;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>=LIM)
{
N-=LIM;
N%=K;
N=LIM-K+N;
}
cout<<F[N]<<endl;
}