結果

問題 No.1460 Max of Min
ユーザー 👑 Nachia
提出日時 2021-03-31 22:40:31
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 462 bytes
コンパイル時間 1,921 ms
コンパイル使用メモリ 193,796 KB
最終ジャッジ日時 2025-01-20 04:09:46
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 77
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |   scanf("%d%lld",&K,&N);
      |   ~~~~~^~~~~~~~~~~~~~~~
main.cpp:13:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |   A.resize(K); rep(i,K) scanf("%lld",&A[i]);
      |                         ~~~~~^~~~~~~~~~~~~~
main.cpp:14:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |   B.resize(K); rep(i,K) scanf("%lld",&B[i]);
      |                         ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

int K;
ll N;
vector<ll> A,B;

int main(){
  scanf("%d%lld",&K,&N);
  A.resize(K); rep(i,K) scanf("%lld",&A[i]);
  B.resize(K); rep(i,K) scanf("%lld",&B[i]);
  if(N<K){ printf("%lld\n",A[N]); return 0; }
  ll ans=0;
  rep(i,K) rep(j,K) if(N%(K-j)==i%(K-j)) ans=max(ans,min(A[i],B[j]));
  printf("%lld\n",ans);
  return 0;
}
0