結果

問題 No.178 美しいWhitespace (1)
ユーザー ki_ki33ki_ki33
提出日時 2015-04-05 23:49:12
言語 Java21
(openjdk 21)
結果
AC  
実行時間 183 ms / 2,000 ms
コード長 1,197 bytes
コンパイル時間 2,265 ms
コンパイル使用メモリ 79,104 KB
実行使用メモリ 59,328 KB
最終ジャッジ日時 2023-09-17 04:45:28
合計ジャッジ時間 7,395 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
55,804 KB
testcase_01 AC 105 ms
56,000 KB
testcase_02 AC 104 ms
56,108 KB
testcase_03 AC 105 ms
55,660 KB
testcase_04 AC 173 ms
58,208 KB
testcase_05 AC 175 ms
58,320 KB
testcase_06 AC 176 ms
58,556 KB
testcase_07 AC 178 ms
59,252 KB
testcase_08 AC 173 ms
58,512 KB
testcase_09 AC 175 ms
58,656 KB
testcase_10 AC 177 ms
59,328 KB
testcase_11 AC 164 ms
58,496 KB
testcase_12 AC 173 ms
58,628 KB
testcase_13 AC 179 ms
58,420 KB
testcase_14 AC 177 ms
58,328 KB
testcase_15 AC 173 ms
58,524 KB
testcase_16 AC 181 ms
58,576 KB
testcase_17 AC 183 ms
58,872 KB
testcase_18 AC 175 ms
58,716 KB
testcase_19 AC 179 ms
58,468 KB
testcase_20 AC 170 ms
58,740 KB
testcase_21 AC 183 ms
58,516 KB
testcase_22 AC 166 ms
59,164 KB
testcase_23 AC 173 ms
58,580 KB
testcase_24 AC 170 ms
58,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.awt.Point;
import java.awt.Rectangle;
import java.awt.geom.Rectangle2D;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentSkipListSet;

public class Main {
	public static final int C =  1000000007;
	static final int CY = 1000000000;
	//static boolean MAP[][];
	static int N;
	static int B;
	static int[][] POS;
	static String S;
	static int X[][];
	static int HA[];
	static long DP[];
	static int ST[][];
	static ConcurrentSkipListSet<Integer> TS;
	static ArrayList<Integer> AL;
	public static void main(String[] args) {
		StringBuilder sb = new StringBuilder();
		BufferedInputStream bs = new BufferedInputStream(System.in);
		Scanner sc = new Scanner(bs);

		N = sc.nextInt();
		long[] a = new long[N];
		long max = 0;
		for (int i =0; i < N; i++) {
			a[i] = sc.nextLong()*1 + sc.nextLong()*4;
			max = Math.max(max, a[i]);
		}
		
		
		long ans = 0;
		
		
		for (int i=0; i < N; i++) {
			long num = -a[i] + max;
			if (num %2 != 0) {
				ans = -1;
				break;
			}
			ans += num/2;
		}
		
		System.out.println(ans);
		
	}
}
0