Submission details
Task:Lisäykset
Sender:TapaniS
Submission time:2025-11-28 23:18:02 +0200
Language:Java
Status:READY
Result:20
Feedback
groupverdictscore
#1ACCEPTED20
#20
#30
Test results
testverdicttimegroup
#1ACCEPTED0.09 s1, 2, 3details
#2ACCEPTED0.16 s1, 2, 3details
#3ACCEPTED0.15 s1, 3details
#4ACCEPTED0.16 s1, 3details
#5ACCEPTED0.15 s1, 3details
#6--2, 3details
#7--3details
#8--3details
#9--3details
#10--3details
#11--3details

Code

import java.util.*;
import java.io.*;

public class lisat {


	public static void main(String[] args) throws IOException {

		// Scanner input = new Scanner(System.in);
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		// String kokomaara =  input.nextLine();
		String[] parts = br.readLine().split(" ");
		
		// String[] kokomaaraParts = kokomaara.split("\\s+");
		
		int n = Integer.parseInt(parts[0]);  // listan koko
		int m = Integer.parseInt(parts[1]); // operaatioiden maara
		
		// int t = Integer.parseInt(input.nextLine());
		
		int[] x = new int[n];  // luvut
		int[] k = new int[m];  // määrät

		
		String[] parts2 = br.readLine().split(" ");
		// String num =  input.nextLine();
		// String[] numParts = num.split("\\s+");
		
		int sum1 = 0;
		
		for (int i = 0; i < n; i++) {
			x[i] = Integer.parseInt(parts2[i]);
			sum1 += x[i];
		}

		String[] parts3 = br.readLine().split(" ");
		// String[] rajat = new String[q]; // numerot

		int sum2 = 0;
		
		for (int i = 0; i < m; i++) {
			k[i] = Integer.parseInt(parts3[i]);
			sum2 += k[i];
		}

		// input.close(); 
		
		// Program here

		StringBuilder sb = new StringBuilder();

		for (int i1 = 0; i1 < m; i1++) {	 // operaatiot

			for (int i2 = 0; i2 < k[i1]; i2++) {
		  
				x[i2]++;

			} // i2
			
			Arrays.sort(x);
			
		}  // i1


		for (int i = 0; i < (n-1); i++) {	 // listan alkiot
		
				sb.append(x[i]).append(" ");
			}

		sb.append(x[n-1]).append('\n');
		
		// tulostus sb.append(x[i]).append('\n');
		
		// System.out.println(dy + " " + dx);		

		System.out.print(sb.toString());

    }
}

Test details

Test 1

Group: 1, 2, 3

Verdict: ACCEPTED

input
1 1000
0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

correct output
1000 

user output
1000

Test 2

Group: 1, 2, 3

Verdict: ACCEPTED

input
1000 1000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

correct output
511 511 511 511 511 511 511 51...

user output
511 511 511 511 511 511 511 51...

Test 3

Group: 1, 3

Verdict: ACCEPTED

input
1000 1000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

correct output
495 495 495 495 495 495 495 49...

user output
495 495 495 495 495 495 495 49...

Test 4

Group: 1, 3

Verdict: ACCEPTED

input
1000 1000
0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 ...

correct output
562 562 562 562 562 562 562 56...

user output
562 562 562 562 562 562 562 56...

Test 5

Group: 1, 3

Verdict: ACCEPTED

input
1000 1000
0 1 3 4 6 9 9 9 10 11 11 11 11...

correct output
997 997 997 997 997 998 998 99...

user output
997 997 997 997 997 998 998 99...

Test 6

Group: 2, 3

Verdict:

input
100000 100000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

correct output
50033 50033 50033 50033 50033 ...

user output
(empty)

Test 7

Group: 3

Verdict:

input
100000 100000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

correct output
49996 49996 49996 49996 49996 ...

user output
(empty)

Test 8

Group: 3

Verdict:

input
100000 100000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

correct output
50057 50057 50057 50057 50057 ...

user output
(empty)

Test 9

Group: 3

Verdict:

input
100000 100000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

correct output
50536 50536 50536 50536 50536 ...

user output
(empty)

Test 10

Group: 3

Verdict:

input
100000 100000
0 4 7 29 33 44 52 75 77 79 82 ...

correct output
100000 100001 100003 100023 10...

user output
(empty)

Test 11

Group: 3

Verdict:

input
100000 100000
1 12 14 16 49 59 59 63 68 73 8...

correct output
100001 100010 100012 100014 10...

user output
(empty)