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 | 52e6511b737931c9d96d422f7d39e297 | train_002.jsonl | 1328886000 | Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga... | 256 megabytes | import java.io.IOException;
import java.util.Arrays;
import java.util.InputMismatchException;
/**
* Created by jizhe on 2016/1/21.
*/
public class DivisionIntoTeams {
public static class FasterScanner {
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
... | Java | ["3\n1 2 1", "5\n2 3 3 1 1"] | 1 second | ["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"] | NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2β-β1|β=β1ββ€β1) is fulfilled... | Java 8 | standard input | [
"sortings",
"greedy",
"math"
] | 0937a7e2f912fc094cc4275fd47cd457 | The first line contains the only integer n (2ββ€βnββ€β105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1ββ€βaiββ€β104), the i-th number represents the i-th boy's playing skills. | 1,500 | On the first line print an integer x β the number of boys playing for the first team. On the second line print x integers β the individual numbers of boys playing for the first team. On the third line print an integer y β the number of boys playing for the second team, on the fourth line print y integers β the individu... | standard output | |
PASSED | 9c8225a09b6f177f6021f5b1b8eac507 | train_002.jsonl | 1328886000 | Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga... | 256 megabytes | import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
public class Main {
private static class Pair {
int val;
int idx;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in)... | Java | ["3\n1 2 1", "5\n2 3 3 1 1"] | 1 second | ["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"] | NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2β-β1|β=β1ββ€β1) is fulfilled... | Java 8 | standard input | [
"sortings",
"greedy",
"math"
] | 0937a7e2f912fc094cc4275fd47cd457 | The first line contains the only integer n (2ββ€βnββ€β105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1ββ€βaiββ€β104), the i-th number represents the i-th boy's playing skills. | 1,500 | On the first line print an integer x β the number of boys playing for the first team. On the second line print x integers β the individual numbers of boys playing for the first team. On the third line print an integer y β the number of boys playing for the second team, on the fourth line print y integers β the individu... | standard output | |
PASSED | c252661e5617445d8e34c2db0da5ebfa | train_002.jsonl | 1328886000 | Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga... | 256 megabytes | //package CF;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.nio.channels.ShutdownChannelGroupException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Has... | Java | ["3\n1 2 1", "5\n2 3 3 1 1"] | 1 second | ["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"] | NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2β-β1|β=β1ββ€β1) is fulfilled... | Java 8 | standard input | [
"sortings",
"greedy",
"math"
] | 0937a7e2f912fc094cc4275fd47cd457 | The first line contains the only integer n (2ββ€βnββ€β105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1ββ€βaiββ€β104), the i-th number represents the i-th boy's playing skills. | 1,500 | On the first line print an integer x β the number of boys playing for the first team. On the second line print x integers β the individual numbers of boys playing for the first team. On the third line print an integer y β the number of boys playing for the second team, on the fourth line print y integers β the individu... | standard output | |
PASSED | b926935de4124af10d510464abcbd1db | train_002.jsonl | 1328886000 | Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class JavaApplication7
{
static String fixedLengthString(String string, int length) {
return String.format("%1$"+length+ "s", string);
}
static boolean cas(char c)
{
char ar [] = {'A', 'E', 'I', 'O', 'U','Y'} ;
for(int i = 0 ; i < ar.l... | Java | ["3\n1 2 1", "5\n2 3 3 1 1"] | 1 second | ["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"] | NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2β-β1|β=β1ββ€β1) is fulfilled... | Java 8 | standard input | [
"sortings",
"greedy",
"math"
] | 0937a7e2f912fc094cc4275fd47cd457 | The first line contains the only integer n (2ββ€βnββ€β105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1ββ€βaiββ€β104), the i-th number represents the i-th boy's playing skills. | 1,500 | On the first line print an integer x β the number of boys playing for the first team. On the second line print x integers β the individual numbers of boys playing for the first team. On the third line print an integer y β the number of boys playing for the second team, on the fourth line print y integers β the individu... | standard output | |
PASSED | 800f79d61b35cf19eb81eabd906b0aa8 | train_002.jsonl | 1328886000 | Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Double.parseDouble;
import static java.lang.String.*;
public class Main {
public static void main(String[] args) t... | Java | ["3\n1 2 1", "5\n2 3 3 1 1"] | 1 second | ["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"] | NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2β-β1|β=β1ββ€β1) is fulfilled... | Java 8 | standard input | [
"sortings",
"greedy",
"math"
] | 0937a7e2f912fc094cc4275fd47cd457 | The first line contains the only integer n (2ββ€βnββ€β105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1ββ€βaiββ€β104), the i-th number represents the i-th boy's playing skills. | 1,500 | On the first line print an integer x β the number of boys playing for the first team. On the second line print x integers β the individual numbers of boys playing for the first team. On the third line print an integer y β the number of boys playing for the second team, on the fourth line print y integers β the individu... | standard output | |
PASSED | 2808ccda4178fea60554f8135e7d9080 | train_002.jsonl | 1328886000 | Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
int INF = (int)1e9;
int MOD = 1000000007;
void solve(InputReader in, PrintWriter out) throws IOException {
int n = in.nextInt();
int[][] a = new int[n][2];
for(int i=0; i<n; i++) {
a[i][0] = in.nextInt();
... | Java | ["3\n1 2 1", "5\n2 3 3 1 1"] | 1 second | ["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"] | NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2β-β1|β=β1ββ€β1) is fulfilled... | Java 8 | standard input | [
"sortings",
"greedy",
"math"
] | 0937a7e2f912fc094cc4275fd47cd457 | The first line contains the only integer n (2ββ€βnββ€β105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1ββ€βaiββ€β104), the i-th number represents the i-th boy's playing skills. | 1,500 | On the first line print an integer x β the number of boys playing for the first team. On the second line print x integers β the individual numbers of boys playing for the first team. On the third line print an integer y β the number of boys playing for the second team, on the fourth line print y integers β the individu... | standard output | |
PASSED | 7628051a1994666f1fdd04610f96fe20 | train_002.jsonl | 1328886000 | Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga... | 256 megabytes | import java.util.*;
import java.io.*;
public class Solution {
static class FastScanner implements Closeable {
BufferedReader in;
StringTokenizer st;
FastScanner() throws IOException {
in = new BufferedReader(new InputStreamReader(System.in));
}
String next() throws IOException {
... | Java | ["3\n1 2 1", "5\n2 3 3 1 1"] | 1 second | ["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"] | NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2β-β1|β=β1ββ€β1) is fulfilled... | Java 8 | standard input | [
"sortings",
"greedy",
"math"
] | 0937a7e2f912fc094cc4275fd47cd457 | The first line contains the only integer n (2ββ€βnββ€β105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1ββ€βaiββ€β104), the i-th number represents the i-th boy's playing skills. | 1,500 | On the first line print an integer x β the number of boys playing for the first team. On the second line print x integers β the individual numbers of boys playing for the first team. On the third line print an integer y β the number of boys playing for the second team, on the fourth line print y integers β the individu... | standard output | |
PASSED | d0479328731ded53860c802c5e3ecfc3 | train_002.jsonl | 1605623700 | You are given an undirected graph with $$$n$$$ vertices and $$$m$$$ edges. Also, you are given an integer $$$k$$$.Find either a clique of size $$$k$$$ or a non-empty subset of vertices such that each vertex of this subset has at least $$$k$$$ neighbors in the subset. If there are no such cliques and subsets report abou... | 256 megabytes | import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import java.util.*;
import java.io.*;
import java.math.*;
public class x1439B
{
static HashSet<Integer>[] edges;
public static void main(String hi[]) throws Exception
{
FastScanner inf... | Java | ["3\n5 9 4\n1 2\n1 3\n1 4\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n10 15 3\n1 2\n2 3\n3 4\n4 5\n5 1\n1 7\n2 8\n3 9\n4 10\n5 6\n7 10\n10 8\n8 6\n6 9\n9 7\n4 5 4\n1 2\n2 3\n3 4\n4 1\n1 3"] | 1 second | ["2\n4 1 2 3 \n1 10\n1 2 3 4 5 6 7 8 9 10 \n-1"] | NoteIn the first test case: the subset $$$\{1, 2, 3, 4\}$$$ is a clique of size $$$4$$$.In the second test case: degree of each vertex in the original graph is at least $$$3$$$. So the set of all vertices is a correct answer.In the third test case: there are no cliques of size $$$4$$$ or required subsets, so the answer... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"graphs"
] | 6b2dfd5501f81bb3c5f11ca11e4c5520 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^5$$$)Β β the number of test cases. The next lines contain descriptions of test cases. The first line of the description of each test case contains three integers $$$n$$$, $$$m$$$, $$$k$$$ ($$$1 \leq n, m, k \leq 10^5$$$, $$$k \leq n$$$). Each of the n... | 2,600 | For each test case: If you found a subset of vertices such that each vertex of this subset has at least $$$k$$$ neighbors in the subset in the first line output $$$1$$$ and the size of the subset. On the second line output the vertices of the subset in any order. If you found a clique of size $$$k$$$ then in the first... | standard output | |
PASSED | e80b176d90cfa4becd50a5380e23eccd | train_002.jsonl | 1605623700 | You are given an undirected graph with $$$n$$$ vertices and $$$m$$$ edges. Also, you are given an integer $$$k$$$.Find either a clique of size $$$k$$$ or a non-empty subset of vertices such that each vertex of this subset has at least $$$k$$$ neighbors in the subset. If there are no such cliques and subsets report abou... | 256 megabytes | // No sorcery shall prevail. //
import java.util.*;
import java.io.*;
public class _InVoker_ {
//Variables
static long mod2 = 1000000007;
static long mod = 998244353;
static FastReader inp= new FastReader();
static PrintWriter out= new PrintWriter(System.out);
public static void main(String args[]) { ... | Java | ["3\n5 9 4\n1 2\n1 3\n1 4\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n10 15 3\n1 2\n2 3\n3 4\n4 5\n5 1\n1 7\n2 8\n3 9\n4 10\n5 6\n7 10\n10 8\n8 6\n6 9\n9 7\n4 5 4\n1 2\n2 3\n3 4\n4 1\n1 3"] | 1 second | ["2\n4 1 2 3 \n1 10\n1 2 3 4 5 6 7 8 9 10 \n-1"] | NoteIn the first test case: the subset $$$\{1, 2, 3, 4\}$$$ is a clique of size $$$4$$$.In the second test case: degree of each vertex in the original graph is at least $$$3$$$. So the set of all vertices is a correct answer.In the third test case: there are no cliques of size $$$4$$$ or required subsets, so the answer... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"graphs"
] | 6b2dfd5501f81bb3c5f11ca11e4c5520 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^5$$$)Β β the number of test cases. The next lines contain descriptions of test cases. The first line of the description of each test case contains three integers $$$n$$$, $$$m$$$, $$$k$$$ ($$$1 \leq n, m, k \leq 10^5$$$, $$$k \leq n$$$). Each of the n... | 2,600 | For each test case: If you found a subset of vertices such that each vertex of this subset has at least $$$k$$$ neighbors in the subset in the first line output $$$1$$$ and the size of the subset. On the second line output the vertices of the subset in any order. If you found a clique of size $$$k$$$ then in the first... | standard output | |
PASSED | f409fb3a77412c2f750cf5bc004537c3 | train_002.jsonl | 1605623700 | You are given an undirected graph with $$$n$$$ vertices and $$$m$$$ edges. Also, you are given an integer $$$k$$$.Find either a clique of size $$$k$$$ or a non-empty subset of vertices such that each vertex of this subset has at least $$$k$$$ neighbors in the subset. If there are no such cliques and subsets report abou... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.stream.IntStream;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Random;
import java.io.OutputStreamWriter;
import java.util.NoSuchElementException;
import java.io.OutputStream;
impo... | Java | ["3\n5 9 4\n1 2\n1 3\n1 4\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n10 15 3\n1 2\n2 3\n3 4\n4 5\n5 1\n1 7\n2 8\n3 9\n4 10\n5 6\n7 10\n10 8\n8 6\n6 9\n9 7\n4 5 4\n1 2\n2 3\n3 4\n4 1\n1 3"] | 1 second | ["2\n4 1 2 3 \n1 10\n1 2 3 4 5 6 7 8 9 10 \n-1"] | NoteIn the first test case: the subset $$$\{1, 2, 3, 4\}$$$ is a clique of size $$$4$$$.In the second test case: degree of each vertex in the original graph is at least $$$3$$$. So the set of all vertices is a correct answer.In the third test case: there are no cliques of size $$$4$$$ or required subsets, so the answer... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"graphs"
] | 6b2dfd5501f81bb3c5f11ca11e4c5520 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^5$$$)Β β the number of test cases. The next lines contain descriptions of test cases. The first line of the description of each test case contains three integers $$$n$$$, $$$m$$$, $$$k$$$ ($$$1 \leq n, m, k \leq 10^5$$$, $$$k \leq n$$$). Each of the n... | 2,600 | For each test case: If you found a subset of vertices such that each vertex of this subset has at least $$$k$$$ neighbors in the subset in the first line output $$$1$$$ and the size of the subset. On the second line output the vertices of the subset in any order. If you found a clique of size $$$k$$$ then in the first... | standard output | |
PASSED | ce5daa788cb0daa819637ccaec7f1095 | train_002.jsonl | 1605623700 | You are given an undirected graph with $$$n$$$ vertices and $$$m$$$ edges. Also, you are given an integer $$$k$$$.Find either a clique of size $$$k$$$ or a non-empty subset of vertices such that each vertex of this subset has at least $$$k$$$ neighbors in the subset. If there are no such cliques and subsets report abou... | 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.stream.IntStream;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.Collection;
import java.util.InputMismatchException;
import java.io.IO... | Java | ["3\n5 9 4\n1 2\n1 3\n1 4\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n10 15 3\n1 2\n2 3\n3 4\n4 5\n5 1\n1 7\n2 8\n3 9\n4 10\n5 6\n7 10\n10 8\n8 6\n6 9\n9 7\n4 5 4\n1 2\n2 3\n3 4\n4 1\n1 3"] | 1 second | ["2\n4 1 2 3 \n1 10\n1 2 3 4 5 6 7 8 9 10 \n-1"] | NoteIn the first test case: the subset $$$\{1, 2, 3, 4\}$$$ is a clique of size $$$4$$$.In the second test case: degree of each vertex in the original graph is at least $$$3$$$. So the set of all vertices is a correct answer.In the third test case: there are no cliques of size $$$4$$$ or required subsets, so the answer... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"graphs"
] | 6b2dfd5501f81bb3c5f11ca11e4c5520 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^5$$$)Β β the number of test cases. The next lines contain descriptions of test cases. The first line of the description of each test case contains three integers $$$n$$$, $$$m$$$, $$$k$$$ ($$$1 \leq n, m, k \leq 10^5$$$, $$$k \leq n$$$). Each of the n... | 2,600 | For each test case: If you found a subset of vertices such that each vertex of this subset has at least $$$k$$$ neighbors in the subset in the first line output $$$1$$$ and the size of the subset. On the second line output the vertices of the subset in any order. If you found a clique of size $$$k$$$ then in the first... | standard output | |
PASSED | 610f926232a262cbec493b7f7e44d6ba | train_002.jsonl | 1605623700 | You are given an undirected graph with $$$n$$$ vertices and $$$m$$$ edges. Also, you are given an integer $$$k$$$.Find either a clique of size $$$k$$$ or a non-empty subset of vertices such that each vertex of this subset has at least $$$k$$$ neighbors in the subset. If there are no such cliques and subsets report abou... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.stream.IntStream;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Random;
import java.io.OutputStreamWriter;
import java.util.NoSuchElementException;
import java.io.OutputStream;
impo... | Java | ["3\n5 9 4\n1 2\n1 3\n1 4\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n10 15 3\n1 2\n2 3\n3 4\n4 5\n5 1\n1 7\n2 8\n3 9\n4 10\n5 6\n7 10\n10 8\n8 6\n6 9\n9 7\n4 5 4\n1 2\n2 3\n3 4\n4 1\n1 3"] | 1 second | ["2\n4 1 2 3 \n1 10\n1 2 3 4 5 6 7 8 9 10 \n-1"] | NoteIn the first test case: the subset $$$\{1, 2, 3, 4\}$$$ is a clique of size $$$4$$$.In the second test case: degree of each vertex in the original graph is at least $$$3$$$. So the set of all vertices is a correct answer.In the third test case: there are no cliques of size $$$4$$$ or required subsets, so the answer... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"graphs"
] | 6b2dfd5501f81bb3c5f11ca11e4c5520 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^5$$$)Β β the number of test cases. The next lines contain descriptions of test cases. The first line of the description of each test case contains three integers $$$n$$$, $$$m$$$, $$$k$$$ ($$$1 \leq n, m, k \leq 10^5$$$, $$$k \leq n$$$). Each of the n... | 2,600 | For each test case: If you found a subset of vertices such that each vertex of this subset has at least $$$k$$$ neighbors in the subset in the first line output $$$1$$$ and the size of the subset. On the second line output the vertices of the subset in any order. If you found a clique of size $$$k$$$ then in the first... | standard output | |
PASSED | 2a8491f64b04468224d071bc9600caec | train_002.jsonl | 1605623700 | You are given an undirected graph with $$$n$$$ vertices and $$$m$$$ edges. Also, you are given an integer $$$k$$$.Find either a clique of size $$$k$$$ or a non-empty subset of vertices such that each vertex of this subset has at least $$$k$$$ neighbors in the subset. If there are no such cliques and subsets report abou... | 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.stream.IntStream;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.Collection;
import java.util.InputMismatchException;
import java.io.IO... | Java | ["3\n5 9 4\n1 2\n1 3\n1 4\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n10 15 3\n1 2\n2 3\n3 4\n4 5\n5 1\n1 7\n2 8\n3 9\n4 10\n5 6\n7 10\n10 8\n8 6\n6 9\n9 7\n4 5 4\n1 2\n2 3\n3 4\n4 1\n1 3"] | 1 second | ["2\n4 1 2 3 \n1 10\n1 2 3 4 5 6 7 8 9 10 \n-1"] | NoteIn the first test case: the subset $$$\{1, 2, 3, 4\}$$$ is a clique of size $$$4$$$.In the second test case: degree of each vertex in the original graph is at least $$$3$$$. So the set of all vertices is a correct answer.In the third test case: there are no cliques of size $$$4$$$ or required subsets, so the answer... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"graphs"
] | 6b2dfd5501f81bb3c5f11ca11e4c5520 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^5$$$)Β β the number of test cases. The next lines contain descriptions of test cases. The first line of the description of each test case contains three integers $$$n$$$, $$$m$$$, $$$k$$$ ($$$1 \leq n, m, k \leq 10^5$$$, $$$k \leq n$$$). Each of the n... | 2,600 | For each test case: If you found a subset of vertices such that each vertex of this subset has at least $$$k$$$ neighbors in the subset in the first line output $$$1$$$ and the size of the subset. On the second line output the vertices of the subset in any order. If you found a clique of size $$$k$$$ then in the first... | standard output | |
PASSED | 5695294377103e857bb9a40aa10113f7 | train_002.jsonl | 1605623700 | You are given an undirected graph with $$$n$$$ vertices and $$$m$$$ edges. Also, you are given an integer $$$k$$$.Find either a clique of size $$$k$$$ or a non-empty subset of vertices such that each vertex of this subset has at least $$$k$$$ neighbors in the subset. If there are no such cliques and subsets report abou... | 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.stream.IntStream;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.Collection;
import java.util.InputMismatchException;
import java.io.IO... | Java | ["3\n5 9 4\n1 2\n1 3\n1 4\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n10 15 3\n1 2\n2 3\n3 4\n4 5\n5 1\n1 7\n2 8\n3 9\n4 10\n5 6\n7 10\n10 8\n8 6\n6 9\n9 7\n4 5 4\n1 2\n2 3\n3 4\n4 1\n1 3"] | 1 second | ["2\n4 1 2 3 \n1 10\n1 2 3 4 5 6 7 8 9 10 \n-1"] | NoteIn the first test case: the subset $$$\{1, 2, 3, 4\}$$$ is a clique of size $$$4$$$.In the second test case: degree of each vertex in the original graph is at least $$$3$$$. So the set of all vertices is a correct answer.In the third test case: there are no cliques of size $$$4$$$ or required subsets, so the answer... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"graphs"
] | 6b2dfd5501f81bb3c5f11ca11e4c5520 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^5$$$)Β β the number of test cases. The next lines contain descriptions of test cases. The first line of the description of each test case contains three integers $$$n$$$, $$$m$$$, $$$k$$$ ($$$1 \leq n, m, k \leq 10^5$$$, $$$k \leq n$$$). Each of the n... | 2,600 | For each test case: If you found a subset of vertices such that each vertex of this subset has at least $$$k$$$ neighbors in the subset in the first line output $$$1$$$ and the size of the subset. On the second line output the vertices of the subset in any order. If you found a clique of size $$$k$$$ then in the first... | standard output | |
PASSED | 96106fb563fcb77418000d74a0bbb1b9 | train_002.jsonl | 1605623700 | You are given an undirected graph with $$$n$$$ vertices and $$$m$$$ edges. Also, you are given an integer $$$k$$$.Find either a clique of size $$$k$$$ or a non-empty subset of vertices such that each vertex of this subset has at least $$$k$$$ neighbors in the subset. If there are no such cliques and subsets report abou... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.stream.IntStream;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Random;
import java.io.OutputStreamWriter;
import java.util.NoSuchElementException;
import java.io.OutputStream;
impo... | Java | ["3\n5 9 4\n1 2\n1 3\n1 4\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n10 15 3\n1 2\n2 3\n3 4\n4 5\n5 1\n1 7\n2 8\n3 9\n4 10\n5 6\n7 10\n10 8\n8 6\n6 9\n9 7\n4 5 4\n1 2\n2 3\n3 4\n4 1\n1 3"] | 1 second | ["2\n4 1 2 3 \n1 10\n1 2 3 4 5 6 7 8 9 10 \n-1"] | NoteIn the first test case: the subset $$$\{1, 2, 3, 4\}$$$ is a clique of size $$$4$$$.In the second test case: degree of each vertex in the original graph is at least $$$3$$$. So the set of all vertices is a correct answer.In the third test case: there are no cliques of size $$$4$$$ or required subsets, so the answer... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"graphs"
] | 6b2dfd5501f81bb3c5f11ca11e4c5520 | The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^5$$$)Β β the number of test cases. The next lines contain descriptions of test cases. The first line of the description of each test case contains three integers $$$n$$$, $$$m$$$, $$$k$$$ ($$$1 \leq n, m, k \leq 10^5$$$, $$$k \leq n$$$). Each of the n... | 2,600 | For each test case: If you found a subset of vertices such that each vertex of this subset has at least $$$k$$$ neighbors in the subset in the first line output $$$1$$$ and the size of the subset. On the second line output the vertices of the subset in any order. If you found a clique of size $$$k$$$ then in the first... | standard output | |
PASSED | fceb1c14097f0623701c2088b4dee5cc | train_002.jsonl | 1600526100 | Everyone knows that agents in Valorant decide, who will play as attackers, and who will play as defenders. To do that Raze and Breach decided to play $$$t$$$ matches of a digit game...In each of $$$t$$$ matches of the digit game, a positive integer is generated. It consists of $$$n$$$ digits. The digits of this integer... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
while (t-- > 0) {
int n = in.nextInt();
String s = in.nextLine();
s = in.nextLine();
boolean raze = f... | Java | ["4\n1\n2\n1\n3\n3\n102\n4\n2069"] | 1 second | ["2\n1\n1\n2"] | NoteIn the first match no one can make a turn, the only digit left is $$$2$$$, it's even, so Breach wins.In the second match the only digit left is $$$3$$$, it's odd, so Raze wins.In the third match Raze can mark the last digit, after that Breach can only mark $$$0$$$. $$$1$$$ will be the last digit left, it's odd, so ... | Java 11 | standard input | [
"implementation",
"greedy",
"games"
] | c9225c915669e183cbd8c20b848d96e5 | First line of input contains an integer $$$t$$$ $$$(1 \le t \le 100)$$$ Β β the number of matches. The first line of each match description contains an integer $$$n$$$ $$$(1 \le n \le 10^3)$$$ Β β the number of digits of the generated number. The second line of each match description contains an $$$n$$$-digit positive in... | 900 | For each match print $$$1$$$, if Raze wins, and $$$2$$$, if Breach wins. | standard output | |
PASSED | 52c80d6285833c85d53de27c4cd6992d | train_002.jsonl | 1600526100 | Everyone knows that agents in Valorant decide, who will play as attackers, and who will play as defenders. To do that Raze and Breach decided to play $$$t$$$ matches of a digit game...In each of $$$t$$$ matches of the digit game, a positive integer is generated. It consists of $$$n$$$ digits. The digits of this integer... | 256 megabytes | import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
public class A_671 {
static int p=1000000007;
public static void main(String[] args) throws Exception{
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out), "ASCII"), 512);
... | Java | ["4\n1\n2\n1\n3\n3\n102\n4\n2069"] | 1 second | ["2\n1\n1\n2"] | NoteIn the first match no one can make a turn, the only digit left is $$$2$$$, it's even, so Breach wins.In the second match the only digit left is $$$3$$$, it's odd, so Raze wins.In the third match Raze can mark the last digit, after that Breach can only mark $$$0$$$. $$$1$$$ will be the last digit left, it's odd, so ... | Java 11 | standard input | [
"implementation",
"greedy",
"games"
] | c9225c915669e183cbd8c20b848d96e5 | First line of input contains an integer $$$t$$$ $$$(1 \le t \le 100)$$$ Β β the number of matches. The first line of each match description contains an integer $$$n$$$ $$$(1 \le n \le 10^3)$$$ Β β the number of digits of the generated number. The second line of each match description contains an $$$n$$$-digit positive in... | 900 | For each match print $$$1$$$, if Raze wins, and $$$2$$$, if Breach wins. | standard output | |
PASSED | ea63a2f9940a1ce2b36bf4e69c365f59 | train_002.jsonl | 1600526100 | Everyone knows that agents in Valorant decide, who will play as attackers, and who will play as defenders. To do that Raze and Breach decided to play $$$t$$$ matches of a digit game...In each of $$$t$$$ matches of the digit game, a positive integer is generated. It consists of $$$n$$$ digits. The digits of this integer... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
private static FastScanner fs = new FastScanner();
public static void main(String[] args) {
int t = fs.nextInt();
while(t-->0)
{
... | Java | ["4\n1\n2\n1\n3\n3\n102\n4\n2069"] | 1 second | ["2\n1\n1\n2"] | NoteIn the first match no one can make a turn, the only digit left is $$$2$$$, it's even, so Breach wins.In the second match the only digit left is $$$3$$$, it's odd, so Raze wins.In the third match Raze can mark the last digit, after that Breach can only mark $$$0$$$. $$$1$$$ will be the last digit left, it's odd, so ... | Java 11 | standard input | [
"implementation",
"greedy",
"games"
] | c9225c915669e183cbd8c20b848d96e5 | First line of input contains an integer $$$t$$$ $$$(1 \le t \le 100)$$$ Β β the number of matches. The first line of each match description contains an integer $$$n$$$ $$$(1 \le n \le 10^3)$$$ Β β the number of digits of the generated number. The second line of each match description contains an $$$n$$$-digit positive in... | 900 | For each match print $$$1$$$, if Raze wins, and $$$2$$$, if Breach wins. | standard output | |
PASSED | 6127611f477ff5eeebf85b60b70d3aad | train_002.jsonl | 1600526100 | Everyone knows that agents in Valorant decide, who will play as attackers, and who will play as defenders. To do that Raze and Breach decided to play $$$t$$$ matches of a digit game...In each of $$$t$$$ matches of the digit game, a positive integer is generated. It consists of $$$n$$$ digits. The digits of this integer... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
InputStreamReader(System.in));
}
String next() ... | Java | ["4\n1\n2\n1\n3\n3\n102\n4\n2069"] | 1 second | ["2\n1\n1\n2"] | NoteIn the first match no one can make a turn, the only digit left is $$$2$$$, it's even, so Breach wins.In the second match the only digit left is $$$3$$$, it's odd, so Raze wins.In the third match Raze can mark the last digit, after that Breach can only mark $$$0$$$. $$$1$$$ will be the last digit left, it's odd, so ... | Java 11 | standard input | [
"implementation",
"greedy",
"games"
] | c9225c915669e183cbd8c20b848d96e5 | First line of input contains an integer $$$t$$$ $$$(1 \le t \le 100)$$$ Β β the number of matches. The first line of each match description contains an integer $$$n$$$ $$$(1 \le n \le 10^3)$$$ Β β the number of digits of the generated number. The second line of each match description contains an $$$n$$$-digit positive in... | 900 | For each match print $$$1$$$, if Raze wins, and $$$2$$$, if Breach wins. | standard output | |
PASSED | 5c3c91f595775b34e6c7672947f97e99 | train_002.jsonl | 1600526100 | Everyone knows that agents in Valorant decide, who will play as attackers, and who will play as defenders. To do that Raze and Breach decided to play $$$t$$$ matches of a digit game...In each of $$$t$$$ matches of the digit game, a positive integer is generated. It consists of $$$n$$$ digits. The digits of this integer... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
impor... | Java | ["4\n1\n2\n1\n3\n3\n102\n4\n2069"] | 1 second | ["2\n1\n1\n2"] | NoteIn the first match no one can make a turn, the only digit left is $$$2$$$, it's even, so Breach wins.In the second match the only digit left is $$$3$$$, it's odd, so Raze wins.In the third match Raze can mark the last digit, after that Breach can only mark $$$0$$$. $$$1$$$ will be the last digit left, it's odd, so ... | Java 11 | standard input | [
"implementation",
"greedy",
"games"
] | c9225c915669e183cbd8c20b848d96e5 | First line of input contains an integer $$$t$$$ $$$(1 \le t \le 100)$$$ Β β the number of matches. The first line of each match description contains an integer $$$n$$$ $$$(1 \le n \le 10^3)$$$ Β β the number of digits of the generated number. The second line of each match description contains an $$$n$$$-digit positive in... | 900 | For each match print $$$1$$$, if Raze wins, and $$$2$$$, if Breach wins. | standard output | |
PASSED | ac876d56a4719d67dc0c3c61852954b2 | train_002.jsonl | 1600526100 | Everyone knows that agents in Valorant decide, who will play as attackers, and who will play as defenders. To do that Raze and Breach decided to play $$$t$$$ matches of a digit game...In each of $$$t$$$ matches of the digit game, a positive integer is generated. It consists of $$$n$$$ digits. The digits of this integer... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;
import java.util.*;
import static java.lang.System.*;
/*
Shortcut-->
Arrays.stream(n).parallel(... | Java | ["4\n1\n2\n1\n3\n3\n102\n4\n2069"] | 1 second | ["2\n1\n1\n2"] | NoteIn the first match no one can make a turn, the only digit left is $$$2$$$, it's even, so Breach wins.In the second match the only digit left is $$$3$$$, it's odd, so Raze wins.In the third match Raze can mark the last digit, after that Breach can only mark $$$0$$$. $$$1$$$ will be the last digit left, it's odd, so ... | Java 11 | standard input | [
"implementation",
"greedy",
"games"
] | c9225c915669e183cbd8c20b848d96e5 | First line of input contains an integer $$$t$$$ $$$(1 \le t \le 100)$$$ Β β the number of matches. The first line of each match description contains an integer $$$n$$$ $$$(1 \le n \le 10^3)$$$ Β β the number of digits of the generated number. The second line of each match description contains an $$$n$$$-digit positive in... | 900 | For each match print $$$1$$$, if Raze wins, and $$$2$$$, if Breach wins. | standard output | |
PASSED | 6c8742eeccfc4a4a948236c3794a9b1d | train_002.jsonl | 1600526100 | Everyone knows that agents in Valorant decide, who will play as attackers, and who will play as defenders. To do that Raze and Breach decided to play $$$t$$$ matches of a digit game...In each of $$$t$$$ matches of the digit game, a positive integer is generated. It consists of $$$n$$$ digits. The digits of this integer... | 256 megabytes | import java.io.*;
import java.util.*;
public class d2671 implements Runnable
{
private boolean console=false;
public void solve()
{
int i; int n=in.ni();
char a[]=in.ns().toCharArray();
int r=0,b=0;
for(i=0;i<n;i++)
{
int v=a[i]-'0';
if(i%2==0&&v%2==0)
r++;
if(i%2!=0&&v%2!=0)
b++;
}
... | Java | ["4\n1\n2\n1\n3\n3\n102\n4\n2069"] | 1 second | ["2\n1\n1\n2"] | NoteIn the first match no one can make a turn, the only digit left is $$$2$$$, it's even, so Breach wins.In the second match the only digit left is $$$3$$$, it's odd, so Raze wins.In the third match Raze can mark the last digit, after that Breach can only mark $$$0$$$. $$$1$$$ will be the last digit left, it's odd, so ... | Java 11 | standard input | [
"implementation",
"greedy",
"games"
] | c9225c915669e183cbd8c20b848d96e5 | First line of input contains an integer $$$t$$$ $$$(1 \le t \le 100)$$$ Β β the number of matches. The first line of each match description contains an integer $$$n$$$ $$$(1 \le n \le 10^3)$$$ Β β the number of digits of the generated number. The second line of each match description contains an $$$n$$$-digit positive in... | 900 | For each match print $$$1$$$, if Raze wins, and $$$2$$$, if Breach wins. | standard output | |
PASSED | 16c68c0f25999fdf5368c61af02d98cb | train_002.jsonl | 1600526100 | Everyone knows that agents in Valorant decide, who will play as attackers, and who will play as defenders. To do that Raze and Breach decided to play $$$t$$$ matches of a digit game...In each of $$$t$$$ matches of the digit game, a positive integer is generated. It consists of $$$n$$$ digits. The digits of this integer... | 256 megabytes | import java.io.*;
import java.util.*;
public class A {
public static void main(String[] args) throws Exception {
BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int t = Integer.parseInt(buffer.readLine());
while (... | Java | ["4\n1\n2\n1\n3\n3\n102\n4\n2069"] | 1 second | ["2\n1\n1\n2"] | NoteIn the first match no one can make a turn, the only digit left is $$$2$$$, it's even, so Breach wins.In the second match the only digit left is $$$3$$$, it's odd, so Raze wins.In the third match Raze can mark the last digit, after that Breach can only mark $$$0$$$. $$$1$$$ will be the last digit left, it's odd, so ... | Java 11 | standard input | [
"implementation",
"greedy",
"games"
] | c9225c915669e183cbd8c20b848d96e5 | First line of input contains an integer $$$t$$$ $$$(1 \le t \le 100)$$$ Β β the number of matches. The first line of each match description contains an integer $$$n$$$ $$$(1 \le n \le 10^3)$$$ Β β the number of digits of the generated number. The second line of each match description contains an $$$n$$$-digit positive in... | 900 | For each match print $$$1$$$, if Raze wins, and $$$2$$$, if Breach wins. | standard output | |
PASSED | b67631b665d7d77a904cbb0d1c3109b3 | train_002.jsonl | 1600526100 | Everyone knows that agents in Valorant decide, who will play as attackers, and who will play as defenders. To do that Raze and Breach decided to play $$$t$$$ matches of a digit game...In each of $$$t$$$ matches of the digit game, a positive integer is generated. It consists of $$$n$$$ digits. The digits of this integer... | 256 megabytes | import java.util.*;
public class B {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
StringBuilder sb = new StringBuilder();
int testCases = sc.nextInt();
for (int t = 0; t < testCases; t++) {
int n = sc.nextInt();
sc.nextLine();... | Java | ["4\n1\n2\n1\n3\n3\n102\n4\n2069"] | 1 second | ["2\n1\n1\n2"] | NoteIn the first match no one can make a turn, the only digit left is $$$2$$$, it's even, so Breach wins.In the second match the only digit left is $$$3$$$, it's odd, so Raze wins.In the third match Raze can mark the last digit, after that Breach can only mark $$$0$$$. $$$1$$$ will be the last digit left, it's odd, so ... | Java 11 | standard input | [
"implementation",
"greedy",
"games"
] | c9225c915669e183cbd8c20b848d96e5 | First line of input contains an integer $$$t$$$ $$$(1 \le t \le 100)$$$ Β β the number of matches. The first line of each match description contains an integer $$$n$$$ $$$(1 \le n \le 10^3)$$$ Β β the number of digits of the generated number. The second line of each match description contains an $$$n$$$-digit positive in... | 900 | For each match print $$$1$$$, if Raze wins, and $$$2$$$, if Breach wins. | standard output | |
PASSED | a23ab5c45a614e6c36a9518de9d713a9 | train_002.jsonl | 1600526100 | Everyone knows that agents in Valorant decide, who will play as attackers, and who will play as defenders. To do that Raze and Breach decided to play $$$t$$$ matches of a digit game...In each of $$$t$$$ matches of the digit game, a positive integer is generated. It consists of $$$n$$$ digits. The digits of this integer... | 256 megabytes | //nitin kumar das
//sept 24, 2020
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class CodeForces extends Functions {
public static void main(String[] args) {
Scanner sc = new Scanner();
int testCase = sc.nextInt();
w... | Java | ["4\n1\n2\n1\n3\n3\n102\n4\n2069"] | 1 second | ["2\n1\n1\n2"] | NoteIn the first match no one can make a turn, the only digit left is $$$2$$$, it's even, so Breach wins.In the second match the only digit left is $$$3$$$, it's odd, so Raze wins.In the third match Raze can mark the last digit, after that Breach can only mark $$$0$$$. $$$1$$$ will be the last digit left, it's odd, so ... | Java 11 | standard input | [
"implementation",
"greedy",
"games"
] | c9225c915669e183cbd8c20b848d96e5 | First line of input contains an integer $$$t$$$ $$$(1 \le t \le 100)$$$ Β β the number of matches. The first line of each match description contains an integer $$$n$$$ $$$(1 \le n \le 10^3)$$$ Β β the number of digits of the generated number. The second line of each match description contains an $$$n$$$-digit positive in... | 900 | For each match print $$$1$$$, if Raze wins, and $$$2$$$, if Breach wins. | standard output | |
PASSED | b2a6015a7cb45001325da36772a3997d | train_002.jsonl | 1600526100 | Everyone knows that agents in Valorant decide, who will play as attackers, and who will play as defenders. To do that Raze and Breach decided to play $$$t$$$ matches of a digit game...In each of $$$t$$$ matches of the digit game, a positive integer is generated. It consists of $$$n$$$ digits. The digits of this integer... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class CodeForces extends Functions {
public static void main(String[] args) {
Scanner sc = new Scanner();
int testCase = sc.nextInt();
while (testCase-- > 0) {
... | Java | ["4\n1\n2\n1\n3\n3\n102\n4\n2069"] | 1 second | ["2\n1\n1\n2"] | NoteIn the first match no one can make a turn, the only digit left is $$$2$$$, it's even, so Breach wins.In the second match the only digit left is $$$3$$$, it's odd, so Raze wins.In the third match Raze can mark the last digit, after that Breach can only mark $$$0$$$. $$$1$$$ will be the last digit left, it's odd, so ... | Java 11 | standard input | [
"implementation",
"greedy",
"games"
] | c9225c915669e183cbd8c20b848d96e5 | First line of input contains an integer $$$t$$$ $$$(1 \le t \le 100)$$$ Β β the number of matches. The first line of each match description contains an integer $$$n$$$ $$$(1 \le n \le 10^3)$$$ Β β the number of digits of the generated number. The second line of each match description contains an $$$n$$$-digit positive in... | 900 | For each match print $$$1$$$, if Raze wins, and $$$2$$$, if Breach wins. | standard output | |
PASSED | 09e4e71680e06699bbe6cdd094fdb03f | train_002.jsonl | 1600526100 | Everyone knows that agents in Valorant decide, who will play as attackers, and who will play as defenders. To do that Raze and Breach decided to play $$$t$$$ matches of a digit game...In each of $$$t$$$ matches of the digit game, a positive integer is generated. It consists of $$$n$$$ digits. The digits of this integer... | 256 megabytes | import java.io.*;
import java.util.*;
public class A
{
static int n;
static int[] arr;
static char[] s;
public static void main(String[] args) throws IOException
{
Flash f = new Flash();
int T = f.ni();
for(int tc = 1; tc <= T; tc++){
n = f.ni();
... | Java | ["4\n1\n2\n1\n3\n3\n102\n4\n2069"] | 1 second | ["2\n1\n1\n2"] | NoteIn the first match no one can make a turn, the only digit left is $$$2$$$, it's even, so Breach wins.In the second match the only digit left is $$$3$$$, it's odd, so Raze wins.In the third match Raze can mark the last digit, after that Breach can only mark $$$0$$$. $$$1$$$ will be the last digit left, it's odd, so ... | Java 11 | standard input | [
"implementation",
"greedy",
"games"
] | c9225c915669e183cbd8c20b848d96e5 | First line of input contains an integer $$$t$$$ $$$(1 \le t \le 100)$$$ Β β the number of matches. The first line of each match description contains an integer $$$n$$$ $$$(1 \le n \le 10^3)$$$ Β β the number of digits of the generated number. The second line of each match description contains an $$$n$$$-digit positive in... | 900 | For each match print $$$1$$$, if Raze wins, and $$$2$$$, if Breach wins. | standard output | |
PASSED | cee98d5d809db70a1dfa8cdfb6aede19 | train_002.jsonl | 1600526100 | Everyone knows that agents in Valorant decide, who will play as attackers, and who will play as defenders. To do that Raze and Breach decided to play $$$t$$$ matches of a digit game...In each of $$$t$$$ matches of the digit game, a positive integer is generated. It consists of $$$n$$$ digits. The digits of this integer... | 256 megabytes | import java.io.*;
import java.util.*;
public class A
{
static int n;
static int[] arr;
static char[] s;
public static void main(String[] args) throws IOException
{
Flash f = new Flash();
int T = f.ni();
for(int tc = 1; tc <= T; tc++){
n = f.ni();
... | Java | ["4\n1\n2\n1\n3\n3\n102\n4\n2069"] | 1 second | ["2\n1\n1\n2"] | NoteIn the first match no one can make a turn, the only digit left is $$$2$$$, it's even, so Breach wins.In the second match the only digit left is $$$3$$$, it's odd, so Raze wins.In the third match Raze can mark the last digit, after that Breach can only mark $$$0$$$. $$$1$$$ will be the last digit left, it's odd, so ... | Java 11 | standard input | [
"implementation",
"greedy",
"games"
] | c9225c915669e183cbd8c20b848d96e5 | First line of input contains an integer $$$t$$$ $$$(1 \le t \le 100)$$$ Β β the number of matches. The first line of each match description contains an integer $$$n$$$ $$$(1 \le n \le 10^3)$$$ Β β the number of digits of the generated number. The second line of each match description contains an $$$n$$$-digit positive in... | 900 | For each match print $$$1$$$, if Raze wins, and $$$2$$$, if Breach wins. | standard output | |
PASSED | 30ca942f5adec9fd97c2faa685341e68 | train_002.jsonl | 1600526100 | Everyone knows that agents in Valorant decide, who will play as attackers, and who will play as defenders. To do that Raze and Breach decided to play $$$t$$$ matches of a digit game...In each of $$$t$$$ matches of the digit game, a positive integer is generated. It consists of $$$n$$$ digits. The digits of this integer... | 256 megabytes | import java.util.Scanner;
public class raze {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int t= sc.nextInt();
while(t-->0){
int n = sc.nextInt();
String s=sc.next();
int[] a= new int[n];
for(int i=0;i<n;i++){
... | Java | ["4\n1\n2\n1\n3\n3\n102\n4\n2069"] | 1 second | ["2\n1\n1\n2"] | NoteIn the first match no one can make a turn, the only digit left is $$$2$$$, it's even, so Breach wins.In the second match the only digit left is $$$3$$$, it's odd, so Raze wins.In the third match Raze can mark the last digit, after that Breach can only mark $$$0$$$. $$$1$$$ will be the last digit left, it's odd, so ... | Java 11 | standard input | [
"implementation",
"greedy",
"games"
] | c9225c915669e183cbd8c20b848d96e5 | First line of input contains an integer $$$t$$$ $$$(1 \le t \le 100)$$$ Β β the number of matches. The first line of each match description contains an integer $$$n$$$ $$$(1 \le n \le 10^3)$$$ Β β the number of digits of the generated number. The second line of each match description contains an $$$n$$$-digit positive in... | 900 | For each match print $$$1$$$, if Raze wins, and $$$2$$$, if Breach wins. | standard output | |
PASSED | d4fb903a9a53d24382d4f6376de8cf93 | train_002.jsonl | 1600526100 | Everyone knows that agents in Valorant decide, who will play as attackers, and who will play as defenders. To do that Raze and Breach decided to play $$$t$$$ matches of a digit game...In each of $$$t$$$ matches of the digit game, a positive integer is generated. It consists of $$$n$$$ digits. The digits of this integer... | 256 megabytes | import java.util.*;
public class digitGame {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
sc.nextLine();
for(int t = 0;t<T;t++){
long n = sc.nextLong();
sc.nextLine();
String str = sc.nextLine(... | Java | ["4\n1\n2\n1\n3\n3\n102\n4\n2069"] | 1 second | ["2\n1\n1\n2"] | NoteIn the first match no one can make a turn, the only digit left is $$$2$$$, it's even, so Breach wins.In the second match the only digit left is $$$3$$$, it's odd, so Raze wins.In the third match Raze can mark the last digit, after that Breach can only mark $$$0$$$. $$$1$$$ will be the last digit left, it's odd, so ... | Java 11 | standard input | [
"implementation",
"greedy",
"games"
] | c9225c915669e183cbd8c20b848d96e5 | First line of input contains an integer $$$t$$$ $$$(1 \le t \le 100)$$$ Β β the number of matches. The first line of each match description contains an integer $$$n$$$ $$$(1 \le n \le 10^3)$$$ Β β the number of digits of the generated number. The second line of each match description contains an $$$n$$$-digit positive in... | 900 | For each match print $$$1$$$, if Raze wins, and $$$2$$$, if Breach wins. | standard output | |
PASSED | 262c90df10824359d7126c8e33539362 | train_002.jsonl | 1600526100 | Everyone knows that agents in Valorant decide, who will play as attackers, and who will play as defenders. To do that Raze and Breach decided to play $$$t$$$ matches of a digit game...In each of $$$t$$$ matches of the digit game, a positive integer is generated. It consists of $$$n$$$ digits. The digits of this integer... | 256 megabytes | import java.util.Scanner;
public class solution
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
long t=sc.nextLong();
while(t-->0)
{
int n=sc.nextInt();
String a=sc.next();
char[] c=new char[n];
c=a.toCharArray();... | Java | ["4\n1\n2\n1\n3\n3\n102\n4\n2069"] | 1 second | ["2\n1\n1\n2"] | NoteIn the first match no one can make a turn, the only digit left is $$$2$$$, it's even, so Breach wins.In the second match the only digit left is $$$3$$$, it's odd, so Raze wins.In the third match Raze can mark the last digit, after that Breach can only mark $$$0$$$. $$$1$$$ will be the last digit left, it's odd, so ... | Java 11 | standard input | [
"implementation",
"greedy",
"games"
] | c9225c915669e183cbd8c20b848d96e5 | First line of input contains an integer $$$t$$$ $$$(1 \le t \le 100)$$$ Β β the number of matches. The first line of each match description contains an integer $$$n$$$ $$$(1 \le n \le 10^3)$$$ Β β the number of digits of the generated number. The second line of each match description contains an $$$n$$$-digit positive in... | 900 | For each match print $$$1$$$, if Raze wins, and $$$2$$$, if Breach wins. | standard output | |
PASSED | e11129ae36e400a464176c313a23ce94 | train_002.jsonl | 1600526100 | Everyone knows that agents in Valorant decide, who will play as attackers, and who will play as defenders. To do that Raze and Breach decided to play $$$t$$$ matches of a digit game...In each of $$$t$$$ matches of the digit game, a positive integer is generated. It consists of $$$n$$$ digits. The digits of this integer... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class digit
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
InputStreamReader(System.in));
}
... | Java | ["4\n1\n2\n1\n3\n3\n102\n4\n2069"] | 1 second | ["2\n1\n1\n2"] | NoteIn the first match no one can make a turn, the only digit left is $$$2$$$, it's even, so Breach wins.In the second match the only digit left is $$$3$$$, it's odd, so Raze wins.In the third match Raze can mark the last digit, after that Breach can only mark $$$0$$$. $$$1$$$ will be the last digit left, it's odd, so ... | Java 11 | standard input | [
"implementation",
"greedy",
"games"
] | c9225c915669e183cbd8c20b848d96e5 | First line of input contains an integer $$$t$$$ $$$(1 \le t \le 100)$$$ Β β the number of matches. The first line of each match description contains an integer $$$n$$$ $$$(1 \le n \le 10^3)$$$ Β β the number of digits of the generated number. The second line of each match description contains an $$$n$$$-digit positive in... | 900 | For each match print $$$1$$$, if Raze wins, and $$$2$$$, if Breach wins. | standard output | |
PASSED | 72fa4e66b7754ba250cfb74273920301 | train_002.jsonl | 1600526100 | Everyone knows that agents in Valorant decide, who will play as attackers, and who will play as defenders. To do that Raze and Breach decided to play $$$t$$$ matches of a digit game...In each of $$$t$$$ matches of the digit game, a positive integer is generated. It consists of $$$n$$$ digits. The digits of this integer... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.*;
public class DigitGame {
class Pair implements Comparable<Pair> {
public int a;
public int b;
public Pair() {
this.a = 0;
... | Java | ["4\n1\n2\n1\n3\n3\n102\n4\n2069"] | 1 second | ["2\n1\n1\n2"] | NoteIn the first match no one can make a turn, the only digit left is $$$2$$$, it's even, so Breach wins.In the second match the only digit left is $$$3$$$, it's odd, so Raze wins.In the third match Raze can mark the last digit, after that Breach can only mark $$$0$$$. $$$1$$$ will be the last digit left, it's odd, so ... | Java 11 | standard input | [
"implementation",
"greedy",
"games"
] | c9225c915669e183cbd8c20b848d96e5 | First line of input contains an integer $$$t$$$ $$$(1 \le t \le 100)$$$ Β β the number of matches. The first line of each match description contains an integer $$$n$$$ $$$(1 \le n \le 10^3)$$$ Β β the number of digits of the generated number. The second line of each match description contains an $$$n$$$-digit positive in... | 900 | For each match print $$$1$$$, if Raze wins, and $$$2$$$, if Breach wins. | standard output | |
PASSED | c87401bde5aa2f0b4633a4754ff2ef0b | train_002.jsonl | 1600526100 | Everyone knows that agents in Valorant decide, who will play as attackers, and who will play as defenders. To do that Raze and Breach decided to play $$$t$$$ matches of a digit game...In each of $$$t$$$ matches of the digit game, a positive integer is generated. It consists of $$$n$$$ digits. The digits of this integer... | 256 megabytes | import java.util.*;
import java.lang.*;
public class Main
{
public static void main (String[] args) {
// your code goes here
Scanner s = new Scanner(System.in);
int t = s.nextInt();
for(int i=0; i<t; i++)
{
int n = s.nextInt();
String x = s.next();
... | Java | ["4\n1\n2\n1\n3\n3\n102\n4\n2069"] | 1 second | ["2\n1\n1\n2"] | NoteIn the first match no one can make a turn, the only digit left is $$$2$$$, it's even, so Breach wins.In the second match the only digit left is $$$3$$$, it's odd, so Raze wins.In the third match Raze can mark the last digit, after that Breach can only mark $$$0$$$. $$$1$$$ will be the last digit left, it's odd, so ... | Java 11 | standard input | [
"implementation",
"greedy",
"games"
] | c9225c915669e183cbd8c20b848d96e5 | First line of input contains an integer $$$t$$$ $$$(1 \le t \le 100)$$$ Β β the number of matches. The first line of each match description contains an integer $$$n$$$ $$$(1 \le n \le 10^3)$$$ Β β the number of digits of the generated number. The second line of each match description contains an $$$n$$$-digit positive in... | 900 | For each match print $$$1$$$, if Raze wins, and $$$2$$$, if Breach wins. | standard output | |
PASSED | ebdcad01f341418710f9aadf74f9d004 | train_002.jsonl | 1542901500 | There are $$$n$$$ TV shows you want to watch. Suppose the whole time is split into equal parts called "minutes". The $$$i$$$-th of the shows is going from $$$l_i$$$-th to $$$r_i$$$-th minute, both ends inclusive.You need a TV to watch a TV show and you can't watch two TV shows which air at the same time on the same TV,... | 256 megabytes | import java.io.BufferedReader;
// import java.io.FileInputStream;
// import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.P... | Java | ["5 4 3\n1 2\n4 10\n2 4\n10 11\n5 9", "6 3 2\n8 20\n6 22\n4 15\n20 28\n17 25\n20 27", "2 1000000000 2\n1 2\n2 3"] | 2 seconds | ["60", "142", "999999997"] | NoteIn the first example, the optimal strategy would be to rent $$$3$$$ TVs to watch: Show $$$[1, 2]$$$ on the first TV, Show $$$[4, 10]$$$ on the second TV, Shows $$$[2, 4], [5, 9], [10, 11]$$$ on the third TV. This way the cost for the first TV is $$$4 + 3 \cdot (2 - 1) = 7$$$, for the second is $$$4 + 3 \cdot (10 -... | Java 8 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 6f4629e2dd9bca7980c8ee4f2e4b3edd | The first line contains integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le y < x \le 10^9$$$)Β β the number of TV shows, the cost to rent a TV for the first minute and the cost to rent a TV for every subsequent minute. Each of the next $$$n$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ (... | 2,000 | Print exactly one integerΒ β the minimum cost to view all the shows taken modulo $$$10^9 + 7$$$. | standard output | |
PASSED | 674640cd2e678f633e1befb0e0648583 | train_002.jsonl | 1542901500 | There are $$$n$$$ TV shows you want to watch. Suppose the whole time is split into equal parts called "minutes". The $$$i$$$-th of the shows is going from $$$l_i$$$-th to $$$r_i$$$-th minute, both ends inclusive.You need a TV to watch a TV show and you can't watch two TV shows which air at the same time on the same TV,... | 256 megabytes | import java.io.*;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;
public class D {
public static void main(String[] args) throws IOException {
try (Input input = new StandardInput(); PrintWriter writer = new PrintWriter(System.out)) {
int n = input.nextIn... | Java | ["5 4 3\n1 2\n4 10\n2 4\n10 11\n5 9", "6 3 2\n8 20\n6 22\n4 15\n20 28\n17 25\n20 27", "2 1000000000 2\n1 2\n2 3"] | 2 seconds | ["60", "142", "999999997"] | NoteIn the first example, the optimal strategy would be to rent $$$3$$$ TVs to watch: Show $$$[1, 2]$$$ on the first TV, Show $$$[4, 10]$$$ on the second TV, Shows $$$[2, 4], [5, 9], [10, 11]$$$ on the third TV. This way the cost for the first TV is $$$4 + 3 \cdot (2 - 1) = 7$$$, for the second is $$$4 + 3 \cdot (10 -... | Java 8 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 6f4629e2dd9bca7980c8ee4f2e4b3edd | The first line contains integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le y < x \le 10^9$$$)Β β the number of TV shows, the cost to rent a TV for the first minute and the cost to rent a TV for every subsequent minute. Each of the next $$$n$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ (... | 2,000 | Print exactly one integerΒ β the minimum cost to view all the shows taken modulo $$$10^9 + 7$$$. | standard output | |
PASSED | 086318ac056fe0174782a18c50f275cf | train_002.jsonl | 1542901500 | There are $$$n$$$ TV shows you want to watch. Suppose the whole time is split into equal parts called "minutes". The $$$i$$$-th of the shows is going from $$$l_i$$$-th to $$$r_i$$$-th minute, both ends inclusive.You need a TV to watch a TV show and you can't watch two TV shows which air at the same time on the same TV,... | 256 megabytes | import java.util.*;
public class Main {
static long MOD = 1000000007;
static void D(){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long x = sc.nextLong();
long y = sc.nextLong();
List<Pair> inpList = new ArrayList<>();
for(int i = 0; i<n; ++i){
... | Java | ["5 4 3\n1 2\n4 10\n2 4\n10 11\n5 9", "6 3 2\n8 20\n6 22\n4 15\n20 28\n17 25\n20 27", "2 1000000000 2\n1 2\n2 3"] | 2 seconds | ["60", "142", "999999997"] | NoteIn the first example, the optimal strategy would be to rent $$$3$$$ TVs to watch: Show $$$[1, 2]$$$ on the first TV, Show $$$[4, 10]$$$ on the second TV, Shows $$$[2, 4], [5, 9], [10, 11]$$$ on the third TV. This way the cost for the first TV is $$$4 + 3 \cdot (2 - 1) = 7$$$, for the second is $$$4 + 3 \cdot (10 -... | Java 8 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 6f4629e2dd9bca7980c8ee4f2e4b3edd | The first line contains integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le y < x \le 10^9$$$)Β β the number of TV shows, the cost to rent a TV for the first minute and the cost to rent a TV for every subsequent minute. Each of the next $$$n$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ (... | 2,000 | Print exactly one integerΒ β the minimum cost to view all the shows taken modulo $$$10^9 + 7$$$. | standard output | |
PASSED | 5c080f3b28c4b19b4949aabc2c7721af | train_002.jsonl | 1542901500 | There are $$$n$$$ TV shows you want to watch. Suppose the whole time is split into equal parts called "minutes". The $$$i$$$-th of the shows is going from $$$l_i$$$-th to $$$r_i$$$-th minute, both ends inclusive.You need a TV to watch a TV show and you can't watch two TV shows which air at the same time on the same TV,... | 256 megabytes | /**
* BaZ :D
*/
import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main
{
static Reader scan;
static PrintWriter pw;
public static void main(String[] args) {
new Thread(null,null,"BaZ",1<<25)
{
public void run()
{
try
... | Java | ["5 4 3\n1 2\n4 10\n2 4\n10 11\n5 9", "6 3 2\n8 20\n6 22\n4 15\n20 28\n17 25\n20 27", "2 1000000000 2\n1 2\n2 3"] | 2 seconds | ["60", "142", "999999997"] | NoteIn the first example, the optimal strategy would be to rent $$$3$$$ TVs to watch: Show $$$[1, 2]$$$ on the first TV, Show $$$[4, 10]$$$ on the second TV, Shows $$$[2, 4], [5, 9], [10, 11]$$$ on the third TV. This way the cost for the first TV is $$$4 + 3 \cdot (2 - 1) = 7$$$, for the second is $$$4 + 3 \cdot (10 -... | Java 8 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 6f4629e2dd9bca7980c8ee4f2e4b3edd | The first line contains integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le y < x \le 10^9$$$)Β β the number of TV shows, the cost to rent a TV for the first minute and the cost to rent a TV for every subsequent minute. Each of the next $$$n$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ (... | 2,000 | Print exactly one integerΒ β the minimum cost to view all the shows taken modulo $$$10^9 + 7$$$. | standard output | |
PASSED | 34bda82ef36f3dc7688a98b20e47fbba | train_002.jsonl | 1542901500 | There are $$$n$$$ TV shows you want to watch. Suppose the whole time is split into equal parts called "minutes". The $$$i$$$-th of the shows is going from $$$l_i$$$-th to $$$r_i$$$-th minute, both ends inclusive.You need a TV to watch a TV show and you can't watch two TV shows which air at the same time on the same TV,... | 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.List;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOExceptio... | Java | ["5 4 3\n1 2\n4 10\n2 4\n10 11\n5 9", "6 3 2\n8 20\n6 22\n4 15\n20 28\n17 25\n20 27", "2 1000000000 2\n1 2\n2 3"] | 2 seconds | ["60", "142", "999999997"] | NoteIn the first example, the optimal strategy would be to rent $$$3$$$ TVs to watch: Show $$$[1, 2]$$$ on the first TV, Show $$$[4, 10]$$$ on the second TV, Shows $$$[2, 4], [5, 9], [10, 11]$$$ on the third TV. This way the cost for the first TV is $$$4 + 3 \cdot (2 - 1) = 7$$$, for the second is $$$4 + 3 \cdot (10 -... | Java 8 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 6f4629e2dd9bca7980c8ee4f2e4b3edd | The first line contains integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le y < x \le 10^9$$$)Β β the number of TV shows, the cost to rent a TV for the first minute and the cost to rent a TV for every subsequent minute. Each of the next $$$n$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ (... | 2,000 | Print exactly one integerΒ β the minimum cost to view all the shows taken modulo $$$10^9 + 7$$$. | standard output | |
PASSED | d73a6f485f0fb790ab89bebca221cd75 | train_002.jsonl | 1542901500 | There are $$$n$$$ TV shows you want to watch. Suppose the whole time is split into equal parts called "minutes". The $$$i$$$-th of the shows is going from $$$l_i$$$-th to $$$r_i$$$-th minute, both ends inclusive.You need a TV to watch a TV show and you can't watch two TV shows which air at the same time on the same TV,... | 256 megabytes | import java.util.*;
import java.io.*;
import java.text.*;
//Solution Credits: Taranpreet Singh
public class Main{
//SOLUTION BEGIN
void solve(int TC) throws Exception{
int n = ni();
long x = nl(), y = nl();
long[][] a= new long[n][];
for(int i = 0; i< n; i++)a[i] = new long[]{n... | Java | ["5 4 3\n1 2\n4 10\n2 4\n10 11\n5 9", "6 3 2\n8 20\n6 22\n4 15\n20 28\n17 25\n20 27", "2 1000000000 2\n1 2\n2 3"] | 2 seconds | ["60", "142", "999999997"] | NoteIn the first example, the optimal strategy would be to rent $$$3$$$ TVs to watch: Show $$$[1, 2]$$$ on the first TV, Show $$$[4, 10]$$$ on the second TV, Shows $$$[2, 4], [5, 9], [10, 11]$$$ on the third TV. This way the cost for the first TV is $$$4 + 3 \cdot (2 - 1) = 7$$$, for the second is $$$4 + 3 \cdot (10 -... | Java 8 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 6f4629e2dd9bca7980c8ee4f2e4b3edd | The first line contains integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le y < x \le 10^9$$$)Β β the number of TV shows, the cost to rent a TV for the first minute and the cost to rent a TV for every subsequent minute. Each of the next $$$n$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ (... | 2,000 | Print exactly one integerΒ β the minimum cost to view all the shows taken modulo $$$10^9 + 7$$$. | standard output | |
PASSED | 66e8e1f66aa9989eab9018ff96febf76 | train_002.jsonl | 1542901500 | There are $$$n$$$ TV shows you want to watch. Suppose the whole time is split into equal parts called "minutes". The $$$i$$$-th of the shows is going from $$$l_i$$$-th to $$$r_i$$$-th minute, both ends inclusive.You need a TV to watch a TV show and you can't watch two TV shows which air at the same time on the same TV,... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long x = sc.nextLong();
long y = sc.nextLong();
Show show[] = new Show[n];
for(int i = 0; i < n; ++i)
show[i] = ... | Java | ["5 4 3\n1 2\n4 10\n2 4\n10 11\n5 9", "6 3 2\n8 20\n6 22\n4 15\n20 28\n17 25\n20 27", "2 1000000000 2\n1 2\n2 3"] | 2 seconds | ["60", "142", "999999997"] | NoteIn the first example, the optimal strategy would be to rent $$$3$$$ TVs to watch: Show $$$[1, 2]$$$ on the first TV, Show $$$[4, 10]$$$ on the second TV, Shows $$$[2, 4], [5, 9], [10, 11]$$$ on the third TV. This way the cost for the first TV is $$$4 + 3 \cdot (2 - 1) = 7$$$, for the second is $$$4 + 3 \cdot (10 -... | Java 8 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 6f4629e2dd9bca7980c8ee4f2e4b3edd | The first line contains integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le y < x \le 10^9$$$)Β β the number of TV shows, the cost to rent a TV for the first minute and the cost to rent a TV for every subsequent minute. Each of the next $$$n$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ (... | 2,000 | Print exactly one integerΒ β the minimum cost to view all the shows taken modulo $$$10^9 + 7$$$. | standard output | |
PASSED | 825847e6fc298f8808304de5f56c5963 | train_002.jsonl | 1542901500 | There are $$$n$$$ TV shows you want to watch. Suppose the whole time is split into equal parts called "minutes". The $$$i$$$-th of the shows is going from $$$l_i$$$-th to $$$r_i$$$-th minute, both ends inclusive.You need a TV to watch a TV show and you can't watch two TV shows which air at the same time on the same TV,... | 256 megabytes | //package round523;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.PriorityQueue;
public class D {
InputStream is;
PrintWriter out;... | Java | ["5 4 3\n1 2\n4 10\n2 4\n10 11\n5 9", "6 3 2\n8 20\n6 22\n4 15\n20 28\n17 25\n20 27", "2 1000000000 2\n1 2\n2 3"] | 2 seconds | ["60", "142", "999999997"] | NoteIn the first example, the optimal strategy would be to rent $$$3$$$ TVs to watch: Show $$$[1, 2]$$$ on the first TV, Show $$$[4, 10]$$$ on the second TV, Shows $$$[2, 4], [5, 9], [10, 11]$$$ on the third TV. This way the cost for the first TV is $$$4 + 3 \cdot (2 - 1) = 7$$$, for the second is $$$4 + 3 \cdot (10 -... | Java 8 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 6f4629e2dd9bca7980c8ee4f2e4b3edd | The first line contains integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le y < x \le 10^9$$$)Β β the number of TV shows, the cost to rent a TV for the first minute and the cost to rent a TV for every subsequent minute. Each of the next $$$n$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ (... | 2,000 | Print exactly one integerΒ β the minimum cost to view all the shows taken modulo $$$10^9 + 7$$$. | standard output | |
PASSED | 58fe5e9e4e6b26f5cb5308e746c229df | train_002.jsonl | 1542901500 | There are $$$n$$$ TV shows you want to watch. Suppose the whole time is split into equal parts called "minutes". The $$$i$$$-th of the shows is going from $$$l_i$$$-th to $$$r_i$$$-th minute, both ends inclusive.You need a TV to watch a TV show and you can't watch two TV shows which air at the same time on the same TV,... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
/* spar5h */
public class cf4 implements Runnable{
static class pair {
int i; long w;
pair(int i, long w) {
this.i = i; this.w = w;
}
}
static class comp implements Comparator<pair> ... | Java | ["5 4 3\n1 2\n4 10\n2 4\n10 11\n5 9", "6 3 2\n8 20\n6 22\n4 15\n20 28\n17 25\n20 27", "2 1000000000 2\n1 2\n2 3"] | 2 seconds | ["60", "142", "999999997"] | NoteIn the first example, the optimal strategy would be to rent $$$3$$$ TVs to watch: Show $$$[1, 2]$$$ on the first TV, Show $$$[4, 10]$$$ on the second TV, Shows $$$[2, 4], [5, 9], [10, 11]$$$ on the third TV. This way the cost for the first TV is $$$4 + 3 \cdot (2 - 1) = 7$$$, for the second is $$$4 + 3 \cdot (10 -... | Java 8 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 6f4629e2dd9bca7980c8ee4f2e4b3edd | The first line contains integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le y < x \le 10^9$$$)Β β the number of TV shows, the cost to rent a TV for the first minute and the cost to rent a TV for every subsequent minute. Each of the next $$$n$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ (... | 2,000 | Print exactly one integerΒ β the minimum cost to view all the shows taken modulo $$$10^9 + 7$$$. | standard output | |
PASSED | ddd1a7b0d1a91fa1552bded830a99484 | train_002.jsonl | 1542901500 | There are $$$n$$$ TV shows you want to watch. Suppose the whole time is split into equal parts called "minutes". The $$$i$$$-th of the shows is going from $$$l_i$$$-th to $$$r_i$$$-th minute, both ends inclusive.You need a TV to watch a TV show and you can't watch two TV shows which air at the same time on the same TV,... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
/* spar5h */
public class cf4 implements Runnable{
static class pair {
int i; long w;
pair(int i, long w) {
this.i = i; this.w = w;
}
}
static class comp implements Comparator<pair> ... | Java | ["5 4 3\n1 2\n4 10\n2 4\n10 11\n5 9", "6 3 2\n8 20\n6 22\n4 15\n20 28\n17 25\n20 27", "2 1000000000 2\n1 2\n2 3"] | 2 seconds | ["60", "142", "999999997"] | NoteIn the first example, the optimal strategy would be to rent $$$3$$$ TVs to watch: Show $$$[1, 2]$$$ on the first TV, Show $$$[4, 10]$$$ on the second TV, Shows $$$[2, 4], [5, 9], [10, 11]$$$ on the third TV. This way the cost for the first TV is $$$4 + 3 \cdot (2 - 1) = 7$$$, for the second is $$$4 + 3 \cdot (10 -... | Java 8 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 6f4629e2dd9bca7980c8ee4f2e4b3edd | The first line contains integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le y < x \le 10^9$$$)Β β the number of TV shows, the cost to rent a TV for the first minute and the cost to rent a TV for every subsequent minute. Each of the next $$$n$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ (... | 2,000 | Print exactly one integerΒ β the minimum cost to view all the shows taken modulo $$$10^9 + 7$$$. | standard output | |
PASSED | 5e083b1f9296ccdc5a371681d535dd5c | train_002.jsonl | 1542901500 | There are $$$n$$$ TV shows you want to watch. Suppose the whole time is split into equal parts called "minutes". The $$$i$$$-th of the shows is going from $$$l_i$$$-th to $$$r_i$$$-th minute, both ends inclusive.You need a TV to watch a TV show and you can't watch two TV shows which air at the same time on the same TV,... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class D {
public static void main(String[] args) {
Scanner input = new Scanner();
StringBuilder output = new StringBuilder();
int n = input.nextInt();
long x = input.nextInt();
long y = input.nextI... | Java | ["5 4 3\n1 2\n4 10\n2 4\n10 11\n5 9", "6 3 2\n8 20\n6 22\n4 15\n20 28\n17 25\n20 27", "2 1000000000 2\n1 2\n2 3"] | 2 seconds | ["60", "142", "999999997"] | NoteIn the first example, the optimal strategy would be to rent $$$3$$$ TVs to watch: Show $$$[1, 2]$$$ on the first TV, Show $$$[4, 10]$$$ on the second TV, Shows $$$[2, 4], [5, 9], [10, 11]$$$ on the third TV. This way the cost for the first TV is $$$4 + 3 \cdot (2 - 1) = 7$$$, for the second is $$$4 + 3 \cdot (10 -... | Java 8 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 6f4629e2dd9bca7980c8ee4f2e4b3edd | The first line contains integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le y < x \le 10^9$$$)Β β the number of TV shows, the cost to rent a TV for the first minute and the cost to rent a TV for every subsequent minute. Each of the next $$$n$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ (... | 2,000 | Print exactly one integerΒ β the minimum cost to view all the shows taken modulo $$$10^9 + 7$$$. | standard output | |
PASSED | 3b84c609a59287ecc94a7d6ca23e0d10 | train_002.jsonl | 1542901500 | There are $$$n$$$ TV shows you want to watch. Suppose the whole time is split into equal parts called "minutes". The $$$i$$$-th of the shows is going from $$$l_i$$$-th to $$$r_i$$$-th minute, both ends inclusive.You need a TV to watch a TV show and you can't watch two TV shows which air at the same time on the same TV,... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class TVShows {
private static final int MOD = 1000000007;
public static void solve(FastIO io) {
int N = io.nextInt();
long X = io.nextLong();
long Y = io.nextLong();
Range[] ranges = new Range[N];
for (int i = 0; i < N; ++i) {
long L = ... | Java | ["5 4 3\n1 2\n4 10\n2 4\n10 11\n5 9", "6 3 2\n8 20\n6 22\n4 15\n20 28\n17 25\n20 27", "2 1000000000 2\n1 2\n2 3"] | 2 seconds | ["60", "142", "999999997"] | NoteIn the first example, the optimal strategy would be to rent $$$3$$$ TVs to watch: Show $$$[1, 2]$$$ on the first TV, Show $$$[4, 10]$$$ on the second TV, Shows $$$[2, 4], [5, 9], [10, 11]$$$ on the third TV. This way the cost for the first TV is $$$4 + 3 \cdot (2 - 1) = 7$$$, for the second is $$$4 + 3 \cdot (10 -... | Java 8 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 6f4629e2dd9bca7980c8ee4f2e4b3edd | The first line contains integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le y < x \le 10^9$$$)Β β the number of TV shows, the cost to rent a TV for the first minute and the cost to rent a TV for every subsequent minute. Each of the next $$$n$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ (... | 2,000 | Print exactly one integerΒ β the minimum cost to view all the shows taken modulo $$$10^9 + 7$$$. | standard output | |
PASSED | c92d2f870693db3591cb278dac188eac | train_002.jsonl | 1542901500 | There are $$$n$$$ TV shows you want to watch. Suppose the whole time is split into equal parts called "minutes". The $$$i$$$-th of the shows is going from $$$l_i$$$-th to $$$r_i$$$-th minute, both ends inclusive.You need a TV to watch a TV show and you can't watch two TV shows which air at the same time on the same TV,... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class TVShows {
private static final int MOD = 1000000007;
public static void solve(FastIO io) {
int N = io.nextInt();
long X = io.nextLong();
long Y = io.nextLong();
Range[] ranges = new Range[N];
for (int i = 0; i < N; ++i) {
long L = ... | Java | ["5 4 3\n1 2\n4 10\n2 4\n10 11\n5 9", "6 3 2\n8 20\n6 22\n4 15\n20 28\n17 25\n20 27", "2 1000000000 2\n1 2\n2 3"] | 2 seconds | ["60", "142", "999999997"] | NoteIn the first example, the optimal strategy would be to rent $$$3$$$ TVs to watch: Show $$$[1, 2]$$$ on the first TV, Show $$$[4, 10]$$$ on the second TV, Shows $$$[2, 4], [5, 9], [10, 11]$$$ on the third TV. This way the cost for the first TV is $$$4 + 3 \cdot (2 - 1) = 7$$$, for the second is $$$4 + 3 \cdot (10 -... | Java 8 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 6f4629e2dd9bca7980c8ee4f2e4b3edd | The first line contains integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le y < x \le 10^9$$$)Β β the number of TV shows, the cost to rent a TV for the first minute and the cost to rent a TV for every subsequent minute. Each of the next $$$n$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ (... | 2,000 | Print exactly one integerΒ β the minimum cost to view all the shows taken modulo $$$10^9 + 7$$$. | standard output | |
PASSED | 0fb736f6a5bf79ff54d2b6c319ace7cf | train_002.jsonl | 1542901500 | There are $$$n$$$ TV shows you want to watch. Suppose the whole time is split into equal parts called "minutes". The $$$i$$$-th of the shows is going from $$$l_i$$$-th to $$$r_i$$$-th minute, both ends inclusive.You need a TV to watch a TV show and you can't watch two TV shows which air at the same time on the same TV,... | 256 megabytes | /*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
If I'm the sun, you're the moon
Because when I go up, you go down
*******************************
I'm working for the day I will surpass you
https://www.a2oj.com/Ladder16.html
*/
impor... | Java | ["5 4 3\n1 2\n4 10\n2 4\n10 11\n5 9", "6 3 2\n8 20\n6 22\n4 15\n20 28\n17 25\n20 27", "2 1000000000 2\n1 2\n2 3"] | 2 seconds | ["60", "142", "999999997"] | NoteIn the first example, the optimal strategy would be to rent $$$3$$$ TVs to watch: Show $$$[1, 2]$$$ on the first TV, Show $$$[4, 10]$$$ on the second TV, Shows $$$[2, 4], [5, 9], [10, 11]$$$ on the third TV. This way the cost for the first TV is $$$4 + 3 \cdot (2 - 1) = 7$$$, for the second is $$$4 + 3 \cdot (10 -... | Java 8 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 6f4629e2dd9bca7980c8ee4f2e4b3edd | The first line contains integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le y < x \le 10^9$$$)Β β the number of TV shows, the cost to rent a TV for the first minute and the cost to rent a TV for every subsequent minute. Each of the next $$$n$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ (... | 2,000 | Print exactly one integerΒ β the minimum cost to view all the shows taken modulo $$$10^9 + 7$$$. | standard output | |
PASSED | 0b5cbf3cf4b2f1ee2fea249f5e802ce8 | train_002.jsonl | 1542901500 | There are $$$n$$$ TV shows you want to watch. Suppose the whole time is split into equal parts called "minutes". The $$$i$$$-th of the shows is going from $$$l_i$$$-th to $$$r_i$$$-th minute, both ends inclusive.You need a TV to watch a TV show and you can't watch two TV shows which air at the same time on the same TV,... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
static int MOD = 1000000007;
// After writing solution, quick scan for:
// array out of bounds
// special cases e.g. n=1?
//
// Big numbers arithmetic bugs:
// int overflow
// sorting, or tak... | Java | ["5 4 3\n1 2\n4 10\n2 4\n10 11\n5 9", "6 3 2\n8 20\n6 22\n4 15\n20 28\n17 25\n20 27", "2 1000000000 2\n1 2\n2 3"] | 2 seconds | ["60", "142", "999999997"] | NoteIn the first example, the optimal strategy would be to rent $$$3$$$ TVs to watch: Show $$$[1, 2]$$$ on the first TV, Show $$$[4, 10]$$$ on the second TV, Shows $$$[2, 4], [5, 9], [10, 11]$$$ on the third TV. This way the cost for the first TV is $$$4 + 3 \cdot (2 - 1) = 7$$$, for the second is $$$4 + 3 \cdot (10 -... | Java 8 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 6f4629e2dd9bca7980c8ee4f2e4b3edd | The first line contains integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le y < x \le 10^9$$$)Β β the number of TV shows, the cost to rent a TV for the first minute and the cost to rent a TV for every subsequent minute. Each of the next $$$n$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ (... | 2,000 | Print exactly one integerΒ β the minimum cost to view all the shows taken modulo $$$10^9 + 7$$$. | standard output | |
PASSED | 605c77cdfe3a7d3f976a672a1e3bf071 | train_002.jsonl | 1542901500 | There are $$$n$$$ TV shows you want to watch. Suppose the whole time is split into equal parts called "minutes". The $$$i$$$-th of the shows is going from $$$l_i$$$-th to $$$r_i$$$-th minute, both ends inclusive.You need a TV to watch a TV show and you can't watch two TV shows which air at the same time on the same TV,... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;
/**
* @author khokharnikunj8
*/
public class Main {
public static void main(... | Java | ["5 4 3\n1 2\n4 10\n2 4\n10 11\n5 9", "6 3 2\n8 20\n6 22\n4 15\n20 28\n17 25\n20 27", "2 1000000000 2\n1 2\n2 3"] | 2 seconds | ["60", "142", "999999997"] | NoteIn the first example, the optimal strategy would be to rent $$$3$$$ TVs to watch: Show $$$[1, 2]$$$ on the first TV, Show $$$[4, 10]$$$ on the second TV, Shows $$$[2, 4], [5, 9], [10, 11]$$$ on the third TV. This way the cost for the first TV is $$$4 + 3 \cdot (2 - 1) = 7$$$, for the second is $$$4 + 3 \cdot (10 -... | Java 8 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 6f4629e2dd9bca7980c8ee4f2e4b3edd | The first line contains integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le y < x \le 10^9$$$)Β β the number of TV shows, the cost to rent a TV for the first minute and the cost to rent a TV for every subsequent minute. Each of the next $$$n$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ (... | 2,000 | Print exactly one integerΒ β the minimum cost to view all the shows taken modulo $$$10^9 + 7$$$. | standard output | |
PASSED | bf929821aecd42058d607ea19fdbdc0e | train_002.jsonl | 1542901500 | There are $$$n$$$ TV shows you want to watch. Suppose the whole time is split into equal parts called "minutes". The $$$i$$$-th of the shows is going from $$$l_i$$$-th to $$$r_i$$$-th minute, both ends inclusive.You need a TV to watch a TV show and you can't watch two TV shows which air at the same time on the same TV,... | 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.ArrayList;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;
public class Div2_... | Java | ["5 4 3\n1 2\n4 10\n2 4\n10 11\n5 9", "6 3 2\n8 20\n6 22\n4 15\n20 28\n17 25\n20 27", "2 1000000000 2\n1 2\n2 3"] | 2 seconds | ["60", "142", "999999997"] | NoteIn the first example, the optimal strategy would be to rent $$$3$$$ TVs to watch: Show $$$[1, 2]$$$ on the first TV, Show $$$[4, 10]$$$ on the second TV, Shows $$$[2, 4], [5, 9], [10, 11]$$$ on the third TV. This way the cost for the first TV is $$$4 + 3 \cdot (2 - 1) = 7$$$, for the second is $$$4 + 3 \cdot (10 -... | Java 8 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 6f4629e2dd9bca7980c8ee4f2e4b3edd | The first line contains integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le y < x \le 10^9$$$)Β β the number of TV shows, the cost to rent a TV for the first minute and the cost to rent a TV for every subsequent minute. Each of the next $$$n$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ (... | 2,000 | Print exactly one integerΒ β the minimum cost to view all the shows taken modulo $$$10^9 + 7$$$. | standard output | |
PASSED | 146deb19ad8a7ac6184b766d8b976f65 | train_002.jsonl | 1542901500 | There are $$$n$$$ TV shows you want to watch. Suppose the whole time is split into equal parts called "minutes". The $$$i$$$-th of the shows is going from $$$l_i$$$-th to $$$r_i$$$-th minute, both ends inclusive.You need a TV to watch a TV show and you can't watch two TV shows which air at the same time on the same TV,... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.PriorityQueue;
import java.util.AbstractQueue;
import java.util.InputMismatchException;
import java.util.logging.Level;
import java.util.ArrayList;
import java.util.AbstractCollection;
import java.util.IllegalFormatExc... | Java | ["5 4 3\n1 2\n4 10\n2 4\n10 11\n5 9", "6 3 2\n8 20\n6 22\n4 15\n20 28\n17 25\n20 27", "2 1000000000 2\n1 2\n2 3"] | 2 seconds | ["60", "142", "999999997"] | NoteIn the first example, the optimal strategy would be to rent $$$3$$$ TVs to watch: Show $$$[1, 2]$$$ on the first TV, Show $$$[4, 10]$$$ on the second TV, Shows $$$[2, 4], [5, 9], [10, 11]$$$ on the third TV. This way the cost for the first TV is $$$4 + 3 \cdot (2 - 1) = 7$$$, for the second is $$$4 + 3 \cdot (10 -... | Java 8 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 6f4629e2dd9bca7980c8ee4f2e4b3edd | The first line contains integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le y < x \le 10^9$$$)Β β the number of TV shows, the cost to rent a TV for the first minute and the cost to rent a TV for every subsequent minute. Each of the next $$$n$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ (... | 2,000 | Print exactly one integerΒ β the minimum cost to view all the shows taken modulo $$$10^9 + 7$$$. | standard output | |
PASSED | ea58811c8872e4b9f361bb812c0d0c91 | train_002.jsonl | 1542901500 | There are $$$n$$$ TV shows you want to watch. Suppose the whole time is split into equal parts called "minutes". The $$$i$$$-th of the shows is going from $$$l_i$$$-th to $$$r_i$$$-th minute, both ends inclusive.You need a TV to watch a TV show and you can't watch two TV shows which air at the same time on the same TV,... | 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(){
out.println(work());
out.flush();
}
long mod=1000000007;
long gcd(long a,long b) {
return b==0?... | Java | ["5 4 3\n1 2\n4 10\n2 4\n10 11\n5 9", "6 3 2\n8 20\n6 22\n4 15\n20 28\n17 25\n20 27", "2 1000000000 2\n1 2\n2 3"] | 2 seconds | ["60", "142", "999999997"] | NoteIn the first example, the optimal strategy would be to rent $$$3$$$ TVs to watch: Show $$$[1, 2]$$$ on the first TV, Show $$$[4, 10]$$$ on the second TV, Shows $$$[2, 4], [5, 9], [10, 11]$$$ on the third TV. This way the cost for the first TV is $$$4 + 3 \cdot (2 - 1) = 7$$$, for the second is $$$4 + 3 \cdot (10 -... | Java 8 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 6f4629e2dd9bca7980c8ee4f2e4b3edd | The first line contains integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le y < x \le 10^9$$$)Β β the number of TV shows, the cost to rent a TV for the first minute and the cost to rent a TV for every subsequent minute. Each of the next $$$n$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ (... | 2,000 | Print exactly one integerΒ β the minimum cost to view all the shows taken modulo $$$10^9 + 7$$$. | standard output | |
PASSED | 59fab34d0278758d341014952f659ad2 | train_002.jsonl | 1542901500 | There are $$$n$$$ TV shows you want to watch. Suppose the whole time is split into equal parts called "minutes". The $$$i$$$-th of the shows is going from $$$l_i$$$-th to $$$r_i$$$-th minute, both ends inclusive.You need a TV to watch a TV show and you can't watch two TV shows which air at the same time on the same TV,... | 256 megabytes | import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.PriorityQueue;
public class D {
InputStream is;
PrintWriter out;
String INPUT = "";... | Java | ["5 4 3\n1 2\n4 10\n2 4\n10 11\n5 9", "6 3 2\n8 20\n6 22\n4 15\n20 28\n17 25\n20 27", "2 1000000000 2\n1 2\n2 3"] | 2 seconds | ["60", "142", "999999997"] | NoteIn the first example, the optimal strategy would be to rent $$$3$$$ TVs to watch: Show $$$[1, 2]$$$ on the first TV, Show $$$[4, 10]$$$ on the second TV, Shows $$$[2, 4], [5, 9], [10, 11]$$$ on the third TV. This way the cost for the first TV is $$$4 + 3 \cdot (2 - 1) = 7$$$, for the second is $$$4 + 3 \cdot (10 -... | Java 8 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 6f4629e2dd9bca7980c8ee4f2e4b3edd | The first line contains integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le y < x \le 10^9$$$)Β β the number of TV shows, the cost to rent a TV for the first minute and the cost to rent a TV for every subsequent minute. Each of the next $$$n$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ (... | 2,000 | Print exactly one integerΒ β the minimum cost to view all the shows taken modulo $$$10^9 + 7$$$. | standard output | |
PASSED | fb6fe6fd398d0bfb7872e022f7b480ac | train_002.jsonl | 1542901500 | There are $$$n$$$ TV shows you want to watch. Suppose the whole time is split into equal parts called "minutes". The $$$i$$$-th of the shows is going from $$$l_i$$$-th to $$$r_i$$$-th minute, both ends inclusive.You need a TV to watch a TV show and you can't watch two TV shows which air at the same time on the same TV,... | 256 megabytes | //package que_a;
import java.io.*;
import java.util.*;
import java.math.*;
public class utkarsh {
InputStream is;
PrintWriter out;
long mod = (long)(1e9 + 7), inf = (long)(3e18);
class pair {
long F, S;
pair(long f, long s) {
F = f; S = s;
}
}
... | Java | ["5 4 3\n1 2\n4 10\n2 4\n10 11\n5 9", "6 3 2\n8 20\n6 22\n4 15\n20 28\n17 25\n20 27", "2 1000000000 2\n1 2\n2 3"] | 2 seconds | ["60", "142", "999999997"] | NoteIn the first example, the optimal strategy would be to rent $$$3$$$ TVs to watch: Show $$$[1, 2]$$$ on the first TV, Show $$$[4, 10]$$$ on the second TV, Shows $$$[2, 4], [5, 9], [10, 11]$$$ on the third TV. This way the cost for the first TV is $$$4 + 3 \cdot (2 - 1) = 7$$$, for the second is $$$4 + 3 \cdot (10 -... | Java 8 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 6f4629e2dd9bca7980c8ee4f2e4b3edd | The first line contains integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le y < x \le 10^9$$$)Β β the number of TV shows, the cost to rent a TV for the first minute and the cost to rent a TV for every subsequent minute. Each of the next $$$n$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ (... | 2,000 | Print exactly one integerΒ β the minimum cost to view all the shows taken modulo $$$10^9 + 7$$$. | standard output | |
PASSED | 1da80ba2ed9c40c0994765bd4f9cc05b | train_002.jsonl | 1542901500 | There are $$$n$$$ TV shows you want to watch. Suppose the whole time is split into equal parts called "minutes". The $$$i$$$-th of the shows is going from $$$l_i$$$-th to $$$r_i$$$-th minute, both ends inclusive.You need a TV to watch a TV show and you can't watch two TV shows which air at the same time on the same TV,... | 256 megabytes | import java.lang.*;
import java.math.*;
import java.util.*;
import java.io.*;
public class Main {
class Node implements Comparable<Node>{
int l;
int r;
public Node(int x,int y){
this.l=x;
this.r=y;
}
public int compareTo(Node c){
int t=Integer.compare(c.r,this.r);
re... | Java | ["5 4 3\n1 2\n4 10\n2 4\n10 11\n5 9", "6 3 2\n8 20\n6 22\n4 15\n20 28\n17 25\n20 27", "2 1000000000 2\n1 2\n2 3"] | 2 seconds | ["60", "142", "999999997"] | NoteIn the first example, the optimal strategy would be to rent $$$3$$$ TVs to watch: Show $$$[1, 2]$$$ on the first TV, Show $$$[4, 10]$$$ on the second TV, Shows $$$[2, 4], [5, 9], [10, 11]$$$ on the third TV. This way the cost for the first TV is $$$4 + 3 \cdot (2 - 1) = 7$$$, for the second is $$$4 + 3 \cdot (10 -... | Java 8 | standard input | [
"data structures",
"implementation",
"sortings",
"greedy"
] | 6f4629e2dd9bca7980c8ee4f2e4b3edd | The first line contains integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le y < x \le 10^9$$$)Β β the number of TV shows, the cost to rent a TV for the first minute and the cost to rent a TV for every subsequent minute. Each of the next $$$n$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ (... | 2,000 | Print exactly one integerΒ β the minimum cost to view all the shows taken modulo $$$10^9 + 7$$$. | standard output | |
PASSED | 34e8989fb3621e59ab27b18760d4cf15 | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | import java.util.Scanner;
import java.util.HashSet;
public class Badge{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int a[]=new int[n+1];
a[0] = 0;
for(int i=1;i<=n;i++){
a[i]=sc.nextInt();
}
HashSet<Integer> hs=new Has... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | f83c7f7f75a9c7463400bbd9efcbeac2 | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Scanner;
public class CodeForces
{
public static void main(String[] args)
{
Scanner input = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int n = input.nextInt();
int[] array = ne... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | 1e3b9a727608122faa11fdfa004ae4fc | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes |
import java.io.*;
import java.util.*;
public class Q3 {
public static void main(String[] args) {
InputReader in = new InputReader();
int N = in.nextInt();
int input[]=new int[N+1];
//int k=in.nextInt();
//long FinalAns=0;
for (int i = 1; i <= N; i++) {
... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | 736c4bb6b54256b582eb9eaabc3fcd8c | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | import java.util.*;
public class Miksha
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int a[]=new int[n+1];
for(int i=1;i<=n;i++)
a[i]=sc.nextInt();
for(int i=1;i<=n;i++)
{
... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | 64f8fb0044be9dd54b15bddda6947beb | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Comparator;
import java.io.InputStream;
public class Main {
public static void main(String[] ar... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | 84e7f218bc966fce5e5dab0528a9ce26 | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.*;
public class Codeforces{
BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
PrintWriter out =new PrintWriter(System.out);
StringTokenizer st =new StringTokenizer("");
String next(){
if(!st.hasMoreTokens()){
... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | a16e139e2966a34dc7ab8ae1ccdba7b3 | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | import java.util.*;
public class Solution
{
public static void main(String[] args)
{
Scanner in=new Scanner(System.in);
int n=in.nextInt();
int a[]=new int[n];
for(int i=0; i<n; i++)
{
a[i]=in.nextInt()-1;
... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | 9fd4c583f63b96e77c596a382466deb3 | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Ideone
{
public static void main (String[] args)
{
Scanner in = new Scanner(System.in);
int n=in.nextInt();
HashMap<Integer,Integer> hs=new HashMap<Integer,Integer>();
for(int i=0;i<n;i++){
int n1=in.nextInt();
hs.put(i+1,n1)... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | ea5f1c0a3fa89570e4899c043e2fa16e | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | import java.util.HashMap;
import java.util.Scanner;
/**
*
* @author Arpit
*/
public class JavaApplication168 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner sc = new Scanner(System.in);
... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | 95077c920ab6ab22d817fb0b8187a2bf | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
BufferedReader bf=new BufferedReader(... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | 912a458e19a9f9792c4320e2c70f4fdb | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Main {
public static void main(String[] args) {
Scanner scan=new Scanner(System.in);
int n=scan.nextInt();
int a[] = new int[n];
for(int i=0;i<n;i++)
a[i]=scan.nextInt();
if(n==1){
System.out.println(a[0]);
System.... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | 5adc8bbb5b3603962c22f6d89a0cc513 | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | import java.util.HashSet;
import java.util.Scanner;
public class CF1020_D2_B {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[] p = new int[n+1];
for (int i = 1; i < n+1; i++) {
p[i] = scanner.nextInt();
... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | 03c84d7c024c46aec771eec24aca8d97 | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
ArrayList<Integer>[] adjList;
private void solve() {
int n = nextInt();
adjList = new ArrayList[n];
for (int i = 0; i < n; i++) {
adjList[i] = new ArrayList<>();
adjList[i].add(nextInt()-1);
}
... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | 4131b08d08b8c0d38de3827ffb814a20 | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;
/**
* @author khokharnikunj8
*/
public class Main {
public static void ... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | 9cdb0aac4a49f6aec534e2d60baa5ac2 | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | import java.util.Scanner;
public class badge {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
String v = in.nextLine();
int[] arr = new int[n];
for (int i = 0; i < n; i++){
arr[i] = in.nextInt();
}
... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | b5cd78ee61d9cebc1e01d693697b7795 | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes |
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Main {
public static void main(String [] args){
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
Map<Integer, Integer>counts = new HashMap<Integer, Integer>();
Map<Integer, I... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | 5759c52dbcd3a82c4de734890afa1849 | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | import java.util.*;
import java.io.*;
public class A {
public static void main(String args[]) {
FastScanner in=new FastScanner();
int n=in.nextInt();
int a[]=in.nextArray(n);
StringBuilder sb=new StringBuilder();
for(int i=0;i<n;i++) {
HashSet<Integer> hset=new HashSet<>();
int j=i+1;
while(!hset.co... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | 728c0671a476856ea2d3153437f42569 | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | // Working program with FastReader
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.StringTokenizer;
public class Main
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
pub... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | ecf7ab7889689d07ebf5fca42aabca4d | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes |
import java.io.*;
import java.math.*;
import java.util.*;
// author @mdazmat9
public class codeforces{
static ArrayList<Integer> list=new ArrayList<>();
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(Syst... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | ab0905a63b2db78923c1dc9a4592a67d | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | import java.io.*;
import java.util.*;
// author @mdazmat9
public class CodeForces_CA {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in); // The fast input should be enough
OutputWriter out = new OutputWriter(System.out); // If you don't use the \n the... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | f12976b3f208ae9069d5846d2cc4b71a | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | import java.util.*;
import java.math.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class a{
static int[] count,count1,count2;
static int[] arr;
static char[] ch,ch1;
static int[] darr,farr;
static Chara... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | aa62fe941fd977646c97f5d5b184eb28 | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
Reader.init(System.in);
int n = Reader.nextInt();
int[] arr... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | 35a190503493449e1c26858c76b92bb1 | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | import java.util.*;
import java.io.*;
public class Badge{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] inp = new int[n];
for(int i = 0; i < n; ++i) {
inp[i] = sc.nextInt();
}
solve(n, inp);
}
public static vo... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | bfcfd7c7b97914aeddf5a452e76d8b23 | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author nirav
*/
public class Mai... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | 5322905fee5b242034f9d59f567a47d2 | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | /**
* @author Administrator
*/
import java.util.* ;
public class main {
static int [][] N = new int[1001][1001];
static int visit_2d_elment = 0;
static int count [] ;
static
{
count = new int[1001];
}
static int Badge( int a , int n)
{
if(visit_2d_elment != ... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | 6688bdb6d9fb03ff06c50e24f0b19fc4 | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.IOException;
import java.math.*;
public class cp{
public static boolean[] visited;
public static int[] nextNode;
public static int[] answer;
public static int dfs(int node){
... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | cfab8caaa64e4e4e4be60003d8e54358 | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | import java.util.Scanner;
//Question C 502
public class Main2 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] a = new int[n];
for(int i=0;i<n;i++) {
a[i] = in.nextInt();
a[i]--;
}
for(int i=0;i<n;i++) {
... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | 0e9f1183e60d0d1a9af58dd1cc78aeeb | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 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.Collections;
import java.util.InputMismatchException;
import java.util.List;
public class Main {
private static final int MAXN... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | 3f29a5ee8d1f50251361c0f0339a1fb1 | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | import java.util.*;
public class Main
{
private int V;
private ArrayList<Integer> adj[];
Main(int v)
{
V=v;
adj=new ArrayList[v];
for(int i=0;i<v;i++)
{
adj[i]=new ArrayList();
}
}
void addedge(int v,int w)
{
adj[v].add(w);
}
void dfsutil(int v,boolean visited[],ArrayList<In... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | 48d66bf881125352e6ec910610aa5feb | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | import java.util.Scanner;
public class B {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[] p = new int[n + 1];
for (int i = 0; i < n; i++) {
p[i + 1] = scanner.nextInt();
}
for (int i = 1... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | b2ccfece4e4f675e1d83b9cca141b1cb | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
int n = cin.nextInt();
int[] stu = new int[n + 1];
for(int i = 1;i <= n;i++)
stu[i] = cin.nextInt();
HashMap<Integer,Integer> map = new HashMap<>();
for(int i = 1;i <= n;i++) {
map... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | 901114ba23d3268220bc70dea7a07a0d | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Problem {
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int[] arr = new int[N+1];
for(int i=1;i<=N;i++)arr[i]=sc.nextInt(... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | 9efcfb9eae7bf042f9ff23a70921ea89 | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class sol {
int mat[][];
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
int n=Integer.parseInt(sc.nextLine());
String s[]=sc.nextLine().split(" ");
//String str[]=s.split(" ");
//System.out... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | e1eb5fdc2283c71e24768c7a4af8cc8b | train_002.jsonl | 1533994500 | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 256 megabytes |
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Scanner;
public class Badge {
static int n;
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner s = new Scanner(System.in);
n = s.nextInt();
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
... | Java | ["3\n2 3 2", "3\n1 2 3"] | 1 second | ["2 2 3", "1 2 3"] | NoteThe picture corresponds to the first example test case. When $$$a = 1$$$, the teacher comes to students $$$1$$$, $$$2$$$, $$$3$$$, $$$2$$$, in this order, and the student $$$2$$$ is the one who receives a second hole in his badge.When $$$a = 2$$$, the teacher comes to students $$$2$$$, $$$3$$$, $$$2$$$, and the st... | Java 8 | standard input | [
"dfs and similar",
"brute force",
"graphs"
] | c0abbbf1cf6c8ec11e942cdaaf01ad7c | The first line of the input contains the only integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β the number of the naughty students. The second line contains $$$n$$$ integers $$$p_1$$$, ..., $$$p_n$$$ ($$$1 \le p_i \le n$$$), where $$$p_i$$$ indicates the student who was reported to the teacher by student $$$i$$$. | 1,000 | For every student $$$a$$$ from $$$1$$$ to $$$n$$$ print which student would receive two holes in the badge, if $$$a$$$ was the first student caught by the teacher. | standard output | |
PASSED | 243b060ce9546c8d0ae23451272304c2 | train_002.jsonl | 1326899100 | A country called Berland consists of n cities, numbered with integer numbers from 1 to n. Some of them are connected by bidirectional roads. Each road has some length. There is a path from each city to any other one by these roads. According to some Super Duper Documents, Berland is protected by the Super Duper Missile... | 256 megabytes | import java.awt.List;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util.Vector;
public c... | Java | ["4 6 1\n1 2 1\n1 3 3\n2 3 1\n2 4 1\n3 4 1\n1 4 2\n2", "5 6 3\n3 1 1\n3 2 1\n3 4 1\n3 5 1\n1 2 6\n4 5 8\n4"] | 2 seconds | ["3", "3"] | NoteIn the first sample the silos are located in cities 3 and 4 and on road (1,β3) at a distance 2 from city 1 (correspondingly, at a distance 1 from city 3).In the second sample one missile silo is located right in the middle of the road (1,β2). Two more silos are on the road (4,β5) at a distance 3 from city 4 in the ... | Java 6 | standard input | [
"data structures",
"graphs",
"dfs and similar",
"shortest paths"
] | c3c3ac7a8c9d2ce142e223309ab005e6 | The first line contains three integers n, m and s (2ββ€βnββ€β105, , 1ββ€βsββ€βn) β the number of cities, the number of roads in the country and the number of the capital, correspondingly. Capital is the city no. s. Then m lines contain the descriptions of roads. Each of them is described by three integers vi, ui, wi (1ββ€β... | 1,900 | Print the single number β the number of Super Duper Secret Missile Silos that are located in Berland. | standard output | |
PASSED | 7cf322745706ccf2b73818af09f92df3 | train_002.jsonl | 1326899100 | A country called Berland consists of n cities, numbered with integer numbers from 1 to n. Some of them are connected by bidirectional roads. Each road has some length. There is a path from each city to any other one by these roads. According to some Super Duper Documents, Berland is protected by the Super Duper Missile... | 256 megabytes | //package round103;
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.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;
public class D {
static BufferedReader b... | Java | ["4 6 1\n1 2 1\n1 3 3\n2 3 1\n2 4 1\n3 4 1\n1 4 2\n2", "5 6 3\n3 1 1\n3 2 1\n3 4 1\n3 5 1\n1 2 6\n4 5 8\n4"] | 2 seconds | ["3", "3"] | NoteIn the first sample the silos are located in cities 3 and 4 and on road (1,β3) at a distance 2 from city 1 (correspondingly, at a distance 1 from city 3).In the second sample one missile silo is located right in the middle of the road (1,β2). Two more silos are on the road (4,β5) at a distance 3 from city 4 in the ... | Java 6 | standard input | [
"data structures",
"graphs",
"dfs and similar",
"shortest paths"
] | c3c3ac7a8c9d2ce142e223309ab005e6 | The first line contains three integers n, m and s (2ββ€βnββ€β105, , 1ββ€βsββ€βn) β the number of cities, the number of roads in the country and the number of the capital, correspondingly. Capital is the city no. s. Then m lines contain the descriptions of roads. Each of them is described by three integers vi, ui, wi (1ββ€β... | 1,900 | Print the single number β the number of Super Duper Secret Missile Silos that are located in Berland. | standard output | |
PASSED | af6cfed3fd919a1592bae4c734222f79 | train_002.jsonl | 1326899100 | A country called Berland consists of n cities, numbered with integer numbers from 1 to n. Some of them are connected by bidirectional roads. Each road has some length. There is a path from each city to any other one by these roads. According to some Super Duper Documents, Berland is protected by the Super Duper Missile... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main {
static BufferedReader reader;
static StringTokenizer tokenizer;
static PrintWriter writer;
static int nextInt() throws IOException {
return Integer.pa... | Java | ["4 6 1\n1 2 1\n1 3 3\n2 3 1\n2 4 1\n3 4 1\n1 4 2\n2", "5 6 3\n3 1 1\n3 2 1\n3 4 1\n3 5 1\n1 2 6\n4 5 8\n4"] | 2 seconds | ["3", "3"] | NoteIn the first sample the silos are located in cities 3 and 4 and on road (1,β3) at a distance 2 from city 1 (correspondingly, at a distance 1 from city 3).In the second sample one missile silo is located right in the middle of the road (1,β2). Two more silos are on the road (4,β5) at a distance 3 from city 4 in the ... | Java 6 | standard input | [
"data structures",
"graphs",
"dfs and similar",
"shortest paths"
] | c3c3ac7a8c9d2ce142e223309ab005e6 | The first line contains three integers n, m and s (2ββ€βnββ€β105, , 1ββ€βsββ€βn) β the number of cities, the number of roads in the country and the number of the capital, correspondingly. Capital is the city no. s. Then m lines contain the descriptions of roads. Each of them is described by three integers vi, ui, wi (1ββ€β... | 1,900 | Print the single number β the number of Super Duper Secret Missile Silos that are located in Berland. | standard output | |
PASSED | 387875abdbfdccdf03e97d0dfe954d54 | train_002.jsonl | 1326899100 | A country called Berland consists of n cities, numbered with integer numbers from 1 to n. Some of them are connected by bidirectional roads. Each road has some length. There is a path from each city to any other one by these roads. According to some Super Duper Documents, Berland is protected by the Super Duper Missile... | 256 megabytes | import java.util.*;
public class TaskD {
class Road implements Comparable<Road> {
int u;
int v;
int w;
Road(int u, int v, int w) {
this.u = u;
this.v = v;
this.w = w;
}
public int compareTo(Road o) {
ret... | Java | ["4 6 1\n1 2 1\n1 3 3\n2 3 1\n2 4 1\n3 4 1\n1 4 2\n2", "5 6 3\n3 1 1\n3 2 1\n3 4 1\n3 5 1\n1 2 6\n4 5 8\n4"] | 2 seconds | ["3", "3"] | NoteIn the first sample the silos are located in cities 3 and 4 and on road (1,β3) at a distance 2 from city 1 (correspondingly, at a distance 1 from city 3).In the second sample one missile silo is located right in the middle of the road (1,β2). Two more silos are on the road (4,β5) at a distance 3 from city 4 in the ... | Java 6 | standard input | [
"data structures",
"graphs",
"dfs and similar",
"shortest paths"
] | c3c3ac7a8c9d2ce142e223309ab005e6 | The first line contains three integers n, m and s (2ββ€βnββ€β105, , 1ββ€βsββ€βn) β the number of cities, the number of roads in the country and the number of the capital, correspondingly. Capital is the city no. s. Then m lines contain the descriptions of roads. Each of them is described by three integers vi, ui, wi (1ββ€β... | 1,900 | Print the single number β the number of Super Duper Secret Missile Silos that are located in Berland. | standard output | |
PASSED | 79012cadcdd61d7307c31f663b30f072 | train_002.jsonl | 1326899100 | A country called Berland consists of n cities, numbered with integer numbers from 1 to n. Some of them are connected by bidirectional roads. Each road has some length. There is a path from each city to any other one by these roads. According to some Super Duper Documents, Berland is protected by the Super Duper Missile... | 256 megabytes | import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main {
BufferedReader in;
StringTokenizer st;
PrintWriter out;
int n, m, s;
int[][] edge;
ArrayList<Integer>[] g, cost;
static class Pair implements Comparable<Pair> {
int cost, v;
publi... | Java | ["4 6 1\n1 2 1\n1 3 3\n2 3 1\n2 4 1\n3 4 1\n1 4 2\n2", "5 6 3\n3 1 1\n3 2 1\n3 4 1\n3 5 1\n1 2 6\n4 5 8\n4"] | 2 seconds | ["3", "3"] | NoteIn the first sample the silos are located in cities 3 and 4 and on road (1,β3) at a distance 2 from city 1 (correspondingly, at a distance 1 from city 3).In the second sample one missile silo is located right in the middle of the road (1,β2). Two more silos are on the road (4,β5) at a distance 3 from city 4 in the ... | Java 6 | standard input | [
"data structures",
"graphs",
"dfs and similar",
"shortest paths"
] | c3c3ac7a8c9d2ce142e223309ab005e6 | The first line contains three integers n, m and s (2ββ€βnββ€β105, , 1ββ€βsββ€βn) β the number of cities, the number of roads in the country and the number of the capital, correspondingly. Capital is the city no. s. Then m lines contain the descriptions of roads. Each of them is described by three integers vi, ui, wi (1ββ€β... | 1,900 | Print the single number β the number of Super Duper Secret Missile Silos that are located in Berland. | standard output | |
PASSED | 76c7a8914fd8e8c7ee178ba2330d9fe7 | train_002.jsonl | 1326899100 | A country called Berland consists of n cities, numbered with integer numbers from 1 to n. Some of them are connected by bidirectional roads. Each road has some length. There is a path from each city to any other one by these roads. According to some Super Duper Documents, Berland is protected by the Super Duper Missile... | 256 megabytes | import java.util.Scanner;
import java.io.PrintWriter;
import java.util.*;
import static java.lang.Math.*;
public class D103 {
static Scanner in = new Scanner(System.in);
static PrintWriter w = new PrintWriter(System.out, true);
static int ni() {
return in.nextInt();
}
static String nl() {
return in.nextLin... | Java | ["4 6 1\n1 2 1\n1 3 3\n2 3 1\n2 4 1\n3 4 1\n1 4 2\n2", "5 6 3\n3 1 1\n3 2 1\n3 4 1\n3 5 1\n1 2 6\n4 5 8\n4"] | 2 seconds | ["3", "3"] | NoteIn the first sample the silos are located in cities 3 and 4 and on road (1,β3) at a distance 2 from city 1 (correspondingly, at a distance 1 from city 3).In the second sample one missile silo is located right in the middle of the road (1,β2). Two more silos are on the road (4,β5) at a distance 3 from city 4 in the ... | Java 6 | standard input | [
"data structures",
"graphs",
"dfs and similar",
"shortest paths"
] | c3c3ac7a8c9d2ce142e223309ab005e6 | The first line contains three integers n, m and s (2ββ€βnββ€β105, , 1ββ€βsββ€βn) β the number of cities, the number of roads in the country and the number of the capital, correspondingly. Capital is the city no. s. Then m lines contain the descriptions of roads. Each of them is described by three integers vi, ui, wi (1ββ€β... | 1,900 | Print the single number β the number of Super Duper Secret Missile Silos that are located in Berland. | standard output | |
PASSED | 20773974bdd4093ff41c7b5eb69de469 | train_002.jsonl | 1326899100 | A country called Berland consists of n cities, numbered with integer numbers from 1 to n. Some of them are connected by bidirectional roads. Each road has some length. There is a path from each city to any other one by these roads. According to some Super Duper Documents, Berland is protected by the Super Duper Missile... | 256 megabytes | import java.util.*;
import java.io.*;
import java.awt.Point;
import static java.lang.Math.*;
public class P144D {
public static void main(String[] args) throws Exception {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int m = in.nextInt();
int s = in.nextInt()-1;
... | Java | ["4 6 1\n1 2 1\n1 3 3\n2 3 1\n2 4 1\n3 4 1\n1 4 2\n2", "5 6 3\n3 1 1\n3 2 1\n3 4 1\n3 5 1\n1 2 6\n4 5 8\n4"] | 2 seconds | ["3", "3"] | NoteIn the first sample the silos are located in cities 3 and 4 and on road (1,β3) at a distance 2 from city 1 (correspondingly, at a distance 1 from city 3).In the second sample one missile silo is located right in the middle of the road (1,β2). Two more silos are on the road (4,β5) at a distance 3 from city 4 in the ... | Java 6 | standard input | [
"data structures",
"graphs",
"dfs and similar",
"shortest paths"
] | c3c3ac7a8c9d2ce142e223309ab005e6 | The first line contains three integers n, m and s (2ββ€βnββ€β105, , 1ββ€βsββ€βn) β the number of cities, the number of roads in the country and the number of the capital, correspondingly. Capital is the city no. s. Then m lines contain the descriptions of roads. Each of them is described by three integers vi, ui, wi (1ββ€β... | 1,900 | Print the single number β the number of Super Duper Secret Missile Silos that are located in Berland. | standard output | |
PASSED | 38a5dfcc748f2782c3160ee3e575fecb | train_002.jsonl | 1326899100 | A country called Berland consists of n cities, numbered with integer numbers from 1 to n. Some of them are connected by bidirectional roads. Each road has some length. There is a path from each city to any other one by these roads. According to some Super Duper Documents, Berland is protected by the Super Duper Missile... | 256 megabytes | import java.lang.*;
import java.awt.geom.Line2D;
import java.io.*;
import java.util.*;
import java.math.*;
public class D implements Runnable{
class V implements Comparable<V> {
int dist, num;
public V (int num, int dist) {
this.num = num;
this.dist = dist;
... | Java | ["4 6 1\n1 2 1\n1 3 3\n2 3 1\n2 4 1\n3 4 1\n1 4 2\n2", "5 6 3\n3 1 1\n3 2 1\n3 4 1\n3 5 1\n1 2 6\n4 5 8\n4"] | 2 seconds | ["3", "3"] | NoteIn the first sample the silos are located in cities 3 and 4 and on road (1,β3) at a distance 2 from city 1 (correspondingly, at a distance 1 from city 3).In the second sample one missile silo is located right in the middle of the road (1,β2). Two more silos are on the road (4,β5) at a distance 3 from city 4 in the ... | Java 6 | standard input | [
"data structures",
"graphs",
"dfs and similar",
"shortest paths"
] | c3c3ac7a8c9d2ce142e223309ab005e6 | The first line contains three integers n, m and s (2ββ€βnββ€β105, , 1ββ€βsββ€βn) β the number of cities, the number of roads in the country and the number of the capital, correspondingly. Capital is the city no. s. Then m lines contain the descriptions of roads. Each of them is described by three integers vi, ui, wi (1ββ€β... | 1,900 | Print the single number β the number of Super Duper Secret Missile Silos that are located in Berland. | standard output | |
PASSED | c6663e8b02b1330ef61038c602078d5c | train_002.jsonl | 1326899100 | A country called Berland consists of n cities, numbered with integer numbers from 1 to n. Some of them are connected by bidirectional roads. Each road has some length. There is a path from each city to any other one by these roads. According to some Super Duper Documents, Berland is protected by the Super Duper Missile... | 256 megabytes | import java.util.PriorityQueue;
import java.util.Comparator;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.Collection;
import java.util.List;
import java.io.IOException;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.ArrayList;
impor... | Java | ["4 6 1\n1 2 1\n1 3 3\n2 3 1\n2 4 1\n3 4 1\n1 4 2\n2", "5 6 3\n3 1 1\n3 2 1\n3 4 1\n3 5 1\n1 2 6\n4 5 8\n4"] | 2 seconds | ["3", "3"] | NoteIn the first sample the silos are located in cities 3 and 4 and on road (1,β3) at a distance 2 from city 1 (correspondingly, at a distance 1 from city 3).In the second sample one missile silo is located right in the middle of the road (1,β2). Two more silos are on the road (4,β5) at a distance 3 from city 4 in the ... | Java 6 | standard input | [
"data structures",
"graphs",
"dfs and similar",
"shortest paths"
] | c3c3ac7a8c9d2ce142e223309ab005e6 | The first line contains three integers n, m and s (2ββ€βnββ€β105, , 1ββ€βsββ€βn) β the number of cities, the number of roads in the country and the number of the capital, correspondingly. Capital is the city no. s. Then m lines contain the descriptions of roads. Each of them is described by three integers vi, ui, wi (1ββ€β... | 1,900 | Print the single number β the number of Super Duper Secret Missile Silos that are located in Berland. | standard output | |
PASSED | 5cd7b9e14c3d2f3de57aa5d9dcca5207 | train_002.jsonl | 1326899100 | A country called Berland consists of n cities, numbered with integer numbers from 1 to n. Some of them are connected by bidirectional roads. Each road has some length. There is a path from each city to any other one by these roads. According to some Super Duper Documents, Berland is protected by the Super Duper Missile... | 256 megabytes | import java.util.PriorityQueue;
import java.util.Comparator;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.Collection;
import java.util.List;
import java.io.IOException;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.ArrayList;
impor... | Java | ["4 6 1\n1 2 1\n1 3 3\n2 3 1\n2 4 1\n3 4 1\n1 4 2\n2", "5 6 3\n3 1 1\n3 2 1\n3 4 1\n3 5 1\n1 2 6\n4 5 8\n4"] | 2 seconds | ["3", "3"] | NoteIn the first sample the silos are located in cities 3 and 4 and on road (1,β3) at a distance 2 from city 1 (correspondingly, at a distance 1 from city 3).In the second sample one missile silo is located right in the middle of the road (1,β2). Two more silos are on the road (4,β5) at a distance 3 from city 4 in the ... | Java 6 | standard input | [
"data structures",
"graphs",
"dfs and similar",
"shortest paths"
] | c3c3ac7a8c9d2ce142e223309ab005e6 | The first line contains three integers n, m and s (2ββ€βnββ€β105, , 1ββ€βsββ€βn) β the number of cities, the number of roads in the country and the number of the capital, correspondingly. Capital is the city no. s. Then m lines contain the descriptions of roads. Each of them is described by three integers vi, ui, wi (1ββ€β... | 1,900 | Print the single number β the number of Super Duper Secret Missile Silos that are located in Berland. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.