QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#24260#2291. Lopsided LineupjskopWA 82ms38688kbJava8904b2022-03-28 20:48:302022-04-30 05:21:59

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-04-30 05:21:59]
  • 评测
  • 测评结果:WA
  • 用时:82ms
  • 内存:38688kb
  • [2022-03-28 20:48:30]
  • 提交

answer

import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Solution
{
	public static void main(String[] args) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String line = "";
		ArrayList<String> lines = new ArrayList<String>();
		ArrayList<Integer> sums = new ArrayList<Integer>();
		while(line!=null) {
			line = reader.readLine();
			lines.add(line);
		}
		int players = Integer.parseInt(lines.get(0));
		for(int i=0; i<players; i++) {
			int sum = 0;
			for(String s: lines.get(i).split(" ")) {
				sum += Integer.parseInt(s);
			}
			sums.add(sum);
		}
		Collections.sort(sums);
		int max = 0;
		int min = 0;
		for(int i=0; i<players/2; i++) {
			max += sums.get(players-i-1);
			min += sums.get(i);
		}
		System.out.println((max-min)/2);
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 82ms
memory: 38688kb

input:

20
0 786505 911962 -800624 363821 -960995 -492637 -246590 140762 54707 -353306 -82216 -175650 567363 113374 761152 906126 -394096 -635055 675627
786505 0 801116 -323471 -34197 -860051 865281 737621 307515 -493253 -128788 -171663 -21931 853897 -505337 72985 941995 -380960 -223577 265322
911962 801116...

output:

21426130

result:

wrong answer 1st lines differ - expected: '21235600', found: '21426130'