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
359eb52ff3f7032231f45ea28692374a
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.util.*; public class file{ public static void main(String[] args){ Scanner scn = new Scanner(System.in); int n = scn.nextInt(); int m = scn.nextInt(); ArrayList<ArrayList<Integer>> graph = new ArrayList<>(); for(int i=0; i<n; i++){ graph.add(new Array...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
65c418b6f5c70526eae7351a4a935e9b
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.util.*; public class network{ public static void main(String[] args){ Scanner scn=new Scanner(System.in); int n=scn.nextInt(); int m=scn.nextInt(); ArrayList<ArrayList<Integer>> graph=new ArrayList<>(); for(int i=0;i<=n;i++){ graph.add(n...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
2259114b29be9408e5465332ded0aefb
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; import java.math.MathContext; import java.text.DecimalFormat; import java.text.Format; import static java.lang.Math.*; import static java.util.Arrays.*; import static java.util.Collections.*; import java.awt.List; public class Main { public stati...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
a94fdbde0a233f578c0a8b92b39a11cf
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Solution { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String[] inputs = in.readLine().split(" "); ...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
cc384bb4a3acd93d0251b5717291c757
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; import java.util.TreeSet; public class Main { private static int n,m; private static int[] numcon; ...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
351305644cbc7699214867624922233f
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import org.omg.CORBA.INTERNAL; import java.io.*; import java.math.BigInteger; import java.util.*; public class Newbie { static InputReader sc = new InputReader(System.in); static PrintWriter out = new PrintWriter(System.out); public static void main(String[] args) { solver s = new solver(); ...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
4a637d98b7e14a39acbffdef666c3ca4
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class A { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter o...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
d0971dbcd7cfdbdca97cdc60220f87e9
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.util.*; import java.io.*; public class Main { static ArrayList<Integer>adj[]; static boolean vis[]; static int level[]; static int freq[]; static long q,sum; static Set<Integer>su=new TreeSet<>(); public static void main(String args[])throws UnsupportedEncodingException, IOException, Exception { Re...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
dca956cc2b0538205a2eaa650bd0ace1
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.StringTokenizer; import java.util.Vector; public class BNetworkTopology { public static void main(String[] args) throws IOException { BufferedReader reader=new ...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
77f7cc6b8aa458feabe47b56294c7dca
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; import java.util.Arrays; import java.util.ArrayList; import java.lang.Math; import java.util.Arrays; import java.util.Comparator; public class Main { ...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
702093fc557e9291a55cd0aee206c9cf
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.util.Scanner; /** * http://codeforces.ru/contest/292/problem/B * * @author scorpion@yandex-team on 08.01.15. */ public class Solution292B { public static void main(final String[] args) throws Exception { final Scanner sc = new Scanner(System.in); final int n = sc.nextInt(); final int m =...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
14df3bbee2d7e866ddd24231e47fc593
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Codechef { static PrintWriter out=new PrintWriter(System.out);static FastScanner in = new FastScanner(System.in);static class FastScanner {BufferedReader br;StringTokenizer stok;FastScanner(InputStream is) {br = new BufferedReader(new InputStr...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
6469b7367e183db1232260fca33e7ed5
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.io.PrintStream; import java.lang.*; import static java.lang.Character.isUpperCase; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Scanner; import java.util.*; import java.util.TreeMap; import java.io.BufferedReader; import java.io.IOExcep...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
aa09f1e45dcf6dac5e012b97b7c3237d
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
/* * Author- Priyam Vora * BTech 2nd Year DAIICT */ import java.io.*; import java.math.*; import java.util.*; import javax.print.attribute.SetOfIntegerSyntax; public class Graph1 { private static InputStream stream; private stati...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
ab73d3ec601a0add0edf2c885e55b1d2
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.util.*; import java.io.*; public class solution{ public static void main(String [] args){ Scanner sc=new Scanner(System.in); int N=sc.nextInt(); int E=sc.nextInt(); int[]deg=new int[N+1]; for(int i=1;i<=E;i++){ deg[sc.nextInt()]++; deg[sc.n...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
05da8fd8dd8124bb3f691483e67d66bc
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Network_Topology { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
0507b57074025fb528cb60188424d5a0
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.List; import java.util.HashMap; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import java.io.InputStream; /** * Built using CHelper plug-...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
d06dee2529cd758b7b2ed3dc1eaea1b5
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.io.*; import java.util.*; public class networkTopology{ public static void main(String []args){ Scanner in = new Scanner(System.in); int n, m; n = in.nextInt(); m = in.nextInt(); ArrayList<Integer> graph[]; graph = new ArrayList[n+1]; for(int i=1;i...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
48a2de3b7e947ee80950dcb143bdcdb6
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.io.*; import java.util.*; public class networkTopology{ public static void main(String []args){ Scanner in = new Scanner(System.in); int n, m; n = in.nextInt(); m = in.nextInt(); Vector<Integer> graph[]; graph = new Vector[n+1]; for(int i=1;i<=n;i+...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
f9c9bbb199f18c93ecffdaa143653cb4
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.io.*; import java.util.*; public class networkTopology{ public static void main(String []args){ Scanner in = new Scanner(System.in); int n, m; n = in.nextInt(); m = in.nextInt(); LinkedList<Integer> graph[]; graph = new LinkedList[n+1]; for(int i=1...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
81b13490cb989eb43001ab2c72b457a4
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
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 { static int cnt; static List<Integer...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
8375e42ac7a8d161f4c70fa20cbd8b71
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.util.Arrays; import java.util.Scanner; /** * Created by Ashiq on 5/14/2016. */ public class Main { public static void main(String []args) { Scanner s=new Scanner(System.in); int node, edge; node=s.nextInt(); edge=s.nextInt(); int [] ara=new int[node+1]; ...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
7e20f3caec7b05520b559fc34f3ddc63
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(),m=sc.nextInt(); int[] x=new int[n+1]; int[] y=new int[n+1]; int two=0,one=0; for(int j=0;j<m;j++) { int a=sc.nextInt(),b=sc.nextInt(); x[a]++; x[b]++; y[a]=b; ...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
0bd9ec31095e0c55f29872332914432b
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
/** * * @author sarthak */ import java.util.*; import java.math.*; import java.io.*; public class crocChamp2013_B { static class FastScanner { BufferedReader br; StringTokenizer st; public FastScanner(InputStream is) { br = new BufferedReader(new InputStreamReader(is));...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
eeb09f5c850f91fb4e73167b55671e68
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.StringTokenizer; import java.util.TreeSet; public class B292 { static BufferedReader br; static StringTokenizer st; static PrintWriter pw; ...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
0dfdb7a404cbdb564fd2c41d0eeda9f5
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.StringTokenizer; import java.util.TreeSet; public class B292 { static BufferedReader br; static StringTokenizer st; static PrintWriter pw; ...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
29884497d4c5b4be5fbfca73d3b080d0
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.util.Scanner; import java.util.Map; import java.util.List; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.io.PrintWriter; public class Main{ public static long arr[]; public static int c1,c2,c3; public static void main(String[] args) { Scanner sc = new Scann...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
ae78c250b4fecd86714be3cf16137a5e
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.io.*; import java.security.KeyPair; import java.util.*; public class Main { public static boolean isbus=true; public static boolean allvisited =false; public static boolean star =false; public static void main(String[] args) { Scanner sc = new Scanner(System.in); HashMap<Integer,Lis...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
9293757e984f6dfdf0d077e045d0d289
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.util.*; public class B292 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int v = in.nextInt(); int e = in.nextInt(); int[] vertices = new int[v]; int a, b; for( int i = 0; i < e; i++ ) { a = in.nextInt()-1; b = in.nextInt()-1; vertices[a]++; vertice...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
f2104d61d891602e661cc8e225b6de32
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; public class Main extends PrintWriter { BufferedReader in; StringTokenizer stok; final Random rand = new Random(31); final int inf = (int) 1e9; final long linf = (long) 1e18; final static String IO = "_std"; List<Integ...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
ccbc004a13a1e7d0a2cecf4d948e6e2d
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader( new InputStreamReader(System.in)); PrintWriter writer = new PrintWriter(System.out); StringTokenizer sz; sz = new StringTokenizer(reader.readL...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
304da053ed83d150cb8fa5e54a6e2633
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class NetworkTopology { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] line = br.readLine().split(" "); int n = Int...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
06ff24fa10290ffbe0e977a80baeda6a
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
//package bfs; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.*; //public class FastReader { //} class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new Buf...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
7b6deb114c5f953c2593ee44e098b57f
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
//package CodeForces; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Scanner; public class NetworkTopology { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStream...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
8644e0f5843ce1c658892bf60542841f
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
//package CodeForces; import java.util.ArrayList; import java.util.Scanner; public class NetworkTopology { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), m = sc.nextInt(); ArrayList [] graph = new ArrayList[n]; for(int i = 0; i<n; i++) graph[i] = new Arra...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
1cda0928637943962b87b1c08f758625
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
//package CodeForces; import java.util.ArrayList; import java.util.Scanner; public class NetworkTopology { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), m = sc.nextInt(); int [] num = new int[n]; for(int i = 0; i<2*m; i++) { int v = sc.nextInt()-1; ...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
a4d1d860a49b8a05f26b06e7122c8922
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
//package CodeForces; import java.util.ArrayList; import java.util.Scanner; public class NetworkTopology { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), m = sc.nextInt(); int [] num = new int[n]; for(int i = 0; i<2*m; i++) { int v = sc.nextInt()-1; ...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
234b09ac5178b3497ef4a092be17031c
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
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.StringTokenizer; public class Main{ static int V , E ; static Array...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
c14eda5ae8bb7bc00cfa9826d44c89c4
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; import java.io.IOException; public class Topology { public static void main(String[] args) throws IOException { Scanner in = new Scanner(); int n = in.nextInt(); int m = in.nextInt(); Graph topo...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
d7f6c077deda3de10dbe078b121a9358
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public ...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
6b26f741805e3fddbfee31ccf296dfcf
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.util.*; public class B2 { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int[] data = new int[n]; int max = 0; int twoTimes = 0; for(int i = 0 ; i<m; i++) { int k = sc.nextInt(); int v = sc.nextInt(); data[k-1...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
fb135498259a2a40a82a07733ce5d6b7
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.LinkedList; import java.util.Queue; import java.util.StringTokenizer; public class Main { static StringBuilder out = new StringBuilder(); static BufferedReader br = new BufferedReader(new InputStreamReader(Sys...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
52ff542edda765af3b383c9784ea1b40
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.LinkedList; import java.util.Queue; import java.util.StringTokenizer; public class Main { static StringBuilder out = new StringBuilder(); static BufferedReader br = new BufferedReader(new InputStreamReader(Sys...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
dcf486dc5d6ac8643f0f2dd0989e02e3
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
/** * _292B */ import java.util.*; public class _292B { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int m=sc.nextInt(); ArrayList<ArrayList<Integer>> adjList=new ArrayList<>(); for(int i=0;i<n;i++){ adjList.add...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
cfe3b74d4e9a69c029097a13336a708d
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class NetworkTopology { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); ArrayList<Integer>[] adj = new ArrayList[n]; for (int i = 0; i < n; i++) adj[i] = new ArrayList...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
5704465c00a54f280bb376040d261564
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.util.*; public class RookBishopKing { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int v = sc.nextInt(); int e = sc.nextInt(); int deg[] = new int[v]; for (int i=0;i<e;++i){ int a = sc.nextInt();...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
f5189fa8d524c5fa1f959e4a666671ca
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); OutputWriter out = new OutputWriter(outputStream); Task solver = ...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
f03ea110f74b553d09eb7d5d32c7d6fe
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.io.*; import java.util.*; public class b292{ public static void main(String[] args) throws Exception { //new FileInputStream("input.txt"); //new FileOutputStream("output.txt") InputReader in = new InputReader(System.in); OutputWriter out = new OutputWriter(System.out); int n=in.ri(); ...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
e98fcfc6e11aa0e299c60791d04d6f9c
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.util.Scanner; public class Network_Tropology { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), m = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < m; ++i) { ++a[sc.nextInt() - 1]; ++a[sc.nextInt() - 1]; } s...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
501fc76d349722fcd5e9a00744a087b6
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in=new Scanner(System.in); String s=in.nextLine(); String[]parts=s.split(" "); int n=Integer.parseInt(parts[0]); int m=Integer.parseInt(parts[...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
93c24a23e6fd1f7c7f65cb4f6f7fbaf2
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class NetworkTopology { public static final String[] ans = {"unknown topology", "bus topology", "ring topology", "star topology"}; public static void main(String[] args) throws IOException { BufferedReader br = new ...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
fb5a5d0eea2adbbc0863fa9819132a8e
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class a { public static LinkedList<Integer>ll[]; public static int count=0; public static int vertices[]; public static void main(String[] args) { Scanner s=new Scanner(System.in); ...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
a603d9aace6a9736a5800c39f61d00ff
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import com.sun.org.apache.xalan.internal.xsltc.trax.XSLTCSource; import org.omg.CORBA.INTERNAL; import java.awt.*; import java.io.*; import java.lang.reflect.Array; import java.util.*; import java.util.List; public class AA implements Runnable { static int mod9=1000000007; public void run() { InputRea...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
52dd32f659304c17f781c1dff249c0ed
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
/* @author : Abhimanyu Chauhan */ import java.util.*; import java.io.*; public class TaskB implements Runnable{ static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; priv...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
09063aadc66f91ac9d1a2e3ee3d0c9bd
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.util.Scanner; public class CF292B { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); int[] degs = new int[n]; for (int i = 0; i < 2*m; ++i) degs[in.nextInt()-1]++; int[] cnts = new int[4]; for (int i = 0; i < n; ++i) {...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
c10de68f8936ba88d6b2d6a641ca8ece
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int degrees[] = new int[100000+5]; int n = sc.nextInt(); int m = sc.nextInt(); int deg1 = 0; int deg2 = 0; int degn1 = 0; for(int i = 0; i < m; i++){ int a = sc.nextInt(); int...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
aa493fba2fe69585ded1b9d70067456d
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
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 { static ArrayList<Integer> [] a; static boolean[] visited; static int l=0,c=-1; public static void ma...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
4e0b64f81e569b3c37eb78b35b2b8a04
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.util.Scanner; import java.util.ArrayList; import java.util.Arrays; public class Main{ static class Node{ int e; ArrayList<Integer> arr; public Node(int entry){ e = entry; arr = new ArrayList<Integer>(); } public void add(int elem){ arr.add(elem); } public int getL(){ int...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
2e9166dbb6394aba6f54c66219c6f7f2
train_002.jsonl
1366040100
This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them are...
256 megabytes
import java.util.Scanner; import java.util.Arrays; public class CF292B{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int[] nodeMention = new int[n]; for(int i = 0; i < m; i++){ nodeMention[sc.nextInt()-1]++; nodeMention[sc.nex...
Java
["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4"]
2 seconds
["bus topology", "ring topology", "star topology", "unknown topology"]
null
Java 8
standard input
[ "implementation", "graphs" ]
7bb088ce5e4e2101221c706ff87841e4
The first line contains two space-separated integers n and m (4 ≀ n ≀ 105;Β 3 ≀ m ≀ 105) β€” the number of nodes and edges in the graph, correspondingly. Next m lines contain the description of the graph's edges. The i-th line contains a space-separated pair of integers xi, yi (1 ≀ xi, yi ≀ n) β€” the numbers of nodes that ...
1,200
In a single line print the network topology name of the given graph. If the answer is the bus, print "bus topology" (without the quotes), if the answer is the ring, print "ring topology" (without the quotes), if the answer is the star, print "star topology" (without the quotes). If no answer fits, print "unknown topolo...
standard output
PASSED
3674f4f2407bf2b6af12a22bdc83e5ac
train_002.jsonl
1599230100
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Codechef { static PrintWriter out=new PrintWriter(System.out);static FastScanner in = new FastScanner(System.in);static class FastScanner {BufferedReader br;StringTokenizer stok;FastScanner(InputStream is) {br = new BufferedReader(new InputStr...
Java
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
1 second
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
null
Java 11
standard input
[ "number theory", "brute force", "math" ]
ca9d97e731e86cf8223520f39ef5d945
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) β€” the length of the array and two elements ...
1,200
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
standard output
PASSED
be94d5c58f17ecaa1abb903df548888d
train_002.jsonl
1599230100
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; import java.awt.*; public class Main { static long sx = 0, sy = 0, mod = (long) (1e9 + 7); static HashSet<Integer>[] a; static Long[][][] dp; static long[] fa; static long[] farr; public static PrintWriter out = new PrintWriter(System.out); s...
Java
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
1 second
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
null
Java 11
standard input
[ "number theory", "brute force", "math" ]
ca9d97e731e86cf8223520f39ef5d945
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) β€” the length of the array and two elements ...
1,200
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
standard output
PASSED
7685e17e9a7193e9d47aceb8cb29f55f
train_002.jsonl
1599230100
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; public class ArrRest { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(Syst...
Java
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
1 second
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
null
Java 11
standard input
[ "number theory", "brute force", "math" ]
ca9d97e731e86cf8223520f39ef5d945
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) β€” the length of the array and two elements ...
1,200
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
standard output
PASSED
4c5011c1488cbfd8e105aef97b78f3f3
train_002.jsonl
1599230100
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
256 megabytes
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 B { public static void main (String[] args) throws java.lang.Exception { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); StringBuilder sb = new StringBuilder()...
Java
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
1 second
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
null
Java 11
standard input
[ "number theory", "brute force", "math" ]
ca9d97e731e86cf8223520f39ef5d945
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) β€” the length of the array and two elements ...
1,200
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
standard output
PASSED
4e6c7c3fcc99b4c77d28bfc9b9299247
train_002.jsonl
1599230100
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class C { public static void main(String[] args) { FastScanner sc = new FastScanner(); int t = sc.nextInt(); for(int tt= 0 ; tt < t ;tt++) { int n = sc.nextInt() , x = sc.nextInt() , y = ...
Java
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
1 second
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
null
Java 11
standard input
[ "number theory", "brute force", "math" ]
ca9d97e731e86cf8223520f39ef5d945
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) β€” the length of the array and two elements ...
1,200
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
standard output
PASSED
4dca35e7c4478c15eae0b3edccca4d3a
train_002.jsonl
1599230100
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
256 megabytes
import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; public class Main { static final int INF = (int) (1e9 + 10); static final int MOD = (int) (1e9 + 7); // static final int N = (int) (4e5 + 5); // static ArrayList<Integer>[] graph; // static boolean visited[]; // st...
Java
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
1 second
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
null
Java 11
standard input
[ "number theory", "brute force", "math" ]
ca9d97e731e86cf8223520f39ef5d945
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) β€” the length of the array and two elements ...
1,200
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
standard output
PASSED
4605c414428b261be00e2834a3ee60ab
train_002.jsonl
1599230100
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main{ public static void main(String[] args) { FastScanner fs=new FastScanner(); int t=fs.nextInt(); for(int tt=0;tt<t;tt++) { int ...
Java
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
1 second
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
null
Java 11
standard input
[ "number theory", "brute force", "math" ]
ca9d97e731e86cf8223520f39ef5d945
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) β€” the length of the array and two elements ...
1,200
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
standard output
PASSED
68f8fc7386778e92db7ad7cbfc1f86d3
train_002.jsonl
1599230100
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
256 megabytes
import java.util.*; public class c667 { public static void main (String[] args){ Scanner sc = new Scanner(System.in); int T = sc.nextInt(); while (T --> 0){ int N = sc.nextInt(); int X = sc.nextInt(); int Y = sc.nextInt(); for (int i = 1; i...
Java
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
1 second
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
null
Java 11
standard input
[ "number theory", "brute force", "math" ]
ca9d97e731e86cf8223520f39ef5d945
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) β€” the length of the array and two elements ...
1,200
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
standard output
PASSED
5d49bbc58c3a953b68dc8c511f5bfe41
train_002.jsonl
1416733800
Peter wrote on the board a strictly increasing sequence of positive integers a1, a2, ..., an. Then Vasil replaced some digits in the numbers of this sequence by question marks. Thus, each question mark corresponds to exactly one lost digit.Restore the the original sequence knowing digits remaining on the board.
256 megabytes
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class E279 { static class Unknown { private char[] digits; private int finalval...
Java
["3\n?\n18\n1?", "2\n??\n?", "5\n12224\n12??5\n12226\n?0000\n?00000"]
1 second
["YES\n1\n18\n19", "NO", "YES\n12224\n12225\n12226\n20000\n100000"]
null
Java 7
standard input
[ "binary search", "implementation", "greedy", "brute force" ]
7e0ba313c557cb6b61ba57559e73a2bb
The first line of the input contains integer n (1 ≀ n ≀ 105) β€” the length of the sequence. Next n lines contain one element of the sequence each. Each element consists only of digits and question marks. No element starts from digit 0. Each element has length from 1 to 8 characters, inclusive.
2,000
If the answer exists, print in the first line "YES" (without the quotes). Next n lines must contain the sequence of positive integers β€” a possible variant of Peter's sequence. The found sequence must be strictly increasing, it must be transformed from the given one by replacing each question mark by a single digit. All...
standard output
PASSED
865cbc0de6aaa4a837cce318de131a2c
train_002.jsonl
1416733800
Peter wrote on the board a strictly increasing sequence of positive integers a1, a2, ..., an. Then Vasil replaced some digits in the numbers of this sequence by question marks. Thus, each question mark corresponds to exactly one lost digit.Restore the the original sequence knowing digits remaining on the board.
256 megabytes
//package round279; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class E { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(); cha...
Java
["3\n?\n18\n1?", "2\n??\n?", "5\n12224\n12??5\n12226\n?0000\n?00000"]
1 second
["YES\n1\n18\n19", "NO", "YES\n12224\n12225\n12226\n20000\n100000"]
null
Java 7
standard input
[ "binary search", "implementation", "greedy", "brute force" ]
7e0ba313c557cb6b61ba57559e73a2bb
The first line of the input contains integer n (1 ≀ n ≀ 105) β€” the length of the sequence. Next n lines contain one element of the sequence each. Each element consists only of digits and question marks. No element starts from digit 0. Each element has length from 1 to 8 characters, inclusive.
2,000
If the answer exists, print in the first line "YES" (without the quotes). Next n lines must contain the sequence of positive integers β€” a possible variant of Peter's sequence. The found sequence must be strictly increasing, it must be transformed from the given one by replacing each question mark by a single digit. All...
standard output
PASSED
3919d8e9060d85ed4ccfc1112e4728da
train_002.jsonl
1416733800
Peter wrote on the board a strictly increasing sequence of positive integers a1, a2, ..., an. Then Vasil replaced some digits in the numbers of this sequence by question marks. Thus, each question mark corresponds to exactly one lost digit.Restore the the original sequence knowing digits remaining on the board.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; public class E { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new Print...
Java
["3\n?\n18\n1?", "2\n??\n?", "5\n12224\n12??5\n12226\n?0000\n?00000"]
1 second
["YES\n1\n18\n19", "NO", "YES\n12224\n12225\n12226\n20000\n100000"]
null
Java 7
standard input
[ "binary search", "implementation", "greedy", "brute force" ]
7e0ba313c557cb6b61ba57559e73a2bb
The first line of the input contains integer n (1 ≀ n ≀ 105) β€” the length of the sequence. Next n lines contain one element of the sequence each. Each element consists only of digits and question marks. No element starts from digit 0. Each element has length from 1 to 8 characters, inclusive.
2,000
If the answer exists, print in the first line "YES" (without the quotes). Next n lines must contain the sequence of positive integers β€” a possible variant of Peter's sequence. The found sequence must be strictly increasing, it must be transformed from the given one by replacing each question mark by a single digit. All...
standard output
PASSED
a60f7d6b9dec18e39a18e9eb5ed82517
train_002.jsonl
1416733800
Peter wrote on the board a strictly increasing sequence of positive integers a1, a2, ..., an. Then Vasil replaced some digits in the numbers of this sequence by question marks. Thus, each question mark corresponds to exactly one lost digit.Restore the the original sequence knowing digits remaining on the board.
256 megabytes
import java.util.Scanner; import java.io.OutputStream; import java.io.IOException; import java.io.PrintWriter; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author thnkndblv */ public class Main { public static void main(String[] args) { InputStream in...
Java
["3\n?\n18\n1?", "2\n??\n?", "5\n12224\n12??5\n12226\n?0000\n?00000"]
1 second
["YES\n1\n18\n19", "NO", "YES\n12224\n12225\n12226\n20000\n100000"]
null
Java 7
standard input
[ "binary search", "implementation", "greedy", "brute force" ]
7e0ba313c557cb6b61ba57559e73a2bb
The first line of the input contains integer n (1 ≀ n ≀ 105) β€” the length of the sequence. Next n lines contain one element of the sequence each. Each element consists only of digits and question marks. No element starts from digit 0. Each element has length from 1 to 8 characters, inclusive.
2,000
If the answer exists, print in the first line "YES" (without the quotes). Next n lines must contain the sequence of positive integers β€” a possible variant of Peter's sequence. The found sequence must be strictly increasing, it must be transformed from the given one by replacing each question mark by a single digit. All...
standard output
PASSED
437e5803393cd4e6b4a70a6c2d2395a7
train_002.jsonl
1416733800
Peter wrote on the board a strictly increasing sequence of positive integers a1, a2, ..., an. Then Vasil replaced some digits in the numbers of this sequence by question marks. Thus, each question mark corresponds to exactly one lost digit.Restore the the original sequence knowing digits remaining on the board.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class ESolver { private static InputReader in; private static PrintWriter out; public static void main(String[] args) thro...
Java
["3\n?\n18\n1?", "2\n??\n?", "5\n12224\n12??5\n12226\n?0000\n?00000"]
1 second
["YES\n1\n18\n19", "NO", "YES\n12224\n12225\n12226\n20000\n100000"]
null
Java 7
standard input
[ "binary search", "implementation", "greedy", "brute force" ]
7e0ba313c557cb6b61ba57559e73a2bb
The first line of the input contains integer n (1 ≀ n ≀ 105) β€” the length of the sequence. Next n lines contain one element of the sequence each. Each element consists only of digits and question marks. No element starts from digit 0. Each element has length from 1 to 8 characters, inclusive.
2,000
If the answer exists, print in the first line "YES" (without the quotes). Next n lines must contain the sequence of positive integers β€” a possible variant of Peter's sequence. The found sequence must be strictly increasing, it must be transformed from the given one by replacing each question mark by a single digit. All...
standard output
PASSED
0723930a35ab71ae7efc0197dd9ba8ec
train_002.jsonl
1416733800
Peter wrote on the board a strictly increasing sequence of positive integers a1, a2, ..., an. Then Vasil replaced some digits in the numbers of this sequence by question marks. Thus, each question mark corresponds to exactly one lost digit.Restore the the original sequence knowing digits remaining on the board.
256 megabytes
import java.io.*; import java.util.*; public class restincseq { private static BufferedReader in; private static PrintWriter out; public static void main(String[] args) throws IOException { in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out, true); int N = In...
Java
["3\n?\n18\n1?", "2\n??\n?", "5\n12224\n12??5\n12226\n?0000\n?00000"]
1 second
["YES\n1\n18\n19", "NO", "YES\n12224\n12225\n12226\n20000\n100000"]
null
Java 7
standard input
[ "binary search", "implementation", "greedy", "brute force" ]
7e0ba313c557cb6b61ba57559e73a2bb
The first line of the input contains integer n (1 ≀ n ≀ 105) β€” the length of the sequence. Next n lines contain one element of the sequence each. Each element consists only of digits and question marks. No element starts from digit 0. Each element has length from 1 to 8 characters, inclusive.
2,000
If the answer exists, print in the first line "YES" (without the quotes). Next n lines must contain the sequence of positive integers β€” a possible variant of Peter's sequence. The found sequence must be strictly increasing, it must be transformed from the given one by replacing each question mark by a single digit. All...
standard output
PASSED
2686098b8e80bca9319219bc99f72aab
train_002.jsonl
1416733800
Peter wrote on the board a strictly increasing sequence of positive integers a1, a2, ..., an. Then Vasil replaced some digits in the numbers of this sequence by question marks. Thus, each question mark corresponds to exactly one lost digit.Restore the the original sequence knowing digits remaining on the board.
256 megabytes
import java.io.*; import java.util.*; public class Main { // main public static void main(String [] args) throws IOException { // makes the reader and writer BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));...
Java
["3\n?\n18\n1?", "2\n??\n?", "5\n12224\n12??5\n12226\n?0000\n?00000"]
1 second
["YES\n1\n18\n19", "NO", "YES\n12224\n12225\n12226\n20000\n100000"]
null
Java 7
standard input
[ "binary search", "implementation", "greedy", "brute force" ]
7e0ba313c557cb6b61ba57559e73a2bb
The first line of the input contains integer n (1 ≀ n ≀ 105) β€” the length of the sequence. Next n lines contain one element of the sequence each. Each element consists only of digits and question marks. No element starts from digit 0. Each element has length from 1 to 8 characters, inclusive.
2,000
If the answer exists, print in the first line "YES" (without the quotes). Next n lines must contain the sequence of positive integers β€” a possible variant of Peter's sequence. The found sequence must be strictly increasing, it must be transformed from the given one by replacing each question mark by a single digit. All...
standard output
PASSED
fe6e35b581107ad16cfbfe0fd10b93b3
train_002.jsonl
1416733800
Peter wrote on the board a strictly increasing sequence of positive integers a1, a2, ..., an. Then Vasil replaced some digits in the numbers of this sequence by question marks. Thus, each question mark corresponds to exactly one lost digit.Restore the the original sequence knowing digits remaining on the board.
256 megabytes
import java.util.Scanner; public class E { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); int[][] ans = new int[n][]; String[] v = new String[n]; int[][] vi = new int[n][]; for (int i = 0; i < v.length; i++) { v[i] = sc.nextLine()...
Java
["3\n?\n18\n1?", "2\n??\n?", "5\n12224\n12??5\n12226\n?0000\n?00000"]
1 second
["YES\n1\n18\n19", "NO", "YES\n12224\n12225\n12226\n20000\n100000"]
null
Java 7
standard input
[ "binary search", "implementation", "greedy", "brute force" ]
7e0ba313c557cb6b61ba57559e73a2bb
The first line of the input contains integer n (1 ≀ n ≀ 105) β€” the length of the sequence. Next n lines contain one element of the sequence each. Each element consists only of digits and question marks. No element starts from digit 0. Each element has length from 1 to 8 characters, inclusive.
2,000
If the answer exists, print in the first line "YES" (without the quotes). Next n lines must contain the sequence of positive integers β€” a possible variant of Peter's sequence. The found sequence must be strictly increasing, it must be transformed from the given one by replacing each question mark by a single digit. All...
standard output
PASSED
18e4e9dab1350d3d092c21bdbf2211b6
train_002.jsonl
1416733800
Peter wrote on the board a strictly increasing sequence of positive integers a1, a2, ..., an. Then Vasil replaced some digits in the numbers of this sequence by question marks. Thus, each question mark corresponds to exactly one lost digit.Restore the the original sequence knowing digits remaining on the board.
256 megabytes
import java.util.*; import java.io.*; public class Main { int MAXN=100*1000+100; int []numbers = new int[MAXN]; public String getStringNumber(String str, int number) { char []prev=Integer.toString(number).toCharArray(); char []cur=str.toCharArray(); if (prev.length>cur.length)...
Java
["3\n?\n18\n1?", "2\n??\n?", "5\n12224\n12??5\n12226\n?0000\n?00000"]
1 second
["YES\n1\n18\n19", "NO", "YES\n12224\n12225\n12226\n20000\n100000"]
null
Java 7
standard input
[ "binary search", "implementation", "greedy", "brute force" ]
7e0ba313c557cb6b61ba57559e73a2bb
The first line of the input contains integer n (1 ≀ n ≀ 105) β€” the length of the sequence. Next n lines contain one element of the sequence each. Each element consists only of digits and question marks. No element starts from digit 0. Each element has length from 1 to 8 characters, inclusive.
2,000
If the answer exists, print in the first line "YES" (without the quotes). Next n lines must contain the sequence of positive integers β€” a possible variant of Peter's sequence. The found sequence must be strictly increasing, it must be transformed from the given one by replacing each question mark by a single digit. All...
standard output
PASSED
caa6e433cf76a354eb012a6a68eaed8a
train_002.jsonl
1416733800
Peter wrote on the board a strictly increasing sequence of positive integers a1, a2, ..., an. Then Vasil replaced some digits in the numbers of this sequence by question marks. Thus, each question mark corresponds to exactly one lost digit.Restore the the original sequence knowing digits remaining on the board.
256 megabytes
import java.io.BufferedInputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Deque; import java.util.HashMap; import java.util.HashSet; import java...
Java
["3\n?\n18\n1?", "2\n??\n?", "5\n12224\n12??5\n12226\n?0000\n?00000"]
1 second
["YES\n1\n18\n19", "NO", "YES\n12224\n12225\n12226\n20000\n100000"]
null
Java 7
standard input
[ "binary search", "implementation", "greedy", "brute force" ]
7e0ba313c557cb6b61ba57559e73a2bb
The first line of the input contains integer n (1 ≀ n ≀ 105) β€” the length of the sequence. Next n lines contain one element of the sequence each. Each element consists only of digits and question marks. No element starts from digit 0. Each element has length from 1 to 8 characters, inclusive.
2,000
If the answer exists, print in the first line "YES" (without the quotes). Next n lines must contain the sequence of positive integers β€” a possible variant of Peter's sequence. The found sequence must be strictly increasing, it must be transformed from the given one by replacing each question mark by a single digit. All...
standard output
PASSED
f8e7da65def2ed9ebce53b9c58de593f
train_002.jsonl
1408116600
Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Scanner; import java.util.StringTokenizer; public class PashmakAndGraph { static class FastReader { BufferedReader br; StringTokenizer st; public ...
Java
["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"]
1 second
["1", "3", "6"]
NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is .
Java 8
standard input
[ "dp", "sortings" ]
bac276604d67fa573b61075c1024865a
The first line contains two integers n, m (2 ≀ n ≀ 3Β·105;Β 1 ≀ m ≀ min(nΒ·(n - 1), 3Β·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≀ ui, vi ≀ n;Β 1 ≀ wi ≀ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ...
1,900
Print a single integer β€” the answer to the problem.
standard output
PASSED
719f9bb5781c4ddd6bdff144ab9475e0
train_002.jsonl
1408116600
Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Scanner; import java.util.StringTokenizer; public class PashmakAndGraph { static class FastReader { BufferedReader br; StringTokenizer st; public...
Java
["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"]
1 second
["1", "3", "6"]
NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is .
Java 8
standard input
[ "dp", "sortings" ]
bac276604d67fa573b61075c1024865a
The first line contains two integers n, m (2 ≀ n ≀ 3Β·105;Β 1 ≀ m ≀ min(nΒ·(n - 1), 3Β·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≀ ui, vi ≀ n;Β 1 ≀ wi ≀ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ...
1,900
Print a single integer β€” the answer to the problem.
standard output
PASSED
1cdfbc9e6f1d5ba8334a93e904afeec7
train_002.jsonl
1408116600
Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap...
256 megabytes
import java.lang.*; import java.math.*; import java.util.*; import java.io.*; public class Main { class Node implements Comparable<Node>{ int u; int v; int w; public Node(int u,int v,int w){ this.u=u; this.v=v; this.w=w; } public int compareTo(Node c){ int t=Inte...
Java
["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"]
1 second
["1", "3", "6"]
NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is .
Java 8
standard input
[ "dp", "sortings" ]
bac276604d67fa573b61075c1024865a
The first line contains two integers n, m (2 ≀ n ≀ 3Β·105;Β 1 ≀ m ≀ min(nΒ·(n - 1), 3Β·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≀ ui, vi ≀ n;Β 1 ≀ wi ≀ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ...
1,900
Print a single integer β€” the answer to the problem.
standard output
PASSED
9d6c0d5ffb0610794fbdce137102a59a
train_002.jsonl
1408116600
Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; public class PashmakAndGraph { private static InputReader in; private static PrintWriter out; public static void main(String[] args) { new PashmakAndGraph()....
Java
["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"]
1 second
["1", "3", "6"]
NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is .
Java 8
standard input
[ "dp", "sortings" ]
bac276604d67fa573b61075c1024865a
The first line contains two integers n, m (2 ≀ n ≀ 3Β·105;Β 1 ≀ m ≀ min(nΒ·(n - 1), 3Β·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≀ ui, vi ≀ n;Β 1 ≀ wi ≀ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ...
1,900
Print a single integer β€” the answer to the problem.
standard output
PASSED
9616a0cf495253ed57cadfb0836a328c
train_002.jsonl
1408116600
Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; public class PashmakAndGraph { private static InputReader in; private static PrintWriter out; public static void main(String[] args) { new PashmakAndGraph()....
Java
["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"]
1 second
["1", "3", "6"]
NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is .
Java 8
standard input
[ "dp", "sortings" ]
bac276604d67fa573b61075c1024865a
The first line contains two integers n, m (2 ≀ n ≀ 3Β·105;Β 1 ≀ m ≀ min(nΒ·(n - 1), 3Β·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≀ ui, vi ≀ n;Β 1 ≀ wi ≀ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ...
1,900
Print a single integer β€” the answer to the problem.
standard output
PASSED
984c52a1ee31ef29e6212027cc093194
train_002.jsonl
1408116600
Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap...
256 megabytes
import java.awt.*; import java.awt.event.*; import java.awt.geom.*; import java.io.*; import java.math.*; import java.text.*; import java.util.*; import static java.lang.Math.min; import static java.lang.Math.max; /* br = new BufferedReader(new FileReader("input.txt")); pw = new PrintWriter(new BufferedWriter(new Fil...
Java
["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"]
1 second
["1", "3", "6"]
NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is .
Java 6
standard input
[ "dp", "sortings" ]
bac276604d67fa573b61075c1024865a
The first line contains two integers n, m (2 ≀ n ≀ 3Β·105;Β 1 ≀ m ≀ min(nΒ·(n - 1), 3Β·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≀ ui, vi ≀ n;Β 1 ≀ wi ≀ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ...
1,900
Print a single integer β€” the answer to the problem.
standard output
PASSED
f821cdf21c45375bc7fa72e66840f268
train_002.jsonl
1408116600
Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap...
256 megabytes
import java.awt.image.ImageConsumer; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import j...
Java
["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"]
1 second
["1", "3", "6"]
NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is .
Java 6
standard input
[ "dp", "sortings" ]
bac276604d67fa573b61075c1024865a
The first line contains two integers n, m (2 ≀ n ≀ 3Β·105;Β 1 ≀ m ≀ min(nΒ·(n - 1), 3Β·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≀ ui, vi ≀ n;Β 1 ≀ wi ≀ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ...
1,900
Print a single integer β€” the answer to the problem.
standard output
PASSED
576497f822f4c704509f759933494a76
train_002.jsonl
1408116600
Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap...
256 megabytes
//package current; import java.io.*; import java.util.Scanner; import java.util.Arrays; import java.util.StringTokenizer; import java.util.Vector; /** * Built using CHelper plug-in * Actual solution is at the top * @author zxybazh */ public class Main { public static void main(String[] args) { OutputSt...
Java
["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"]
1 second
["1", "3", "6"]
NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is .
Java 6
standard input
[ "dp", "sortings" ]
bac276604d67fa573b61075c1024865a
The first line contains two integers n, m (2 ≀ n ≀ 3Β·105;Β 1 ≀ m ≀ min(nΒ·(n - 1), 3Β·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≀ ui, vi ≀ n;Β 1 ≀ wi ≀ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ...
1,900
Print a single integer β€” the answer to the problem.
standard output
PASSED
62bbc0fc0a4cf91a357df7de6868dfdb
train_002.jsonl
1408116600
Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap...
256 megabytes
import java.util.Arrays; import java.util.ArrayList; import java.io.InputStream; import java.io.InputStreamReader; import java.util.List; import java.io.BufferedReader; import java.math.BigInteger; import java.io.PrintStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Collections; import ...
Java
["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"]
1 second
["1", "3", "6"]
NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is .
Java 6
standard input
[ "dp", "sortings" ]
bac276604d67fa573b61075c1024865a
The first line contains two integers n, m (2 ≀ n ≀ 3Β·105;Β 1 ≀ m ≀ min(nΒ·(n - 1), 3Β·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≀ ui, vi ≀ n;Β 1 ≀ wi ≀ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ...
1,900
Print a single integer β€” the answer to the problem.
standard output
PASSED
e19f3ffb9986ab758ba4676d225dc493
train_002.jsonl
1408116600
Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap...
256 megabytes
import java.util.Arrays; import java.util.ArrayList; import java.io.InputStream; import java.io.InputStreamReader; import java.util.List; import java.io.BufferedReader; import java.math.BigInteger; import java.io.PrintStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Collections; import ...
Java
["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"]
1 second
["1", "3", "6"]
NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is .
Java 6
standard input
[ "dp", "sortings" ]
bac276604d67fa573b61075c1024865a
The first line contains two integers n, m (2 ≀ n ≀ 3Β·105;Β 1 ≀ m ≀ min(nΒ·(n - 1), 3Β·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≀ ui, vi ≀ n;Β 1 ≀ wi ≀ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ...
1,900
Print a single integer β€” the answer to the problem.
standard output
PASSED
93a4e44d6c1a99e678ff2b6f2a1ee46c
train_002.jsonl
1321337400
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with each other. Specifically, each string ties together two students. Besides, if two students are tied, then the lace connects the f...
256 megabytes
import java.io.*; import java.util.*; public class Main { BufferedReader br; StringTokenizer in; PrintWriter out; public static void main(String[] args) { new Main().run(); } public void run() { try { br = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["3 3\n1 2\n2 3\n3 1", "6 3\n1 2\n2 3\n3 4", "6 5\n1 4\n2 4\n3 4\n5 4\n6 4"]
2 seconds
["0", "2", "1"]
NoteIn the first sample Anna and Maria won't kick out any group of students β€” in the initial position every student is tied to two other students and Anna won't be able to reprimand anyone.In the second sample four students are tied in a chain and two more are running by themselves. First Anna and Maria kick out the tw...
Java 7
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f8315dc903b0542c453cab4577bcb20d
The first line contains two integers n and m β€” the initial number of students and laces (). The students are numbered from 1 to n, and the laces are numbered from 1 to m. Next m lines each contain two integers a and b β€” the numbers of students tied by the i-th lace (1 ≀ a, b ≀ n, a ≠ b). It is guaranteed that no two st...
1,200
Print the single number β€” the number of groups of students that will be kicked out from the club.
standard output
PASSED
ccdc0ffe1778f9d400e887aa3e20ec3c
train_002.jsonl
1321337400
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with each other. Specifically, each string ties together two students. Besides, if two students are tied, then the lace connects the f...
256 megabytes
import java.util.*; public class fence { // static {System.out.println("hello"); } public static void main(String args[]) { Scanner scn=new Scanner(System.in); int n=scn.nextInt(); ArrayList<Integer> ar[]=new ArrayList[n+1]; int deg[]=new int[n+1]; int lace=scn.nextInt(); for(int i=1;i<...
Java
["3 3\n1 2\n2 3\n3 1", "6 3\n1 2\n2 3\n3 4", "6 5\n1 4\n2 4\n3 4\n5 4\n6 4"]
2 seconds
["0", "2", "1"]
NoteIn the first sample Anna and Maria won't kick out any group of students β€” in the initial position every student is tied to two other students and Anna won't be able to reprimand anyone.In the second sample four students are tied in a chain and two more are running by themselves. First Anna and Maria kick out the tw...
Java 7
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f8315dc903b0542c453cab4577bcb20d
The first line contains two integers n and m β€” the initial number of students and laces (). The students are numbered from 1 to n, and the laces are numbered from 1 to m. Next m lines each contain two integers a and b β€” the numbers of students tied by the i-th lace (1 ≀ a, b ≀ n, a ≠ b). It is guaranteed that no two st...
1,200
Print the single number β€” the number of groups of students that will be kicked out from the club.
standard output
PASSED
98967168835570d7b6c7be97c3670761
train_002.jsonl
1321337400
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with each other. Specifically, each string ties together two students. Besides, if two students are tied, then the lace connects the f...
256 megabytes
import java.io.*; import java.util.*; public class Main { static BufferedReader br; static PrintWriter out; static StringTokenizer st; static class Pair{ int x; int y; Pair(int x, int y){ this.x = x; this.y = y; } } static void solve...
Java
["3 3\n1 2\n2 3\n3 1", "6 3\n1 2\n2 3\n3 4", "6 5\n1 4\n2 4\n3 4\n5 4\n6 4"]
2 seconds
["0", "2", "1"]
NoteIn the first sample Anna and Maria won't kick out any group of students β€” in the initial position every student is tied to two other students and Anna won't be able to reprimand anyone.In the second sample four students are tied in a chain and two more are running by themselves. First Anna and Maria kick out the tw...
Java 7
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f8315dc903b0542c453cab4577bcb20d
The first line contains two integers n and m β€” the initial number of students and laces (). The students are numbered from 1 to n, and the laces are numbered from 1 to m. Next m lines each contain two integers a and b β€” the numbers of students tied by the i-th lace (1 ≀ a, b ≀ n, a ≠ b). It is guaranteed that no two st...
1,200
Print the single number β€” the number of groups of students that will be kicked out from the club.
standard output
PASSED
600dbb82fe2a75f00bf72d942ec0db52
train_002.jsonl
1321337400
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with each other. Specifically, each string ties together two students. Besides, if two students are tied, then the lace connects the f...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Main { static BufferedReader in; static PrintWriter out; static StringTokenizer tok; static void solve() throws Exception { int n = nextInt(); int m = nextInt(); boolean[][] a = new boolean[n+1][n+1]; for (int k = 0; k < m; k++) { ...
Java
["3 3\n1 2\n2 3\n3 1", "6 3\n1 2\n2 3\n3 4", "6 5\n1 4\n2 4\n3 4\n5 4\n6 4"]
2 seconds
["0", "2", "1"]
NoteIn the first sample Anna and Maria won't kick out any group of students β€” in the initial position every student is tied to two other students and Anna won't be able to reprimand anyone.In the second sample four students are tied in a chain and two more are running by themselves. First Anna and Maria kick out the tw...
Java 7
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f8315dc903b0542c453cab4577bcb20d
The first line contains two integers n and m β€” the initial number of students and laces (). The students are numbered from 1 to n, and the laces are numbered from 1 to m. Next m lines each contain two integers a and b β€” the numbers of students tied by the i-th lace (1 ≀ a, b ≀ n, a ≠ b). It is guaranteed that no two st...
1,200
Print the single number β€” the number of groups of students that will be kicked out from the club.
standard output
PASSED
fe6289fbf6a169034f1c925507992646
train_002.jsonl
1321337400
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with each other. Specifically, each string ties together two students. Besides, if two students are tied, then the lace connects the f...
256 megabytes
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ //package pkg129b; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Scanner; /** * * @author Admin */ public class Main { /** * @param args the command line arguments */ p...
Java
["3 3\n1 2\n2 3\n3 1", "6 3\n1 2\n2 3\n3 4", "6 5\n1 4\n2 4\n3 4\n5 4\n6 4"]
2 seconds
["0", "2", "1"]
NoteIn the first sample Anna and Maria won't kick out any group of students β€” in the initial position every student is tied to two other students and Anna won't be able to reprimand anyone.In the second sample four students are tied in a chain and two more are running by themselves. First Anna and Maria kick out the tw...
Java 7
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f8315dc903b0542c453cab4577bcb20d
The first line contains two integers n and m β€” the initial number of students and laces (). The students are numbered from 1 to n, and the laces are numbered from 1 to m. Next m lines each contain two integers a and b β€” the numbers of students tied by the i-th lace (1 ≀ a, b ≀ n, a ≠ b). It is guaranteed that no two st...
1,200
Print the single number β€” the number of groups of students that will be kicked out from the club.
standard output
PASSED
92cb882ac5e1eeb063b6f6694ebc752d
train_002.jsonl
1321337400
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with each other. Specifically, each string ties together two students. Besides, if two students are tied, then the lace connects the f...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.HashSet; import java.util.StringTokenizer; public class Main { private stati...
Java
["3 3\n1 2\n2 3\n3 1", "6 3\n1 2\n2 3\n3 4", "6 5\n1 4\n2 4\n3 4\n5 4\n6 4"]
2 seconds
["0", "2", "1"]
NoteIn the first sample Anna and Maria won't kick out any group of students β€” in the initial position every student is tied to two other students and Anna won't be able to reprimand anyone.In the second sample four students are tied in a chain and two more are running by themselves. First Anna and Maria kick out the tw...
Java 7
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f8315dc903b0542c453cab4577bcb20d
The first line contains two integers n and m β€” the initial number of students and laces (). The students are numbered from 1 to n, and the laces are numbered from 1 to m. Next m lines each contain two integers a and b β€” the numbers of students tied by the i-th lace (1 ≀ a, b ≀ n, a ≠ b). It is guaranteed that no two st...
1,200
Print the single number β€” the number of groups of students that will be kicked out from the club.
standard output
PASSED
2e635f3d2a6690cd4f593e55f99f8be1
train_002.jsonl
1321337400
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with each other. Specifically, each string ties together two students. Besides, if two students are tied, then the lace connects the f...
256 megabytes
import java.io.InputStream; import java.io.OutputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.IOException; import java.io.PrintWriter; import java.util.Collections; import java.util.StringTokenizer; public class Task { public static void main(String args[]){ InputStream i...
Java
["3 3\n1 2\n2 3\n3 1", "6 3\n1 2\n2 3\n3 4", "6 5\n1 4\n2 4\n3 4\n5 4\n6 4"]
2 seconds
["0", "2", "1"]
NoteIn the first sample Anna and Maria won't kick out any group of students β€” in the initial position every student is tied to two other students and Anna won't be able to reprimand anyone.In the second sample four students are tied in a chain and two more are running by themselves. First Anna and Maria kick out the tw...
Java 7
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f8315dc903b0542c453cab4577bcb20d
The first line contains two integers n and m β€” the initial number of students and laces (). The students are numbered from 1 to n, and the laces are numbered from 1 to m. Next m lines each contain two integers a and b β€” the numbers of students tied by the i-th lace (1 ≀ a, b ≀ n, a ≠ b). It is guaranteed that no two st...
1,200
Print the single number β€” the number of groups of students that will be kicked out from the club.
standard output
PASSED
f2442ad246320ee8dda559254c27bf14
train_002.jsonl
1321337400
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with each other. Specifically, each string ties together two students. Besides, if two students are tied, then the lace connects the f...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; import java.util.Map.Entry; public class Main { public static void main(String[] args) throws IOException { (new Main()).solve(); } public Main() { } MyReader in = new MyReader(); PrintWriter out = new PrintWriter(System.out); void solve(...
Java
["3 3\n1 2\n2 3\n3 1", "6 3\n1 2\n2 3\n3 4", "6 5\n1 4\n2 4\n3 4\n5 4\n6 4"]
2 seconds
["0", "2", "1"]
NoteIn the first sample Anna and Maria won't kick out any group of students β€” in the initial position every student is tied to two other students and Anna won't be able to reprimand anyone.In the second sample four students are tied in a chain and two more are running by themselves. First Anna and Maria kick out the tw...
Java 7
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f8315dc903b0542c453cab4577bcb20d
The first line contains two integers n and m β€” the initial number of students and laces (). The students are numbered from 1 to n, and the laces are numbered from 1 to m. Next m lines each contain two integers a and b β€” the numbers of students tied by the i-th lace (1 ≀ a, b ≀ n, a ≠ b). It is guaranteed that no two st...
1,200
Print the single number β€” the number of groups of students that will be kicked out from the club.
standard output
PASSED
913c2ac37078ea8266b19ec6a02af6f6
train_002.jsonl
1321337400
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with each other. Specifically, each string ties together two students. Besides, if two students are tied, then the lace connects the f...
256 megabytes
import java.io.BufferedOutputStream; 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.HashSet; import java.util.List; import java.util.StringTokenizer; public class Main { ...
Java
["3 3\n1 2\n2 3\n3 1", "6 3\n1 2\n2 3\n3 4", "6 5\n1 4\n2 4\n3 4\n5 4\n6 4"]
2 seconds
["0", "2", "1"]
NoteIn the first sample Anna and Maria won't kick out any group of students β€” in the initial position every student is tied to two other students and Anna won't be able to reprimand anyone.In the second sample four students are tied in a chain and two more are running by themselves. First Anna and Maria kick out the tw...
Java 7
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f8315dc903b0542c453cab4577bcb20d
The first line contains two integers n and m β€” the initial number of students and laces (). The students are numbered from 1 to n, and the laces are numbered from 1 to m. Next m lines each contain two integers a and b β€” the numbers of students tied by the i-th lace (1 ≀ a, b ≀ n, a ≠ b). It is guaranteed that no two st...
1,200
Print the single number β€” the number of groups of students that will be kicked out from the club.
standard output
PASSED
6e69690dd2d8ddf8e987208ff0225ac0
train_002.jsonl
1321337400
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with each other. Specifically, each string ties together two students. Besides, if two students are tied, then the lace connects the f...
256 megabytes
import java.io.BufferedInputStream; import java.io.IOException; import java.io.PrintWriter; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.InputMismatchEx...
Java
["3 3\n1 2\n2 3\n3 1", "6 3\n1 2\n2 3\n3 4", "6 5\n1 4\n2 4\n3 4\n5 4\n6 4"]
2 seconds
["0", "2", "1"]
NoteIn the first sample Anna and Maria won't kick out any group of students β€” in the initial position every student is tied to two other students and Anna won't be able to reprimand anyone.In the second sample four students are tied in a chain and two more are running by themselves. First Anna and Maria kick out the tw...
Java 7
standard input
[ "implementation", "dfs and similar", "brute force", "graphs" ]
f8315dc903b0542c453cab4577bcb20d
The first line contains two integers n and m β€” the initial number of students and laces (). The students are numbered from 1 to n, and the laces are numbered from 1 to m. Next m lines each contain two integers a and b β€” the numbers of students tied by the i-th lace (1 ≀ a, b ≀ n, a ≠ b). It is guaranteed that no two st...
1,200
Print the single number β€” the number of groups of students that will be kicked out from the club.
standard output
PASSED
02a22844413751590e2db0aa39b8fbd2
train_002.jsonl
1295626200
According to Berland laws it is only allowed to sell alcohol to people not younger than 18 years. Vasya's job is to monitor the law's enforcement. Tonight he entered a bar and saw n people sitting there. For every one of them Vasya happened to determine either the age or the drink the person is having. Vasya can check ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Contest52_1 { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.pars...
Java
["5\n18\nVODKA\nCOKE\n19\n17"]
2 seconds
["2"]
NoteIn the sample test the second and fifth clients should be checked.
Java 6
standard input
[ "implementation" ]
4b7b0fba7b0af78c3956c34c29785e7c
The first line contains an integer n (1 ≀ n ≀ 100) which is the number of the bar's clients. Then follow n lines, each describing one visitor. A line either contains his age (an integer from 0 to 1000) or his drink (a string of capital Latin letters from 1 to 100 in length). It is guaranteed that the input data does no...
1,000
Print a single number which is the number of people Vasya should check to guarantee the law enforcement.
standard output
PASSED
771bf350d02899bf975ba4f216a0e4f2
train_002.jsonl
1295626200
According to Berland laws it is only allowed to sell alcohol to people not younger than 18 years. Vasya's job is to monitor the law's enforcement. Tonight he entered a bar and saw n people sitting there. For every one of them Vasya happened to determine either the age or the drink the person is having. Vasya can check ...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; public class BetaRound52_A implements Runnable { final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer(""); void init() throws IOException { i...
Java
["5\n18\nVODKA\nCOKE\n19\n17"]
2 seconds
["2"]
NoteIn the sample test the second and fifth clients should be checked.
Java 6
standard input
[ "implementation" ]
4b7b0fba7b0af78c3956c34c29785e7c
The first line contains an integer n (1 ≀ n ≀ 100) which is the number of the bar's clients. Then follow n lines, each describing one visitor. A line either contains his age (an integer from 0 to 1000) or his drink (a string of capital Latin letters from 1 to 100 in length). It is guaranteed that the input data does no...
1,000
Print a single number which is the number of people Vasya should check to guarantee the law enforcement.
standard output
PASSED
4812beccb0fded69b16c0277c6d3e40b
train_002.jsonl
1295626200
According to Berland laws it is only allowed to sell alcohol to people not younger than 18 years. Vasya's job is to monitor the law's enforcement. Tonight he entered a bar and saw n people sitting there. For every one of them Vasya happened to determine either the age or the drink the person is having. Vasya can check ...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; public class BetaRound52_A implements Runnable { final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer(""); void init() throws IOException { i...
Java
["5\n18\nVODKA\nCOKE\n19\n17"]
2 seconds
["2"]
NoteIn the sample test the second and fifth clients should be checked.
Java 6
standard input
[ "implementation" ]
4b7b0fba7b0af78c3956c34c29785e7c
The first line contains an integer n (1 ≀ n ≀ 100) which is the number of the bar's clients. Then follow n lines, each describing one visitor. A line either contains his age (an integer from 0 to 1000) or his drink (a string of capital Latin letters from 1 to 100 in length). It is guaranteed that the input data does no...
1,000
Print a single number which is the number of people Vasya should check to guarantee the law enforcement.
standard output