結果

問題 No.2261 Coffee
ユーザー publfl2publfl2
提出日時 2023-04-07 21:36:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 126 ms / 2,000 ms
コード長 728 bytes
コンパイル時間 413 ms
コンパイル使用メモリ 33,664 KB
実行使用メモリ 29,824 KB
最終ジャッジ日時 2024-04-10 16:42:39
合計ジャッジ時間 5,728 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 6 ms
5,376 KB
testcase_18 AC 6 ms
5,376 KB
testcase_19 AC 5 ms
5,376 KB
testcase_20 AC 5 ms
5,376 KB
testcase_21 AC 6 ms
5,376 KB
testcase_22 AC 5 ms
5,376 KB
testcase_23 AC 7 ms
5,376 KB
testcase_24 AC 111 ms
28,032 KB
testcase_25 AC 102 ms
24,704 KB
testcase_26 AC 126 ms
29,440 KB
testcase_27 AC 109 ms
27,648 KB
testcase_28 AC 68 ms
25,472 KB
testcase_29 AC 68 ms
25,088 KB
testcase_30 AC 53 ms
20,480 KB
testcase_31 AC 83 ms
29,440 KB
testcase_32 AC 80 ms
29,568 KB
testcase_33 AC 83 ms
29,696 KB
testcase_34 AC 87 ms
29,568 KB
testcase_35 AC 84 ms
29,696 KB
testcase_36 AC 82 ms
29,696 KB
testcase_37 AC 83 ms
29,524 KB
testcase_38 AC 119 ms
29,696 KB
testcase_39 AC 120 ms
29,696 KB
testcase_40 AC 123 ms
29,824 KB
testcase_41 AC 120 ms
29,568 KB
testcase_42 AC 123 ms
29,696 KB
testcase_43 AC 123 ms
29,440 KB
testcase_44 AC 126 ms
29,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

long long int x[100010],y[33][100010];
long long int ans[100010];
int main()
{
	int a;
	scanf("%d",&a);
	for(int i=1;i<=a;i++)
	{
		for(int j=0;j<=4;j++) scanf("%lld",&x[j]);
		for(int k=0;k<=31;k++)
		{
			long long int S = 0;
			for(int j=0;j<=4;j++)
			{
				if(((k>>j)&1)==0) S += x[j];
				else S -= x[j];
			}
			y[k][i] = S;
		}
	}
	
	for(int i=1;i<=a;i++) ans[i] = 0;
	for(int k=0;k<=31;k++)
	{
		long long int min = y[k][1], max = y[k][1];
		for(int i=1;i<=a;i++)
		{
			min = min<y[k][i]?min:y[k][i];
			max = max>y[k][i]?max:y[k][i];
		}
		for(int i=1;i<=a;i++)
		{
			long long int val = max - y[k][i];
			ans[i] = ans[i]>val?ans[i]:val;
		}
	}
	
	for(int i=1;i<=a;i++) printf("%lld\n",ans[i]);
}
0