exec_outcome stringclasses 1
value | code_uid stringlengths 32 32 | file_name stringclasses 111
values | prob_desc_created_at stringlengths 10 10 | prob_desc_description stringlengths 63 3.8k | prob_desc_memory_limit stringclasses 18
values | source_code stringlengths 117 65.5k | lang_cluster stringclasses 1
value | prob_desc_sample_inputs stringlengths 2 802 | prob_desc_time_limit stringclasses 27
values | prob_desc_sample_outputs stringlengths 2 796 | prob_desc_notes stringlengths 4 3k ⌀ | lang stringclasses 5
values | prob_desc_input_from stringclasses 3
values | tags listlengths 0 11 | src_uid stringlengths 32 32 | prob_desc_input_spec stringlengths 28 2.37k ⌀ | difficulty int64 -1 3.5k ⌀ | prob_desc_output_spec stringlengths 17 1.47k ⌀ | prob_desc_output_to stringclasses 3
values | hidden_unit_tests stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
PASSED | ec9e0da5eefb3218f9b8a18c18e20c52 | train_001.jsonl | 1484499900 | It's Christmas time! PolandBall and his friends will be giving themselves gifts. There are n Balls overall. Each Ball has someone for whom he should bring a present according to some permutation p, pi ≠ i for all i.Unfortunately, Balls are quite clumsy. We know earlier that exactly k of them will forget to bring their ... | 256 megabytes | import javax.print.attribute.IntegerSyntax;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.StringTokenizer;
/**
* Created by Meepo on 3/11/2017.
*/
... | Java | ["5 2\n3 4 1 5 2", "10 1\n2 3 4 5 6 7 8 9 10 1"] | 1.5 seconds | ["2 4", "2 2"] | NoteIn the first sample, if the third and the first balls will forget to bring their presents, they will be th only balls not getting a present. Thus the minimum answer is 2. However, if the first ans the second balls will forget to bring their presents, then only the fifth ball will get a present. So, the maximum answ... | Java 8 | standard input | [
"dp",
"bitmasks",
"greedy"
] | a0ddb8f02a91865dc65a214f1de111e3 | The first line of input contains two integers n and k (2 ≤ n ≤ 106, 0 ≤ k ≤ n), representing the number of Balls and the number of Balls who will forget to bring their presents. The second line contains the permutation p of integers from 1 to n, where pi is the index of Ball who should get a gift from the i-th Ball. F... | 2,600 | You should output two values — minimum and maximum possible number of Balls who will not get their presents, in that order. | standard output | |
PASSED | e04d4861c47e07802d20cbc56f88dc34 | train_001.jsonl | 1484499900 | It's Christmas time! PolandBall and his friends will be giving themselves gifts. There are n Balls overall. Each Ball has someone for whom he should bring a present according to some permutation p, pi ≠ i for all i.Unfortunately, Balls are quite clumsy. We know earlier that exactly k of them will forget to bring their ... | 256 megabytes | import javax.print.attribute.IntegerSyntax;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.StringTokenizer;
/**
* Created by Meepo on 3/11/2017.
*/
... | Java | ["5 2\n3 4 1 5 2", "10 1\n2 3 4 5 6 7 8 9 10 1"] | 1.5 seconds | ["2 4", "2 2"] | NoteIn the first sample, if the third and the first balls will forget to bring their presents, they will be th only balls not getting a present. Thus the minimum answer is 2. However, if the first ans the second balls will forget to bring their presents, then only the fifth ball will get a present. So, the maximum answ... | Java 8 | standard input | [
"dp",
"bitmasks",
"greedy"
] | a0ddb8f02a91865dc65a214f1de111e3 | The first line of input contains two integers n and k (2 ≤ n ≤ 106, 0 ≤ k ≤ n), representing the number of Balls and the number of Balls who will forget to bring their presents. The second line contains the permutation p of integers from 1 to n, where pi is the index of Ball who should get a gift from the i-th Ball. F... | 2,600 | You should output two values — minimum and maximum possible number of Balls who will not get their presents, in that order. | standard output | |
PASSED | 2491c0fd9281237324cba3d5fac653e3 | train_001.jsonl | 1484499900 | It's Christmas time! PolandBall and his friends will be giving themselves gifts. There are n Balls overall. Each Ball has someone for whom he should bring a present according to some permutation p, pi ≠ i for all i.Unfortunately, Balls are quite clumsy. We know earlier that exactly k of them will forget to bring their ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.io.Writer;
... | Java | ["5 2\n3 4 1 5 2", "10 1\n2 3 4 5 6 7 8 9 10 1"] | 1.5 seconds | ["2 4", "2 2"] | NoteIn the first sample, if the third and the first balls will forget to bring their presents, they will be th only balls not getting a present. Thus the minimum answer is 2. However, if the first ans the second balls will forget to bring their presents, then only the fifth ball will get a present. So, the maximum answ... | Java 8 | standard input | [
"dp",
"bitmasks",
"greedy"
] | a0ddb8f02a91865dc65a214f1de111e3 | The first line of input contains two integers n and k (2 ≤ n ≤ 106, 0 ≤ k ≤ n), representing the number of Balls and the number of Balls who will forget to bring their presents. The second line contains the permutation p of integers from 1 to n, where pi is the index of Ball who should get a gift from the i-th Ball. F... | 2,600 | You should output two values — minimum and maximum possible number of Balls who will not get their presents, in that order. | standard output | |
PASSED | 777d947638108e2c5cd0d9e5d58586da | train_001.jsonl | 1484499900 | It's Christmas time! PolandBall and his friends will be giving themselves gifts. There are n Balls overall. Each Ball has someone for whom he should bring a present according to some permutation p, pi ≠ i for all i.Unfortunately, Balls are quite clumsy. We know earlier that exactly k of them will forget to bring their ... | 256 megabytes | import java.io.*;
import java.util.*;
public class F {
BufferedReader br;
PrintWriter out;
StringTokenizer st;
boolean eof;
int get(int mask, int i) {
return (mask >> i) & 1;
}
int[] f(int n, int k) {
int min = Integer.MAX_VALUE;
int max = Integer.MIN_VALUE;
for (int mask = 0; mask < (1 << n); mask... | Java | ["5 2\n3 4 1 5 2", "10 1\n2 3 4 5 6 7 8 9 10 1"] | 1.5 seconds | ["2 4", "2 2"] | NoteIn the first sample, if the third and the first balls will forget to bring their presents, they will be th only balls not getting a present. Thus the minimum answer is 2. However, if the first ans the second balls will forget to bring their presents, then only the fifth ball will get a present. So, the maximum answ... | Java 8 | standard input | [
"dp",
"bitmasks",
"greedy"
] | a0ddb8f02a91865dc65a214f1de111e3 | The first line of input contains two integers n and k (2 ≤ n ≤ 106, 0 ≤ k ≤ n), representing the number of Balls and the number of Balls who will forget to bring their presents. The second line contains the permutation p of integers from 1 to n, where pi is the index of Ball who should get a gift from the i-th Ball. F... | 2,600 | You should output two values — minimum and maximum possible number of Balls who will not get their presents, in that order. | standard output | |
PASSED | 7d6ec4fc200c4d3af49103358d4f5826 | train_001.jsonl | 1484499900 | It's Christmas time! PolandBall and his friends will be giving themselves gifts. There are n Balls overall. Each Ball has someone for whom he should bring a present according to some permutation p, pi ≠ i for all i.Unfortunately, Balls are quite clumsy. We know earlier that exactly k of them will forget to bring their ... | 256 megabytes | /*
* Code Author: Akshay Miterani
* DA-IICT
*/
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
InputReader in;
PrintWriter out;
Main() throws IOException {
in = new InputReader(System.in);
out = new PrintWriter(System.out);
//in = new InputReader(new FileInputStream("input_.t... | Java | ["5 2\n3 4 1 5 2", "10 1\n2 3 4 5 6 7 8 9 10 1"] | 1.5 seconds | ["2 4", "2 2"] | NoteIn the first sample, if the third and the first balls will forget to bring their presents, they will be th only balls not getting a present. Thus the minimum answer is 2. However, if the first ans the second balls will forget to bring their presents, then only the fifth ball will get a present. So, the maximum answ... | Java 8 | standard input | [
"dp",
"bitmasks",
"greedy"
] | a0ddb8f02a91865dc65a214f1de111e3 | The first line of input contains two integers n and k (2 ≤ n ≤ 106, 0 ≤ k ≤ n), representing the number of Balls and the number of Balls who will forget to bring their presents. The second line contains the permutation p of integers from 1 to n, where pi is the index of Ball who should get a gift from the i-th Ball. F... | 2,600 | You should output two values — minimum and maximum possible number of Balls who will not get their presents, in that order. | standard output | |
PASSED | bde62e41139ea780d9d9597bc0a2003f | train_001.jsonl | 1484499900 | It's Christmas time! PolandBall and his friends will be giving themselves gifts. There are n Balls overall. Each Ball has someone for whom he should bring a present according to some permutation p, pi ≠ i for all i.Unfortunately, Balls are quite clumsy. We know earlier that exactly k of them will forget to bring their ... | 256 megabytes | /*
* Code Author: Akshay Miterani
* DA-IICT
*/
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
InputReader in;
PrintWriter out;
Main() throws IOException {
in = new InputReader(System.in);
out = new PrintWriter(System.out);
//in = new InputReader(new FileInputStream("input_.t... | Java | ["5 2\n3 4 1 5 2", "10 1\n2 3 4 5 6 7 8 9 10 1"] | 1.5 seconds | ["2 4", "2 2"] | NoteIn the first sample, if the third and the first balls will forget to bring their presents, they will be th only balls not getting a present. Thus the minimum answer is 2. However, if the first ans the second balls will forget to bring their presents, then only the fifth ball will get a present. So, the maximum answ... | Java 8 | standard input | [
"dp",
"bitmasks",
"greedy"
] | a0ddb8f02a91865dc65a214f1de111e3 | The first line of input contains two integers n and k (2 ≤ n ≤ 106, 0 ≤ k ≤ n), representing the number of Balls and the number of Balls who will forget to bring their presents. The second line contains the permutation p of integers from 1 to n, where pi is the index of Ball who should get a gift from the i-th Ball. F... | 2,600 | You should output two values — minimum and maximum possible number of Balls who will not get their presents, in that order. | standard output | |
PASSED | a1bd29ecc8146253256ca2ae10684cb5 | train_001.jsonl | 1484499900 | It's Christmas time! PolandBall and his friends will be giving themselves gifts. There are n Balls overall. Each Ball has someone for whom he should bring a present according to some permutation p, pi ≠ i for all i.Unfortunately, Balls are quite clumsy. We know earlier that exactly k of them will forget to bring their ... | 256 megabytes | /*
* Code Author: Akshay Miterani
* DA-IICT
*/
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
InputReader in;
PrintWriter out;
Main() throws IOException {
in = new InputReader(System.in);
out = new PrintWriter(System.out);
//in = new InputReader(new FileInputStream("input_.t... | Java | ["5 2\n3 4 1 5 2", "10 1\n2 3 4 5 6 7 8 9 10 1"] | 1.5 seconds | ["2 4", "2 2"] | NoteIn the first sample, if the third and the first balls will forget to bring their presents, they will be th only balls not getting a present. Thus the minimum answer is 2. However, if the first ans the second balls will forget to bring their presents, then only the fifth ball will get a present. So, the maximum answ... | Java 8 | standard input | [
"dp",
"bitmasks",
"greedy"
] | a0ddb8f02a91865dc65a214f1de111e3 | The first line of input contains two integers n and k (2 ≤ n ≤ 106, 0 ≤ k ≤ n), representing the number of Balls and the number of Balls who will forget to bring their presents. The second line contains the permutation p of integers from 1 to n, where pi is the index of Ball who should get a gift from the i-th Ball. F... | 2,600 | You should output two values — minimum and maximum possible number of Balls who will not get their presents, in that order. | standard output | |
PASSED | 761f244bce46298b5e6806c44f0cacf8 | train_001.jsonl | 1484499900 | It's Christmas time! PolandBall and his friends will be giving themselves gifts. There are n Balls overall. Each Ball has someone for whom he should bring a present according to some permutation p, pi ≠ i for all i.Unfortunately, Balls are quite clumsy. We know earlier that exactly k of them will forget to bring their ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper... | Java | ["5 2\n3 4 1 5 2", "10 1\n2 3 4 5 6 7 8 9 10 1"] | 1.5 seconds | ["2 4", "2 2"] | NoteIn the first sample, if the third and the first balls will forget to bring their presents, they will be th only balls not getting a present. Thus the minimum answer is 2. However, if the first ans the second balls will forget to bring their presents, then only the fifth ball will get a present. So, the maximum answ... | Java 8 | standard input | [
"dp",
"bitmasks",
"greedy"
] | a0ddb8f02a91865dc65a214f1de111e3 | The first line of input contains two integers n and k (2 ≤ n ≤ 106, 0 ≤ k ≤ n), representing the number of Balls and the number of Balls who will forget to bring their presents. The second line contains the permutation p of integers from 1 to n, where pi is the index of Ball who should get a gift from the i-th Ball. F... | 2,600 | You should output two values — minimum and maximum possible number of Balls who will not get their presents, in that order. | standard output | |
PASSED | 67ce58267b1ea19539eaf6507b7261ba | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = Integer.parseInt(scanner.nextLine());
String nn[] = scanner.nextLine().split(" ");
long t = 0L;
for(int j =0 ; j<nn.length;j++){
... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 8 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | e6aa8687ef81bda1b5eba8bfb0dc5dcc | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author Mohamed Seltene
*/
public cl... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 8 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | f34f2aa065711549ef65241e96aa6d47 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.PrintWriter;
import java.util.Scanner;
public class A103{
public static void main(String [] args){
Scanner sc=new Scanner(System.in);
PrintWriter pw=new PrintWriter(System.out);
int n=sc.nextInt();
long a[]=new long [n];
for(int i=0;i<n;i++){
a[i]=sc.nextLong();
}
long s=0;
for... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 7816f536b58523f4554f687eee9a1ed8 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class TestingPants {
private void solve() throws IOException {
int n = nextInt();
long l = 0;
for(int i=0;i<n;i++)
{
int t = ne... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 9a01b310dd2656df548a2b46b6b73261 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class CodeForces {
public void solve() throws IOException {
int n=nextInt();
long arr[]=new long[n];
for(int i=0;i<n;i++){
arr[i]=nextLong();
... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | b92e2bd758b32a3d427a21a62ca4f306 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;
public class Main {
private static BufferedReader br;
private static PrintWriter pw;
private static StringTokenizer stk = ... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | d9f9f963760b810458f35ea5d6411d35 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
public class sample {
public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
long[] var = new long[n];
for (int i = 0; i < n; i++)
... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 809c5b92ecd6fd5c7f0fe55d9b1bdbb0 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes |
import java.util.*;
import java.util.Arrays;
public class JavaApplication2 {
/**
* @param args
*/
public static void main(String[] args) {
Scanner sc = new Scanner (System.in);
int number = sc.nextInt();
sc.useDelimiter("\\s+");
long[] ch=new long[number+1];
long[] pre=new long[number+1];
pre[0]=0... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | f41ea4f30d86d400d78887e7f44a86cd | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes |
import java.io.*;
import java.util.*;
public class B {
static Scanner in = new Scanner(new BufferedInputStream(System.in));
static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) throws IOException {
int n = in.nextInt();
long ans = 0;
for(int i = 1; i <= n; i++) {
... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 3898293701ad1458765a554a25ce51e8 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.BigInteger;
import static java.lang.Math.*;
public class A implements Runnable {
int [] a;
long [] steps;
long get(int i) {
if (i == a.length) return 0;
return (a[i] - 1) + steps[i + 1] + get(i + 1);
}
void solve() throws Exception {
int n = nextInt(... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 52d2006521ae2f9b0eb9fe468e482e4f | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.math.BigInteger;
import java.util.Scanner;
public class A_103 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
BigInteger result = BigInteger.ZERO;
for(int i=0;i<n;i++)
{
long c = in.nextLong();
result = result.add(BigInteger.valueOf(i ... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | a6e4aa8b82266ac30943c28890ba835d | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.util.*;
public class A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long a[] = new long[n];
for(int i=0; i<n; i++)
a[i] = sc.nextInt();
long ans = 0;
for(int i=0; i<n; i++) {
ans += (a[i] - 1) * (i+1) + 1;
}
System.out.println(... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 2339f09f507a5c52aa9b4d59143165b3 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
import static java.lang.Math.*;
public class Solution implements Runnable {
BufferedReader in;
PrintWriter out;
StringTokenizer st;
boolean file = false;
public static void main(String[] args) throws Exception {
new Thread(new Solution()).start();
}
... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 5a0d381a037652a8d36995ce5c8f8062 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.util.*;
public class SadPants {
public static void main (String [] arg) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long [] q = new long [n];
for (int i = 0; i<n; ++i) q[i] = sc.nextLong();
long ans = 0;
for (int i = 1; i<=n; ++i) {
long wrong = q[i-1] - 1;
ans += ((long)... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 3af56c48b5634db771aa05b8349d5419 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.math.BigInteger;
import java.util.Scanner;
import java.util.Vector;
public class Main {
public static void main(String[] args) {
int number_of_questions;
Vector<BigInteger> number_of_answers = new Vector<BigInteger>();
Scanner scanner = new Scanner(System.in);
... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | c9ac97186465ff85b9f0a758fbc00844 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.PrintWriter;
import java.util.Locale;
import java.util.Scanner;
public class A implements Runnable {
private Scanner in;
private PrintWriter out;
private void solve() {
int n = in.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; ++i) {
a[i] = in.nextInt();
}
long ans = 0;
for (... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | c388f2bc356a245a097d820d311975e8 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.util.*;
public class cf103a {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
long tot=0;
for(int i=1; i<=n; i++)
tot += in.nextLong()*i-(i-1);
System.out.println(tot);
}
}
| Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | f5c8052a5843809e5098249e127bd525 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
public class B_80_TestingPantsForSadness {
public static void main(String[] args) {
try {
BufferedReader input = new BufferedReader(new InputStreamReader(
... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | e0b2cda3a75503e92005c1e01e70a68a | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.util.Scanner;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Ronex
*/
public class Main2 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
long[]tab = new... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 1495608de6a128dd28d4eb8b6057201d | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.text.*;
public class Main {
Scanner cin = new Scanner(new BufferedInputStream(System.in));
int n;
long sum = 0;
long ar[] = new long[105];
void run(){
n = cin.nextInt();
Arrays.fill(ar, 0);
for(int i = 1;... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 99325bba18af8ade23a4df34421cbcee | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class TestingPantsForSadness {
void run() {
try {
BufferedReader bfd = new BufferedReader(new InputStreamReader(
System.in));
int n = Integer.parseInt(bfd.r... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 8b6b6e39980d5fc5400e7bbcb6b8db3a | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes |
import java.util.*;
import java.math.*;
import static java.lang.Character.isDigit;
import static java.lang.Character.isLowerCase;
import static java.lang.Character.isUpperCase;
import static java.lang.Math.*;
import static java.math.BigInteger.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | d485a261a161d937e952913726f0154d | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.*;
import java.util.*;
public class test
{
public static void main(String[] args) throws Exception
{
int n;
Scanner read = new Scanner(System.in);
n = read.nextInt();
int a[] = new int[n];
for (int i = 0; i < n; i++) a[i] = read.nextInt();
long ans = 0,s = 1;
for (int x : a)
{
ans ... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 3dc3eccf62bc0373bc8fabb092056d95 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.util.Scanner;
public class P103A {
public static void main(String[] args) {
Scanner inScanner = new Scanner(System.in);
int n = inScanner.nextInt();
long sum = 0;
for (long i = 0; i < n; i++)
sum += (i + 1) * inScanner.nextLong() - i;
System.out.prin... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 8ae938732d2dd6fb341afb12da9a38b4 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.awt.*;
import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
public class B {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 5807704c946c4a7d04d512ccc7ce79f4 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
public class Test {
/**
* @param args
* @throws IOException
* @throws NumberFormatException
*/
public static void main(String[] args) throws NumberFormatException, IOException {
// TODO Auto-generated method stub
BufferedReader r=new BufferedReader(new I... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | c78c80222087ef698bb2850a651cea12 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
public class A {
private void work() {
Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(
System.in)));
while (sc.hasNextInt()) {
int n = sc.nextInt();
long[] a = new long[n + 1];
for (int i =... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | a0eb8a149fc7a6cc0b60b3bede71e772 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class A80 {
static StringTokenizer st;
static BufferedReader in;
public s... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 7bda5e7150a59b64ac489373190912ec | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
public class Main
{
StreamTokenizer in;
PrintWriter out;
... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 53c4633df33eb8838ec87dfc03d6a2f1 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.util.*;
public class A {
private static Scanner in;
public void run() {
int n = in.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = in.nextInt();
}
long ans = 0;
for (int i = 0; i < n; i++) {
ans += (i + 1L) * a[i] - i;
}
System.out.println(ans);
}
public st... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | b2f58e523fad945db3e7083be91464df | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.*;
import java.util.*;
public class TestingPantsForSadness {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(in.readLine());
StringTokenizer st = new StringTokenizer(in.readLine());
l... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | b98da720243ac49cef4d49b55de6baad | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | /**
* Created by IntelliJ IDEA.
* User: Taras_Brzezinsky
* Date: 8/7/11
* Time: 2:02 PM
* To change this template use File | Settings | File Templates.
*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.FileReader;
import java.util.StringTokenizer;
impo... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | cdc591a91fd16e613c6d4223e7763952 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
/**
* Date 30.11.2011
* Time 13:48:42
* Author Woodey
* $
*/
public class A103 {
private void Solution() throws IOException {
int n = nextInt();
long ans = n;
for (int i = 1; i <=... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | cd0dad426c286ead7cc56b1a4f1c9e9a | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner r = new Scanner(System.in);
int n = r.nextInt();
long[] a = new long[n];
for(int i = 0; i < n; i++)
a[i] = r.nextInt();
long res = a[0];
... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 05abe0666e6253d0729e524930025165 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.util.Scanner;
public class PlantingTest {
public static void main(String[]args){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
long[]array=new long[n];
for(int i=0;i<n;i++){
array[i]=sc.nextLong();
}
long count=0;
for(int j=0;j<n;j++){
count+=array[j];
}
for(int k=1;k<n;k... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | bd6581564d27377ecaf9b6b108ac71ed | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.util.Scanner;
public class Problem80B {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long[] a = new long[n];
for (int i = 0; i < n; i++) {
a[i] = sc.nextLong();
}
long max = 0;
for (int i = 0; i < n; i++) {
if(i==0) {
m... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 472717fc980c3b330e3088a9972135ce | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
void solve() throws IOException {
long n = nextLong();
long ans = 0;
for(long i = 0; i < n - 1; ++i)
ans += (i + 1) * (nextLong() - 1);
ans += n * nextLong();
out.println(ans);
}
void run() thr... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | fc182e9a73d4b0578194cccf25f847f6 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import static java.util.Arrays.*;
import static java.lang.Math.*;
import static java.math.BigInteger.*;
import java.util.*;
import java.math.*;
import java.io.*;
public class A implements Runnable
{
String file = "input";
boolean TEST = false;
void solve() throws IOException
{
int n =... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 1883eca3790fa45b2b15b53d22633004 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.util.ArrayList;
import java.util.List;
import java.util.InputMismatchException;
import java.math.BigInteger;
import java.util.Iterator;
import java.io.*;
import java.util.Comparator;
import java.util.Arrays;
import java.util.Collection;
/**
* Generated by Contest helper plug-in
* Actual solution is at th... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 34530482a8a9bbf3d9e5a2766e06f334 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.util.Scanner;
public class main {
static int dir;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long tiers = sc.nextLong();
long[] store = new long[(int) tiers];
for(long a=0;a<tiers;a++){
store[(int) a]=sc.nextInt();
... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 5b1e13cc7f6f3bb28215cedbcd1b4940 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static Scanner in; static int next() throws Exception {return in.nextInt();}
static PrintWriter out;
// static StreamTokenizer in;
public static void main(String[] args) throws Exception {
in = new Scanner(System.in);
out = new PrintWriter(System.out);
... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 0164601d6493e100f4614efe259f22a9 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.util.Scanner;
/**
* @author Alexander Grigoryev
* Created on 07.08.11
*/
public
class Main
{
static Scanner in = new Scanner(System.in);
public static
void main(String[] args)
{
long n = in.nextInt() + 1, ans = 0;
for(int i = 1; i < n; i++)
{
... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 8dd5f6b71fbae3a1d0e03e64549ca759 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.util.*;
import java.io.*;
public class a {
static long mod = 1000000007;
public static void main(String[] args) throws IOException
{
input.init(System.in);
PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
int n = input.nextInt();
int[] data = new int[n];
for(int i = 0; i<n... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 2b783b1c0ee15a3d0a4835669c71e700 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.util.*;
import java.math.*;
import java.io.*;
public class B {
private void solve() throws IOException {
int n = nextInt();
long[] a = new long[n];
long res = 0;
for (int i = 0; i < n; i++) {
a[i] = nextInt();
}
for (int i = 0; i < a.length; i... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 967214a9c562e7d2fedf4258f69b1bdf | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.util.Scanner;
public class A103 {
public static void main(String[] args) throws Exception {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
long sum = n;
for(int x = 0;x<n;x++) {
int k = in.nextInt();
sum+=(k-1L)*(x+1);
}
System.out.println(sum);
}
}
| Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | f7fedfcf2aca94ac86e6c72e35ad57c9 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
public class A {
BufferedReader in;
StringTokenizer str;
PrintWriter out;
String SK;
String next() throws IOException {
while ((str == null) || (!str.hasMoreTokens())) {
SK = in.readLine();
if (SK == null)
return null;
str = new StringTokenizer(S... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 48f61a7e93575f07bc453a7c5a4a0005 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;
public class A implements Runnable {
public void solve() throws IOException {
int n = in.nextInt();
long[] a = new long[n];
for ( int i = 0; i < n; i ++ ) {
a[i] = in.nextLong();
}
... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 5549aa3c8e267d40c95c95040dc8e831 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.util.Scanner;
public class Prob103A
{
public static void main( String[] Args )
{
Scanner scan = new Scanner( System.in );
int questions = scan.nextInt();
long ans = 0;
for ( long i = 1; i < questions; i++ )
ans += i * ( scan.nextLong() - 1 );
a... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | dac4621641e0f211555f359ec4292f2c | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.util.Scanner;
public class B_80 {
/**
* @param args
*/
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int n=in.nextInt();
long[] mas=new long[n];
for(int i=0;i<n;i++)
mas[i]=in.nextLong()... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | ccde271aa368d93361e4c7312e07ae3e | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.util.Scanner;
public class pr1 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
long n=sc.nextLong();
long x,ans=0;
for(int i=1;i<=n;i++){
x=sc.nextLong();
ans+=x+(i-1)*(x-1);
}
System.out.println(ans);
}} | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | b09143306cd0d14128282c9a6350504f | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.util.Scanner;
public class pp {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
long sum=0;
long op;
long[] opt=new long[n];
if(n==1){
op=sc.nextLong();
System.out.println(op);
return;
}
in... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 883dd70ef27df3e145b387e83e621c2c | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.*;
import java.util.*;
public class TestingPantsforSadness {
private void solve() throws IOException {
int n = nextInt();
long a[] = new long[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
long res = 0;
for (int i = 0; i < n; i++) {
res += (a[i] - 1) * (i + 1);
res++;
}
Syst... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 71c008ee181bd3ea6e614c410d3d893b | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class A implements Runnable {
void solve() {
int n = nextInt();
long ans = 0;
for (int i = 0; i < n; i++) {
long x = nextInt();
ans += (x - 1) * (i + 1) + 1;
}
out.println(ans);
}
FastScanner sc;
PrintWriter out;
public void run()... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | bf1be951362c6725bc8e6729d6ebaa8c | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.*;
import java.util.*;
public class A {
void solve() throws Exception {
int n = nextInt();
long[] a = new long[n];
long[] ans = new long[n + 1];
ans[0] = 0;
for (int i = 0; i < n; i++) {
a[i] = nextLong();
ans[i + 1] = ans[i] + (a[i] - 1L) * (1L + i) + 1L;
}
out.println(ans[n]);
}... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | ece55289fc362c970dab02c865040bd0 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.StringTokenizer;
public class A implements Runnable {
// leave empty to read from stdin/stdout
private static final String TASK_NAME_FOR_IO = "";
// file names
private static final String FILE_IN = TASK_NAME_FOR_IO + ".in";
private s... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 5b0437c6b8e646c0a20f174b972c8f31 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.util.Scanner;
public class Trying0 {
public static void main(String [] args){
Scanner sc = new Scanner (System.in);
long n = sc.nextLong();
long [] b = new long [(int) n];
long count = 0;
for (long a = 0; a < b.length; a++) {
b[(int) a] = sc.nextLong()... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 0cfdea8d21a4321586c61b968df8098f | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes |
import java.util.*;
public class A
{
public static void main(String[] args)
{
new A(new FastScanner());
}
public A(FastScanner in)
{
long res = 0;
int N = in.nextInt();
int[] vs = new int[N];
for (int i=0; i<N; i++)
vs[i] = in.nextInt();
for (int i=0; i... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | aae297e992b5f1abe8698d6d82c2309f | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class TestingPantsForSadness {
public static void main(String[] args) throws NumberFormatException,
IOException {
BufferedReader buff = new BufferedReader(new InputStreamReader(
... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 4e65ce96248188e01bc51a6daa294dd1 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes |
import java.math.BigInteger;
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
BigInteger res = new BigInteger(n + "");
int[] a = new int[n];
for (int i = 0; i < n; i++)
... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 95b15292374813b51efa9bc171a38df2 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.io.*;
public class A
{
public static void main(String [] args) throws IOException
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(in.readLine());
long [] answers = new long[n];
String [] input = in.readLine().split(" ");
for(int i... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 26f2dca41f3c9ba8208fb26438e00f9d | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes |
import java.util.Scanner;
public class B {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
long sum = 0;
for (int i = 0; i < n; i++) {
long temp = in.nextLong();
sum += (temp - 1) * i + temp;
}
System.out.println(sum);
}
}
| Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 11a746da3baf32fe4adf23b857ffd316 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
BigInteger res = BigInteger.ZERO;
for (int i = 1; i <= n; ++i)... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | fe838086d152adfcd79bd68b59a63f99 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | import java.util.*;
public class sadpants{
public static void main(String[] args){
Scanner br = new Scanner(System.in);
int n = br.nextInt();
long[] counts = new long[n];
long ans = 0;
for(int i = 0;i<n;i++){
counts[i] = br.nextLong();
}
for(int i = 0;i<n;i++){
if(counts[i] > 1){
for(int j = ... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | fe97fa25066c48700fc6aefd0020b380 | train_001.jsonl | 1312714800 | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to qu... | 256 megabytes | //package srms;
import java.util.Scanner;
/**
* Created by IntelliJ IDEA.
* User: Jarek
* Date: 26.08.11
* Time: 18:08
* To change this template use File | Settings | File Templates.
*/
public class Vaganych {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int ... | Java | ["2\n1 1", "2\n2 2", "1\n10"] | 2 seconds | ["2", "5", "10"] | NoteNote to the second sample. In the worst-case scenario you will need five clicks: the first click selects the first variant to the first question, this answer turns out to be wrong. the second click selects the second variant to the first question, it proves correct and we move on to the second question; the thi... | Java 6 | standard input | [
"implementation",
"greedy",
"math"
] | c8531b2ab93993b2c3467595ad0679c5 | The first line contains a positive integer n (1 ≤ n ≤ 100). It is the number of questions in the test. The second line contains space-separated n positive integers ai (1 ≤ ai ≤ 109), the number of answer variants to question i. | 1,100 | Print a single number — the minimal number of clicks needed to pass the test it the worst-case scenario. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. | standard output | |
PASSED | 6d56190a33caeb3a0773b02c0e9fa4ed | train_001.jsonl | 1371223800 | It has been noted that if some ants are put in the junctions of the graphene integer lattice then they will act in the following fashion: every minute at each junction (x, y) containing at least four ants a group of four ants will be formed, and these four ants will scatter to the neighbouring junctions (x + 1, y), (x ... | 256 megabytes | import java.io.IOException;
import java.io.InputStreamReader;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the to... | Java | ["1 3\n0 1\n0 0\n0 -1", "6 5\n0 -2\n0 -1\n0 0\n0 1\n0 2"] | 1 second | ["0\n1\n0", "0\n1\n2\n1\n0"] | NoteIn the first sample the colony consists of the one ant, so nothing happens at all.In the second sample the colony consists of 6 ants. At the first minute 4 ants scatter from (0, 0) to the neighbouring junctions. After that the process stops. | Java 7 | standard input | [
"dfs and similar"
] | e7a07efba27f2b1f9ec7c4a8fb997b00 | First input line contains integers n (0 ≤ n ≤ 30000) and t (1 ≤ t ≤ 50000), where n is the number of ants in the colony and t is the number of queries. Each of the next t lines contains coordinates of a query junction: integers xi, yi ( - 109 ≤ xi, yi ≤ 109). Queries may coincide. It is guaranteed that there will be a ... | 2,000 | Print t integers, one per line — the number of ants at the corresponding junctions when the movement of the ants stops. | standard output | |
PASSED | 47ceb3f1420979c35674edd69770f0d0 | train_001.jsonl | 1371223800 | It has been noted that if some ants are put in the junctions of the graphene integer lattice then they will act in the following fashion: every minute at each junction (x, y) containing at least four ants a group of four ants will be formed, and these four ants will scatter to the neighbouring junctions (x + 1, y), (x ... | 256 megabytes | import java.io.IOException;
import java.io.InputStreamReader;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the to... | Java | ["1 3\n0 1\n0 0\n0 -1", "6 5\n0 -2\n0 -1\n0 0\n0 1\n0 2"] | 1 second | ["0\n1\n0", "0\n1\n2\n1\n0"] | NoteIn the first sample the colony consists of the one ant, so nothing happens at all.In the second sample the colony consists of 6 ants. At the first minute 4 ants scatter from (0, 0) to the neighbouring junctions. After that the process stops. | Java 7 | standard input | [
"dfs and similar"
] | e7a07efba27f2b1f9ec7c4a8fb997b00 | First input line contains integers n (0 ≤ n ≤ 30000) and t (1 ≤ t ≤ 50000), where n is the number of ants in the colony and t is the number of queries. Each of the next t lines contains coordinates of a query junction: integers xi, yi ( - 109 ≤ xi, yi ≤ 109). Queries may coincide. It is guaranteed that there will be a ... | 2,000 | Print t integers, one per line — the number of ants at the corresponding junctions when the movement of the ants stops. | standard output | |
PASSED | c497d7cc2f8a6c66c5ad566018621036 | train_001.jsonl | 1371223800 | It has been noted that if some ants are put in the junctions of the graphene integer lattice then they will act in the following fashion: every minute at each junction (x, y) containing at least four ants a group of four ants will be formed, and these four ants will scatter to the neighbouring junctions (x + 1, y), (x ... | 256 megabytes | import java.io.IOException;
import java.io.InputStreamReader;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the to... | Java | ["1 3\n0 1\n0 0\n0 -1", "6 5\n0 -2\n0 -1\n0 0\n0 1\n0 2"] | 1 second | ["0\n1\n0", "0\n1\n2\n1\n0"] | NoteIn the first sample the colony consists of the one ant, so nothing happens at all.In the second sample the colony consists of 6 ants. At the first minute 4 ants scatter from (0, 0) to the neighbouring junctions. After that the process stops. | Java 7 | standard input | [
"dfs and similar"
] | e7a07efba27f2b1f9ec7c4a8fb997b00 | First input line contains integers n (0 ≤ n ≤ 30000) and t (1 ≤ t ≤ 50000), where n is the number of ants in the colony and t is the number of queries. Each of the next t lines contains coordinates of a query junction: integers xi, yi ( - 109 ≤ xi, yi ≤ 109). Queries may coincide. It is guaranteed that there will be a ... | 2,000 | Print t integers, one per line — the number of ants at the corresponding junctions when the movement of the ants stops. | standard output | |
PASSED | ba78f46f606064732b264a4e96d70d3b | train_001.jsonl | 1371223800 | It has been noted that if some ants are put in the junctions of the graphene integer lattice then they will act in the following fashion: every minute at each junction (x, y) containing at least four ants a group of four ants will be formed, and these four ants will scatter to the neighbouring junctions (x + 1, y), (x ... | 256 megabytes | import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Set;
import java.util.TreeSet;
... | Java | ["1 3\n0 1\n0 0\n0 -1", "6 5\n0 -2\n0 -1\n0 0\n0 1\n0 2"] | 1 second | ["0\n1\n0", "0\n1\n2\n1\n0"] | NoteIn the first sample the colony consists of the one ant, so nothing happens at all.In the second sample the colony consists of 6 ants. At the first minute 4 ants scatter from (0, 0) to the neighbouring junctions. After that the process stops. | Java 7 | standard input | [
"dfs and similar"
] | e7a07efba27f2b1f9ec7c4a8fb997b00 | First input line contains integers n (0 ≤ n ≤ 30000) and t (1 ≤ t ≤ 50000), where n is the number of ants in the colony and t is the number of queries. Each of the next t lines contains coordinates of a query junction: integers xi, yi ( - 109 ≤ xi, yi ≤ 109). Queries may coincide. It is guaranteed that there will be a ... | 2,000 | Print t integers, one per line — the number of ants at the corresponding junctions when the movement of the ants stops. | standard output | |
PASSED | 090554c83f2ed12ed0d4f8e5b2486108 | train_001.jsonl | 1561559700 | This problem is a version of problem D from the same contest with some additional constraints and tasks.There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 \le a_i \le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of c... | 256 megabytes | import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
public class G1183 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int Q = in.nextInt();
StringBuilder output = new String... | Java | ["3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1"] | 2 seconds | ["3 3\n3 3\n9 5"] | NoteIn the first query, you can include two candies of type $$$4$$$ and one candy of type $$$5$$$. All of them have $$$f_i = 1$$$ and you don't mind giving them away as part of the gift. | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | bcde53a1671a66eb16a37139380f4ae5 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. Then $$$n$$$ lines follow, each containing two integers $$$a_i$$$ and $$$f_i$$$ ($$$1 \le... | 2,000 | For each query print two integers: the maximum number of candies in a gift you can compose, according to the constraints in the statement; the maximum number of candies having $$$f_i = 1$$$ in a gift you can compose that contains the maximum possible number of candies. | standard output | |
PASSED | b194ef3a550e58728ecd8151ff7f0d9e | train_001.jsonl | 1561559700 | This problem is a version of problem D from the same contest with some additional constraints and tasks.There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 \le a_i \le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of c... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
PrintWriter out = new PrintWriter(outputStream);
InputReader in = new InputReader(inpu... | Java | ["3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1"] | 2 seconds | ["3 3\n3 3\n9 5"] | NoteIn the first query, you can include two candies of type $$$4$$$ and one candy of type $$$5$$$. All of them have $$$f_i = 1$$$ and you don't mind giving them away as part of the gift. | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | bcde53a1671a66eb16a37139380f4ae5 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. Then $$$n$$$ lines follow, each containing two integers $$$a_i$$$ and $$$f_i$$$ ($$$1 \le... | 2,000 | For each query print two integers: the maximum number of candies in a gift you can compose, according to the constraints in the statement; the maximum number of candies having $$$f_i = 1$$$ in a gift you can compose that contains the maximum possible number of candies. | standard output | |
PASSED | d9f29bdd921d87e5d5feeb363604c90f | train_001.jsonl | 1561559700 | This problem is a version of problem D from the same contest with some additional constraints and tasks.There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 \le a_i \le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of c... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
PrintWriter out = new PrintWriter(outputStream);
InputReader in = new InputReader(inpu... | Java | ["3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1"] | 2 seconds | ["3 3\n3 3\n9 5"] | NoteIn the first query, you can include two candies of type $$$4$$$ and one candy of type $$$5$$$. All of them have $$$f_i = 1$$$ and you don't mind giving them away as part of the gift. | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | bcde53a1671a66eb16a37139380f4ae5 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. Then $$$n$$$ lines follow, each containing two integers $$$a_i$$$ and $$$f_i$$$ ($$$1 \le... | 2,000 | For each query print two integers: the maximum number of candies in a gift you can compose, according to the constraints in the statement; the maximum number of candies having $$$f_i = 1$$$ in a gift you can compose that contains the maximum possible number of candies. | standard output | |
PASSED | cebd4b217e18673c9e8216994735bd5a | train_001.jsonl | 1561559700 | This problem is a version of problem D from the same contest with some additional constraints and tasks.There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 \le a_i \le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of c... | 256 megabytes | import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
public class q5 {
static boolean check(int a) {
String s=Integer.toString(a);
int sum=0;
for(int i=0;i<s.length();i++) {
sum+=(s.charAt(i)-'0');
}
return (sum%4==0);
}
public static void main(String[... | Java | ["3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1"] | 2 seconds | ["3 3\n3 3\n9 5"] | NoteIn the first query, you can include two candies of type $$$4$$$ and one candy of type $$$5$$$. All of them have $$$f_i = 1$$$ and you don't mind giving them away as part of the gift. | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | bcde53a1671a66eb16a37139380f4ae5 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. Then $$$n$$$ lines follow, each containing two integers $$$a_i$$$ and $$$f_i$$$ ($$$1 \le... | 2,000 | For each query print two integers: the maximum number of candies in a gift you can compose, according to the constraints in the statement; the maximum number of candies having $$$f_i = 1$$$ in a gift you can compose that contains the maximum possible number of candies. | standard output | |
PASSED | d58159712bad533ac2c2dc29e8850b4a | train_001.jsonl | 1561559700 | This problem is a version of problem D from the same contest with some additional constraints and tasks.There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 \le a_i \le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of c... | 256 megabytes | import java.io.*;
import java.util.*;
public class Task {
public static void main(String[] args) throws IOException {
new Task().go();
}
PrintWriter out;
Reader in;
BufferedReader br;
Task() throws IOException {
try {
//br = new BufferedReader( new FileReader("... | Java | ["3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1"] | 2 seconds | ["3 3\n3 3\n9 5"] | NoteIn the first query, you can include two candies of type $$$4$$$ and one candy of type $$$5$$$. All of them have $$$f_i = 1$$$ and you don't mind giving them away as part of the gift. | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | bcde53a1671a66eb16a37139380f4ae5 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. Then $$$n$$$ lines follow, each containing two integers $$$a_i$$$ and $$$f_i$$$ ($$$1 \le... | 2,000 | For each query print two integers: the maximum number of candies in a gift you can compose, according to the constraints in the statement; the maximum number of candies having $$$f_i = 1$$$ in a gift you can compose that contains the maximum possible number of candies. | standard output | |
PASSED | c47c247e297bcfd3badd90816e41a597 | train_001.jsonl | 1561559700 | This problem is a version of problem D from the same contest with some additional constraints and tasks.There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 \le a_i \le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of c... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main implements Runnable {
public static void main (String[] args) {new Thread(null, new Main(), "_cf", 1 << 28).start();}
public void run() {
FastScanner fs = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
System.err.println("");
int q ... | Java | ["3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1"] | 2 seconds | ["3 3\n3 3\n9 5"] | NoteIn the first query, you can include two candies of type $$$4$$$ and one candy of type $$$5$$$. All of them have $$$f_i = 1$$$ and you don't mind giving them away as part of the gift. | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | bcde53a1671a66eb16a37139380f4ae5 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. Then $$$n$$$ lines follow, each containing two integers $$$a_i$$$ and $$$f_i$$$ ($$$1 \le... | 2,000 | For each query print two integers: the maximum number of candies in a gift you can compose, according to the constraints in the statement; the maximum number of candies having $$$f_i = 1$$$ in a gift you can compose that contains the maximum possible number of candies. | standard output | |
PASSED | 71548e52a8665636bc1acae66d6d811b | train_001.jsonl | 1561559700 | This problem is a version of problem D from the same contest with some additional constraints and tasks.There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 \le a_i \le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of c... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static class Scanner
{
BufferedReader buf;
StringTokenizer tok;
Scanner()
{
buf = new BufferedReader(new InputStreamReader(System.in));
}
boolean hasNext()
{
while(tok == null || !tok.hasMoreElemen... | Java | ["3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1"] | 2 seconds | ["3 3\n3 3\n9 5"] | NoteIn the first query, you can include two candies of type $$$4$$$ and one candy of type $$$5$$$. All of them have $$$f_i = 1$$$ and you don't mind giving them away as part of the gift. | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | bcde53a1671a66eb16a37139380f4ae5 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. Then $$$n$$$ lines follow, each containing two integers $$$a_i$$$ and $$$f_i$$$ ($$$1 \le... | 2,000 | For each query print two integers: the maximum number of candies in a gift you can compose, according to the constraints in the statement; the maximum number of candies having $$$f_i = 1$$$ in a gift you can compose that contains the maximum possible number of candies. | standard output | |
PASSED | 028e627ddc816ed06fa251f61ad29ccc | train_001.jsonl | 1561559700 | This problem is a version of problem D from the same contest with some additional constraints and tasks.There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 \le a_i \le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of c... | 256 megabytes | import java.io.*;
import java.util.*;
public class Codeforces1183 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(
new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int q = Intege... | Java | ["3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1"] | 2 seconds | ["3 3\n3 3\n9 5"] | NoteIn the first query, you can include two candies of type $$$4$$$ and one candy of type $$$5$$$. All of them have $$$f_i = 1$$$ and you don't mind giving them away as part of the gift. | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | bcde53a1671a66eb16a37139380f4ae5 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. Then $$$n$$$ lines follow, each containing two integers $$$a_i$$$ and $$$f_i$$$ ($$$1 \le... | 2,000 | For each query print two integers: the maximum number of candies in a gift you can compose, according to the constraints in the statement; the maximum number of candies having $$$f_i = 1$$$ in a gift you can compose that contains the maximum possible number of candies. | standard output | |
PASSED | 5b6d936117a42c66de963abaaff4b41a | train_001.jsonl | 1561559700 | This problem is a version of problem D from the same contest with some additional constraints and tasks.There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 \le a_i \le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of c... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.AbstractCollection;
import java.util.PriorityQueue;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Comparator;
import java.uti... | Java | ["3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1"] | 2 seconds | ["3 3\n3 3\n9 5"] | NoteIn the first query, you can include two candies of type $$$4$$$ and one candy of type $$$5$$$. All of them have $$$f_i = 1$$$ and you don't mind giving them away as part of the gift. | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | bcde53a1671a66eb16a37139380f4ae5 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. Then $$$n$$$ lines follow, each containing two integers $$$a_i$$$ and $$$f_i$$$ ($$$1 \le... | 2,000 | For each query print two integers: the maximum number of candies in a gift you can compose, according to the constraints in the statement; the maximum number of candies having $$$f_i = 1$$$ in a gift you can compose that contains the maximum possible number of candies. | standard output | |
PASSED | 3a4f796a9fb9f5f8d5d831ba4c57f0c5 | train_001.jsonl | 1561559700 | This problem is a version of problem D from the same contest with some additional constraints and tasks.There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 \le a_i \le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of c... | 256 megabytes | // Working program using Reader Class
import java.io.*;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;
public class Main
{
static class Reader
{
final private int BUFFER_SIZE = 1 << 16;
private DataInputStre... | Java | ["3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1"] | 2 seconds | ["3 3\n3 3\n9 5"] | NoteIn the first query, you can include two candies of type $$$4$$$ and one candy of type $$$5$$$. All of them have $$$f_i = 1$$$ and you don't mind giving them away as part of the gift. | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | bcde53a1671a66eb16a37139380f4ae5 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. Then $$$n$$$ lines follow, each containing two integers $$$a_i$$$ and $$$f_i$$$ ($$$1 \le... | 2,000 | For each query print two integers: the maximum number of candies in a gift you can compose, according to the constraints in the statement; the maximum number of candies having $$$f_i = 1$$$ in a gift you can compose that contains the maximum possible number of candies. | standard output | |
PASSED | cd9b0ae3a0d35ffded77745159cf17cf | train_001.jsonl | 1561559700 | This problem is a version of problem D from the same contest with some additional constraints and tasks.There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 \le a_i \le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of c... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.io.Writer;
impo... | Java | ["3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1"] | 2 seconds | ["3 3\n3 3\n9 5"] | NoteIn the first query, you can include two candies of type $$$4$$$ and one candy of type $$$5$$$. All of them have $$$f_i = 1$$$ and you don't mind giving them away as part of the gift. | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | bcde53a1671a66eb16a37139380f4ae5 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. Then $$$n$$$ lines follow, each containing two integers $$$a_i$$$ and $$$f_i$$$ ($$$1 \le... | 2,000 | For each query print two integers: the maximum number of candies in a gift you can compose, according to the constraints in the statement; the maximum number of candies having $$$f_i = 1$$$ in a gift you can compose that contains the maximum possible number of candies. | standard output | |
PASSED | 9df2e6293a5d37049282f176a0ef16e2 | train_001.jsonl | 1561559700 | This problem is a version of problem D from the same contest with some additional constraints and tasks.There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 \le a_i \le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of c... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.PriorityQueue;
import java.io.BufferedWriter;
import java.util.Collection;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.... | Java | ["3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1"] | 2 seconds | ["3 3\n3 3\n9 5"] | NoteIn the first query, you can include two candies of type $$$4$$$ and one candy of type $$$5$$$. All of them have $$$f_i = 1$$$ and you don't mind giving them away as part of the gift. | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | bcde53a1671a66eb16a37139380f4ae5 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. Then $$$n$$$ lines follow, each containing two integers $$$a_i$$$ and $$$f_i$$$ ($$$1 \le... | 2,000 | For each query print two integers: the maximum number of candies in a gift you can compose, according to the constraints in the statement; the maximum number of candies having $$$f_i = 1$$$ in a gift you can compose that contains the maximum possible number of candies. | standard output | |
PASSED | 2bda9f46ce4c17ad1de6bdaea983869c | train_001.jsonl | 1561559700 | This problem is a version of problem D from the same contest with some additional constraints and tasks.There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 \le a_i \le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of c... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.PriorityQueue;
import java.io.BufferedWriter;
import java.util.Collection;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.io.IOEx... | Java | ["3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1"] | 2 seconds | ["3 3\n3 3\n9 5"] | NoteIn the first query, you can include two candies of type $$$4$$$ and one candy of type $$$5$$$. All of them have $$$f_i = 1$$$ and you don't mind giving them away as part of the gift. | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | bcde53a1671a66eb16a37139380f4ae5 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. Then $$$n$$$ lines follow, each containing two integers $$$a_i$$$ and $$$f_i$$$ ($$$1 \le... | 2,000 | For each query print two integers: the maximum number of candies in a gift you can compose, according to the constraints in the statement; the maximum number of candies having $$$f_i = 1$$$ in a gift you can compose that contains the maximum possible number of candies. | standard output | |
PASSED | 1eb6187c3a61a16c9b5b776c42f0d1df | train_001.jsonl | 1561559700 | This problem is a version of problem D from the same contest with some additional constraints and tasks.There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 \le a_i \le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of c... | 256 megabytes |
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws Exception {
IO io ;
try {
io = new IO("in.in", null);
} catch (IOException e) {
io = new IO(null, null);
}
int T = io.getNextInt();
Arr... | Java | ["3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1"] | 2 seconds | ["3 3\n3 3\n9 5"] | NoteIn the first query, you can include two candies of type $$$4$$$ and one candy of type $$$5$$$. All of them have $$$f_i = 1$$$ and you don't mind giving them away as part of the gift. | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | bcde53a1671a66eb16a37139380f4ae5 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. Then $$$n$$$ lines follow, each containing two integers $$$a_i$$$ and $$$f_i$$$ ($$$1 \le... | 2,000 | For each query print two integers: the maximum number of candies in a gift you can compose, according to the constraints in the statement; the maximum number of candies having $$$f_i = 1$$$ in a gift you can compose that contains the maximum possible number of candies. | standard output | |
PASSED | c3968518c511d8cf2790c312e5dea2d6 | train_001.jsonl | 1561559700 | This problem is a version of problem D from the same contest with some additional constraints and tasks.There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 \le a_i \le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of c... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
PrintWriter out = new PrintWriter(System.out);
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer tok = new StringTokenizer("");
String next() throws IOException {
if (!tok.hasMoreToke... | Java | ["3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1"] | 2 seconds | ["3 3\n3 3\n9 5"] | NoteIn the first query, you can include two candies of type $$$4$$$ and one candy of type $$$5$$$. All of them have $$$f_i = 1$$$ and you don't mind giving them away as part of the gift. | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | bcde53a1671a66eb16a37139380f4ae5 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. Then $$$n$$$ lines follow, each containing two integers $$$a_i$$$ and $$$f_i$$$ ($$$1 \le... | 2,000 | For each query print two integers: the maximum number of candies in a gift you can compose, according to the constraints in the statement; the maximum number of candies having $$$f_i = 1$$$ in a gift you can compose that contains the maximum possible number of candies. | standard output | |
PASSED | 37ad27b740b80009833923d923c51141 | train_001.jsonl | 1561559700 | This problem is a version of problem D from the same contest with some additional constraints and tasks.There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 \le a_i \le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of c... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Comparator;
import java.util.Collections;
import java.io.InputSt... | Java | ["3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1"] | 2 seconds | ["3 3\n3 3\n9 5"] | NoteIn the first query, you can include two candies of type $$$4$$$ and one candy of type $$$5$$$. All of them have $$$f_i = 1$$$ and you don't mind giving them away as part of the gift. | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | bcde53a1671a66eb16a37139380f4ae5 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. Then $$$n$$$ lines follow, each containing two integers $$$a_i$$$ and $$$f_i$$$ ($$$1 \le... | 2,000 | For each query print two integers: the maximum number of candies in a gift you can compose, according to the constraints in the statement; the maximum number of candies having $$$f_i = 1$$$ in a gift you can compose that contains the maximum possible number of candies. | standard output | |
PASSED | 74920f4f7f9fc3a1ebf5f320a661486d | train_001.jsonl | 1561559700 | This problem is a version of problem D from the same contest with some additional constraints and tasks.There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 \le a_i \le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of c... | 256 megabytes | import java.io.*;
import java.util.*;
public class G_CandyBox {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader inp = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
... | Java | ["3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1"] | 2 seconds | ["3 3\n3 3\n9 5"] | NoteIn the first query, you can include two candies of type $$$4$$$ and one candy of type $$$5$$$. All of them have $$$f_i = 1$$$ and you don't mind giving them away as part of the gift. | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | bcde53a1671a66eb16a37139380f4ae5 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. Then $$$n$$$ lines follow, each containing two integers $$$a_i$$$ and $$$f_i$$$ ($$$1 \le... | 2,000 | For each query print two integers: the maximum number of candies in a gift you can compose, according to the constraints in the statement; the maximum number of candies having $$$f_i = 1$$$ in a gift you can compose that contains the maximum possible number of candies. | standard output | |
PASSED | 8d8569e202a7ab2c57141c94c1f9b7fb | train_001.jsonl | 1561559700 | This problem is a version of problem D from the same contest with some additional constraints and tasks.There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 \le a_i \le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of c... | 256 megabytes |
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.*;
public class Main
{
Main() throws IOException
{
Reader s = new Reader();
int q = s.nextInt();
for (int i = 0; i < q; i++)
{
int n = s.nextInt();
... | Java | ["3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1"] | 2 seconds | ["3 3\n3 3\n9 5"] | NoteIn the first query, you can include two candies of type $$$4$$$ and one candy of type $$$5$$$. All of them have $$$f_i = 1$$$ and you don't mind giving them away as part of the gift. | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | bcde53a1671a66eb16a37139380f4ae5 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. Then $$$n$$$ lines follow, each containing two integers $$$a_i$$$ and $$$f_i$$$ ($$$1 \le... | 2,000 | For each query print two integers: the maximum number of candies in a gift you can compose, according to the constraints in the statement; the maximum number of candies having $$$f_i = 1$$$ in a gift you can compose that contains the maximum possible number of candies. | standard output | |
PASSED | 526f9cd5a80b82f6fb59b6c5c895561d | train_001.jsonl | 1561559700 | This problem is a version of problem D from the same contest with some additional constraints and tasks.There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 \le a_i \le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of c... | 256 megabytes | import java.io.*;
import java.util.*;
public class ProblemG {
public static InputStream inputStream = System.in;
public static OutputStream outputStream = System.out;
public static void main(String[] args) {
MyScanner scanner = new MyScanner(inputStream);
PrintWriter out = new PrintWrite... | Java | ["3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1"] | 2 seconds | ["3 3\n3 3\n9 5"] | NoteIn the first query, you can include two candies of type $$$4$$$ and one candy of type $$$5$$$. All of them have $$$f_i = 1$$$ and you don't mind giving them away as part of the gift. | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | bcde53a1671a66eb16a37139380f4ae5 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. Then $$$n$$$ lines follow, each containing two integers $$$a_i$$$ and $$$f_i$$$ ($$$1 \le... | 2,000 | For each query print two integers: the maximum number of candies in a gift you can compose, according to the constraints in the statement; the maximum number of candies having $$$f_i = 1$$$ in a gift you can compose that contains the maximum possible number of candies. | standard output | |
PASSED | 6a276f576d1f697c0d96ceec4e5711d8 | train_001.jsonl | 1561559700 | This problem is a version of problem D from the same contest with some additional constraints and tasks.There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 \le a_i \le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of c... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class practice2 {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.... | Java | ["3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1"] | 2 seconds | ["3 3\n3 3\n9 5"] | NoteIn the first query, you can include two candies of type $$$4$$$ and one candy of type $$$5$$$. All of them have $$$f_i = 1$$$ and you don't mind giving them away as part of the gift. | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | bcde53a1671a66eb16a37139380f4ae5 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. Then $$$n$$$ lines follow, each containing two integers $$$a_i$$$ and $$$f_i$$$ ($$$1 \le... | 2,000 | For each query print two integers: the maximum number of candies in a gift you can compose, according to the constraints in the statement; the maximum number of candies having $$$f_i = 1$$$ in a gift you can compose that contains the maximum possible number of candies. | standard output | |
PASSED | ce1d383715eb2145e7dc3eb33985abea | train_001.jsonl | 1561559700 | This problem is a version of problem D from the same contest with some additional constraints and tasks.There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 \le a_i \le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of c... | 256 megabytes | import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.List;
import java.util.Map;
impor... | Java | ["3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1"] | 2 seconds | ["3 3\n3 3\n9 5"] | NoteIn the first query, you can include two candies of type $$$4$$$ and one candy of type $$$5$$$. All of them have $$$f_i = 1$$$ and you don't mind giving them away as part of the gift. | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | bcde53a1671a66eb16a37139380f4ae5 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. Then $$$n$$$ lines follow, each containing two integers $$$a_i$$$ and $$$f_i$$$ ($$$1 \le... | 2,000 | For each query print two integers: the maximum number of candies in a gift you can compose, according to the constraints in the statement; the maximum number of candies having $$$f_i = 1$$$ in a gift you can compose that contains the maximum possible number of candies. | standard output | |
PASSED | 4f24618931ec0dfe933d8028d3e816c5 | train_001.jsonl | 1561559700 | This problem is a version of problem D from the same contest with some additional constraints and tasks.There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 \le a_i \le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of c... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String args[]) {new Main().run();}
FastReader in = new FastReader();
PrintWriter out = new PrintWriter(System.out);
void run(){
int q=in.nextInt();
for(int i=0;i<q;i++) {
work();
}
out.flush();
}
long mod=1000000007;
l... | Java | ["3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1"] | 2 seconds | ["3 3\n3 3\n9 5"] | NoteIn the first query, you can include two candies of type $$$4$$$ and one candy of type $$$5$$$. All of them have $$$f_i = 1$$$ and you don't mind giving them away as part of the gift. | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | bcde53a1671a66eb16a37139380f4ae5 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. Then $$$n$$$ lines follow, each containing two integers $$$a_i$$$ and $$$f_i$$$ ($$$1 \le... | 2,000 | For each query print two integers: the maximum number of candies in a gift you can compose, according to the constraints in the statement; the maximum number of candies having $$$f_i = 1$$$ in a gift you can compose that contains the maximum possible number of candies. | standard output | |
PASSED | dbd6c8979d44f4a9ac1b3e368499ae8a | train_001.jsonl | 1561559700 | This problem is a version of problem D from the same contest with some additional constraints and tasks.There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 \le a_i \le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of c... | 256 megabytes | import java.io.*;
import java.text.*;
import java.util.*;
import java.math.*;
public class template {
public static void main(String[] args) throws Exception {
new template().run();
}
public void run() throws Exception {
FastScanner f = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
int as... | Java | ["3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1"] | 2 seconds | ["3 3\n3 3\n9 5"] | NoteIn the first query, you can include two candies of type $$$4$$$ and one candy of type $$$5$$$. All of them have $$$f_i = 1$$$ and you don't mind giving them away as part of the gift. | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | bcde53a1671a66eb16a37139380f4ae5 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. Then $$$n$$$ lines follow, each containing two integers $$$a_i$$$ and $$$f_i$$$ ($$$1 \le... | 2,000 | For each query print two integers: the maximum number of candies in a gift you can compose, according to the constraints in the statement; the maximum number of candies having $$$f_i = 1$$$ in a gift you can compose that contains the maximum possible number of candies. | standard output | |
PASSED | 542442785b6f15101e13b261743f0f35 | train_001.jsonl | 1561559700 | This problem is a version of problem D from the same contest with some additional constraints and tasks.There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 \le a_i \le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of c... | 256 megabytes | import java.util.*;
import java.io.*;
public class R1183G {
FastScanner in;
PrintWriter out;
void solve() {
int q=in.nextInt();
while (q-->0) {
int n=in.nextInt();
Pair[] a=new Pair[n+1];
for(int i=1; i<=n; i++)
a[i]=new Pair(0,0);
... | Java | ["3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1"] | 2 seconds | ["3 3\n3 3\n9 5"] | NoteIn the first query, you can include two candies of type $$$4$$$ and one candy of type $$$5$$$. All of them have $$$f_i = 1$$$ and you don't mind giving them away as part of the gift. | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | bcde53a1671a66eb16a37139380f4ae5 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. Then $$$n$$$ lines follow, each containing two integers $$$a_i$$$ and $$$f_i$$$ ($$$1 \le... | 2,000 | For each query print two integers: the maximum number of candies in a gift you can compose, according to the constraints in the statement; the maximum number of candies having $$$f_i = 1$$$ in a gift you can compose that contains the maximum possible number of candies. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.