結果

問題 No.1460 Max of Min
ユーザー kotatsugamekotatsugame
提出日時 2021-03-31 22:49:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 820 bytes
コンパイル時間 1,189 ms
コンパイル使用メモリ 88,980 KB
実行使用メモリ 74,880 KB
最終ジャッジ日時 2024-05-09 09:30:12
合計ジャッジ時間 6,411 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 22 ms
19,840 KB
testcase_07 WA -
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 6 ms
6,528 KB
testcase_13 AC 80 ms
71,808 KB
testcase_14 AC 11 ms
11,264 KB
testcase_15 AC 5 ms
6,400 KB
testcase_16 AC 74 ms
69,888 KB
testcase_17 WA -
testcase_18 AC 11 ms
8,192 KB
testcase_19 WA -
testcase_20 AC 3 ms
5,376 KB
testcase_21 AC 6 ms
6,272 KB
testcase_22 AC 33 ms
31,488 KB
testcase_23 AC 4 ms
5,376 KB
testcase_24 AC 65 ms
59,392 KB
testcase_25 AC 3 ms
5,376 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 4 ms
5,376 KB
testcase_29 WA -
testcase_30 AC 77 ms
71,424 KB
testcase_31 AC 16 ms
15,488 KB
testcase_32 AC 60 ms
57,088 KB
testcase_33 AC 4 ms
5,376 KB
testcase_34 AC 44 ms
38,144 KB
testcase_35 AC 11 ms
12,032 KB
testcase_36 AC 3 ms
5,376 KB
testcase_37 AC 17 ms
18,816 KB
testcase_38 AC 5 ms
5,760 KB
testcase_39 AC 43 ms
38,016 KB
testcase_40 AC 40 ms
34,560 KB
testcase_41 AC 18 ms
16,384 KB
testcase_42 AC 10 ms
10,624 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 8 ms
7,168 KB
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 AC 14 ms
14,208 KB
testcase_50 AC 4 ms
5,504 KB
testcase_51 WA -
testcase_52 AC 41 ms
30,080 KB
testcase_53 AC 13 ms
13,440 KB
testcase_54 AC 13 ms
12,800 KB
testcase_55 WA -
testcase_56 AC 11 ms
9,728 KB
testcase_57 WA -
testcase_58 AC 81 ms
74,752 KB
testcase_59 WA -
testcase_60 AC 81 ms
74,624 KB
testcase_61 AC 17 ms
17,024 KB
testcase_62 AC 16 ms
17,024 KB
testcase_63 AC 3 ms
5,376 KB
testcase_64 AC 3 ms
5,376 KB
testcase_65 WA -
testcase_66 AC 16 ms
16,256 KB
testcase_67 AC 4 ms
5,376 KB
testcase_68 WA -
testcase_69 WA -
testcase_70 AC 56 ms
55,808 KB
testcase_71 WA -
testcase_72 AC 14 ms
13,184 KB
testcase_73 AC 13 ms
13,184 KB
testcase_74 AC 10 ms
11,264 KB
testcase_75 AC 8 ms
8,960 KB
testcase_76 AC 8 ms
8,576 KB
testcase_77 AC 9 ms
9,728 KB
testcase_78 AC 4 ms
5,376 KB
testcase_79 AC 10 ms
10,624 KB
testcase_80 AC 6 ms
6,784 KB
testcase_81 AC 4 ms
5,376 KB
testcase_82 AC 6 ms
7,680 KB
testcase_83 AC 5 ms
5,376 KB
testcase_84 AC 81 ms
73,856 KB
testcase_85 AC 85 ms
73,728 KB
testcase_86 AC 14 ms
14,464 KB
testcase_87 AC 84 ms
74,240 KB
testcase_88 AC 80 ms
74,496 KB
testcase_89 AC 43 ms
41,728 KB
testcase_90 AC 82 ms
73,856 KB
testcase_91 AC 82 ms
74,752 KB
testcase_92 AC 81 ms
74,624 KB
testcase_93 AC 94 ms
73,856 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:19:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   19 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
long N;
int K;
long A[1010],B[1010];
const int LIM=10000;
long T[LIM];
vector<long>succ(vector<long>F)
{
	long nxt=-9e18;
	for(int j=0;j<K;j++)nxt=max(nxt,min(F[j],B[j]));
	F.erase(F.begin());
	F.push_back(nxt);
	return F;
}
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++)T[i]=A[i];
	if(N<K)
	{
		cout<<A[N]<<endl;
		return 0;
	}
	vector<long>F(A,A+K);
	long U=N-K;
	map<vector<long>,int>mp;
	int now=K;
	mp[F]=now;
	while(U>0&&now<LIM)
	{
		U--;
		F=succ(F);
		T[now]=F[K-1];
		now++;
		if(mp.find(F)!=mp.end())U%=now-mp[F];
		else mp[F]=now;
	}
	if(U==0)cout<<succ(F)[K-1]<<endl;
	else
	{
		if(N>=LIM)
		{
			N-=LIM;
			N%=K;
			N+=LIM-K;
		}
		cout<<T[N]<<endl;
	}
}
0