結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー kotatsugamekotatsugame
提出日時 2021-01-29 22:59:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 558 ms / 2,000 ms
コード長 415 bytes
コンパイル時間 2,599 ms
コンパイル使用メモリ 71,088 KB
実行使用メモリ 6,768 KB
最終ジャッジ日時 2023-09-09 16:43:53
合計ジャッジ時間 45,140 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,056 KB
testcase_01 AC 2 ms
5,060 KB
testcase_02 AC 2 ms
5,064 KB
testcase_03 AC 281 ms
5,176 KB
testcase_04 AC 282 ms
5,188 KB
testcase_05 AC 255 ms
5,176 KB
testcase_06 AC 254 ms
5,208 KB
testcase_07 AC 385 ms
5,680 KB
testcase_08 AC 385 ms
5,596 KB
testcase_09 AC 107 ms
5,060 KB
testcase_10 AC 107 ms
5,064 KB
testcase_11 AC 493 ms
6,320 KB
testcase_12 AC 495 ms
6,444 KB
testcase_13 AC 320 ms
5,432 KB
testcase_14 AC 318 ms
5,468 KB
testcase_15 AC 277 ms
5,064 KB
testcase_16 AC 277 ms
5,000 KB
testcase_17 AC 519 ms
6,288 KB
testcase_18 AC 519 ms
6,264 KB
testcase_19 AC 453 ms
5,908 KB
testcase_20 AC 452 ms
5,872 KB
testcase_21 AC 486 ms
6,076 KB
testcase_22 AC 486 ms
6,120 KB
testcase_23 AC 337 ms
5,316 KB
testcase_24 AC 338 ms
5,472 KB
testcase_25 AC 54 ms
4,996 KB
testcase_26 AC 54 ms
5,068 KB
testcase_27 AC 174 ms
5,000 KB
testcase_28 AC 174 ms
4,844 KB
testcase_29 AC 214 ms
5,064 KB
testcase_30 AC 215 ms
5,064 KB
testcase_31 AC 286 ms
5,272 KB
testcase_32 AC 287 ms
5,284 KB
testcase_33 AC 212 ms
5,000 KB
testcase_34 AC 212 ms
5,068 KB
testcase_35 AC 280 ms
5,112 KB
testcase_36 AC 281 ms
5,224 KB
testcase_37 AC 57 ms
4,996 KB
testcase_38 AC 57 ms
5,064 KB
testcase_39 AC 47 ms
5,000 KB
testcase_40 AC 46 ms
5,060 KB
testcase_41 AC 101 ms
5,000 KB
testcase_42 AC 101 ms
5,000 KB
testcase_43 AC 80 ms
5,072 KB
testcase_44 AC 526 ms
6,340 KB
testcase_45 AC 219 ms
5,000 KB
testcase_46 AC 74 ms
5,060 KB
testcase_47 AC 366 ms
5,584 KB
testcase_48 AC 353 ms
5,672 KB
testcase_49 AC 355 ms
5,516 KB
testcase_50 AC 271 ms
5,004 KB
testcase_51 AC 15 ms
5,064 KB
testcase_52 AC 466 ms
5,984 KB
testcase_53 AC 533 ms
6,756 KB
testcase_54 AC 555 ms
6,500 KB
testcase_55 AC 549 ms
6,648 KB
testcase_56 AC 554 ms
6,452 KB
testcase_57 AC 557 ms
6,764 KB
testcase_58 AC 552 ms
6,572 KB
testcase_59 AC 554 ms
6,508 KB
testcase_60 AC 546 ms
6,572 KB
testcase_61 AC 521 ms
6,460 KB
testcase_62 AC 555 ms
6,644 KB
testcase_63 AC 554 ms
6,448 KB
testcase_64 AC 554 ms
6,456 KB
testcase_65 AC 547 ms
6,540 KB
testcase_66 AC 554 ms
6,484 KB
testcase_67 AC 558 ms
6,484 KB
testcase_68 AC 540 ms
6,644 KB
testcase_69 AC 520 ms
6,480 KB
testcase_70 AC 526 ms
6,460 KB
testcase_71 AC 500 ms
6,460 KB
testcase_72 AC 553 ms
6,572 KB
testcase_73 AC 544 ms
6,768 KB
testcase_74 AC 533 ms
6,720 KB
testcase_75 AC 542 ms
6,460 KB
testcase_76 AC 532 ms
6,488 KB
testcase_77 AC 537 ms
6,568 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:8:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    8 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<algorithm>
using namespace std;
int N,K;
long M;
long p(long a,long b){return b?p(a*a%M,b/2)*(b%2?a:1)%M:1;}
int A[4][2<<17];
main()
{
	cin>>N>>K>>M;
	for(int i=0;i<4;i++)
	{
		for(int j=0;j<N;j++)cin>>A[i][j];
		sort(A[i],A[i]+N);
	}
	long ans=0;
	for(int i=0;i<N;i++)
	{
		int B[4];
		for(int j=0;j<4;j++)B[j]=A[j][i];
		sort(B,B+4);
		(ans+=p(B[3]-B[0],K))%=M;
	}
	cout<<ans<<endl;
}
0