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
564e35e3228d595391005ec3ca84bbe5
train_001.jsonl
1361374200
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any black cell to any another black cell using a path of side-adjacent black cells changing his direction at most once during the pa...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class B { String line; StringTokenizer inputParser; BufferedReader is; FileInputStream fstream; DataInputStream in; String FInput=""; void openInput(String file) { ...
Java
["3 4\nWWBW\nBWWW\nWWWB", "3 1\nB\nB\nW"]
2 seconds
["NO", "YES"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
3631eba1b28fae473cf438bc2f0552b7
The first line of the input contains two integers n and m (1 ≤ n, m ≤ 50) — the size of the grid. Each of the next n lines contains m characters "B" or "W". Character "B" denotes a black cell of the grid and "W" denotes a white cell of the grid. It's guaranteed that the grid has at least one black cell.
1,700
On the only line of the output print "YES" if the grid is convex, otherwise print "NO". Do not print quotes.
standard output
PASSED
bf84d8d9693aef20ca66b21240866345
train_001.jsonl
1361374200
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any black cell to any another black cell using a path of side-adjacent black cells changing his direction at most once during the pa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.LinkedList; import java.util.Queue; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamR...
Java
["3 4\nWWBW\nBWWW\nWWWB", "3 1\nB\nB\nW"]
2 seconds
["NO", "YES"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
3631eba1b28fae473cf438bc2f0552b7
The first line of the input contains two integers n and m (1 ≤ n, m ≤ 50) — the size of the grid. Each of the next n lines contains m characters "B" or "W". Character "B" denotes a black cell of the grid and "W" denotes a white cell of the grid. It's guaranteed that the grid has at least one black cell.
1,700
On the only line of the output print "YES" if the grid is convex, otherwise print "NO". Do not print quotes.
standard output
PASSED
0f0a9557ba7c2fed364463adace271d1
train_001.jsonl
1361374200
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any black cell to any another black cell using a path of side-adjacent black cells changing his direction at most once during the pa...
256 megabytes
import java.util.*; import java.util.regex.*; import static java.lang.Math.*; import static java.util.Arrays.*; import static java.lang.Integer.*; import static java.lang.Double.*; import static java.util.Collections.*; import java.io.*; public class _B { int di[] = { 0, 0, -1, 1 }; int dj[] = { -1, 1, 0, 0 }; ...
Java
["3 4\nWWBW\nBWWW\nWWWB", "3 1\nB\nB\nW"]
2 seconds
["NO", "YES"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
3631eba1b28fae473cf438bc2f0552b7
The first line of the input contains two integers n and m (1 ≤ n, m ≤ 50) — the size of the grid. Each of the next n lines contains m characters "B" or "W". Character "B" denotes a black cell of the grid and "W" denotes a white cell of the grid. It's guaranteed that the grid has at least one black cell.
1,700
On the only line of the output print "YES" if the grid is convex, otherwise print "NO". Do not print quotes.
standard output
PASSED
2879977a255b7feb0bf697d601547209
train_001.jsonl
1361374200
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any black cell to any another black cell using a path of side-adjacent black cells changing his direction at most once during the pa...
256 megabytes
import java.util.Scanner; public class Convex { public static void main (String[] args) { Scanner s = new Scanner(System.in); String line = s.nextLine(); Scanner linescan = new Scanner(line); int n = linescan.nextInt(); int m = linescan.nextInt(); char[][] grid = new char[n][m]; for (int i = 0; i <...
Java
["3 4\nWWBW\nBWWW\nWWWB", "3 1\nB\nB\nW"]
2 seconds
["NO", "YES"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
3631eba1b28fae473cf438bc2f0552b7
The first line of the input contains two integers n and m (1 ≤ n, m ≤ 50) — the size of the grid. Each of the next n lines contains m characters "B" or "W". Character "B" denotes a black cell of the grid and "W" denotes a white cell of the grid. It's guaranteed that the grid has at least one black cell.
1,700
On the only line of the output print "YES" if the grid is convex, otherwise print "NO". Do not print quotes.
standard output
PASSED
180ab7a3b48142b7e34d22b015c99687
train_001.jsonl
1361374200
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any black cell to any another black cell using a path of side-adjacent black cells changing his direction at most once during the pa...
256 megabytes
import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintStream; /** * @author Ivan Pryvalov (ivan.pryvalov@gma...
Java
["3 4\nWWBW\nBWWW\nWWWB", "3 1\nB\nB\nW"]
2 seconds
["NO", "YES"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
3631eba1b28fae473cf438bc2f0552b7
The first line of the input contains two integers n and m (1 ≤ n, m ≤ 50) — the size of the grid. Each of the next n lines contains m characters "B" or "W". Character "B" denotes a black cell of the grid and "W" denotes a white cell of the grid. It's guaranteed that the grid has at least one black cell.
1,700
On the only line of the output print "YES" if the grid is convex, otherwise print "NO". Do not print quotes.
standard output
PASSED
eb865d56a01b50c3bfec0234b49dc6f4
train_001.jsonl
1361374200
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any black cell to any another black cell using a path of side-adjacent black cells changing his direction at most once during the pa...
256 megabytes
import java.util.*; import java.util.Map.Entry; import java.io.*; import java.awt.Point; import java.math.BigInteger; import static java.lang.Math.*; public class Codeforces_Solutions implements Runnable{ final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; BufferedReader in; ...
Java
["3 4\nWWBW\nBWWW\nWWWB", "3 1\nB\nB\nW"]
2 seconds
["NO", "YES"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
3631eba1b28fae473cf438bc2f0552b7
The first line of the input contains two integers n and m (1 ≤ n, m ≤ 50) — the size of the grid. Each of the next n lines contains m characters "B" or "W". Character "B" denotes a black cell of the grid and "W" denotes a white cell of the grid. It's guaranteed that the grid has at least one black cell.
1,700
On the only line of the output print "YES" if the grid is convex, otherwise print "NO". Do not print quotes.
standard output
PASSED
ba2c3572eeec0bea8b4f8cf1be30c261
train_001.jsonl
1361374200
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any black cell to any another black cell using a path of side-adjacent black cells changing his direction at most once during the pa...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class B275 { /** * @param args */ public static void main(String[] args)throws IOException,FileNotFoundException { ...
Java
["3 4\nWWBW\nBWWW\nWWWB", "3 1\nB\nB\nW"]
2 seconds
["NO", "YES"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
3631eba1b28fae473cf438bc2f0552b7
The first line of the input contains two integers n and m (1 ≤ n, m ≤ 50) — the size of the grid. Each of the next n lines contains m characters "B" or "W". Character "B" denotes a black cell of the grid and "W" denotes a white cell of the grid. It's guaranteed that the grid has at least one black cell.
1,700
On the only line of the output print "YES" if the grid is convex, otherwise print "NO". Do not print quotes.
standard output
PASSED
488bc96b59105d0d8b6a2c10dc416445
train_001.jsonl
1361374200
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any black cell to any another black cell using a path of side-adjacent black cells changing his direction at most once during the pa...
256 megabytes
import java.util.*; public class Main { static char[][] grid; static boolean[][] area; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); grid = new char[n][m]; area = new boolean[n][m]; fo...
Java
["3 4\nWWBW\nBWWW\nWWWB", "3 1\nB\nB\nW"]
2 seconds
["NO", "YES"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
3631eba1b28fae473cf438bc2f0552b7
The first line of the input contains two integers n and m (1 ≤ n, m ≤ 50) — the size of the grid. Each of the next n lines contains m characters "B" or "W". Character "B" denotes a black cell of the grid and "W" denotes a white cell of the grid. It's guaranteed that the grid has at least one black cell.
1,700
On the only line of the output print "YES" if the grid is convex, otherwise print "NO". Do not print quotes.
standard output
PASSED
e0d2f07c917767b8f564bb4f2566950f
train_001.jsonl
1361374200
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any black cell to any another black cell using a path of side-adjacent black cells changing his direction at most once during the pa...
256 megabytes
import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; import java.util.TreeMap; public class B { static final int MAX = 3000000; static int[] ary = new int[MAX]; static int[][] field; static int[][] field0; static boolean[][] bfield; static final int[][] DIR = {{-1, 0}, {1, 0}, {0, -1}, ...
Java
["3 4\nWWBW\nBWWW\nWWWB", "3 1\nB\nB\nW"]
2 seconds
["NO", "YES"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
3631eba1b28fae473cf438bc2f0552b7
The first line of the input contains two integers n and m (1 ≤ n, m ≤ 50) — the size of the grid. Each of the next n lines contains m characters "B" or "W". Character "B" denotes a black cell of the grid and "W" denotes a white cell of the grid. It's guaranteed that the grid has at least one black cell.
1,700
On the only line of the output print "YES" if the grid is convex, otherwise print "NO". Do not print quotes.
standard output
PASSED
4302e5987ef58d9e42143ba66f6c635d
train_001.jsonl
1361374200
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any black cell to any another black cell using a path of side-adjacent black cells changing his direction at most once during the pa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import static java.lang.Integer.*; import static java.lang.System.out; import static java.lang.Math.*; public class Main { static boolean[][] grid; static boolean[][] seen; static int m,n; public static void main(String[]...
Java
["3 4\nWWBW\nBWWW\nWWWB", "3 1\nB\nB\nW"]
2 seconds
["NO", "YES"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
3631eba1b28fae473cf438bc2f0552b7
The first line of the input contains two integers n and m (1 ≤ n, m ≤ 50) — the size of the grid. Each of the next n lines contains m characters "B" or "W". Character "B" denotes a black cell of the grid and "W" denotes a white cell of the grid. It's guaranteed that the grid has at least one black cell.
1,700
On the only line of the output print "YES" if the grid is convex, otherwise print "NO". Do not print quotes.
standard output
PASSED
bf865a47a4decb0bd3c8d64ad4a467ef
train_001.jsonl
1361374200
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any black cell to any another black cell using a path of side-adjacent black cells changing his direction at most once during the pa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import static java.lang.Integer.*; import static java.lang.System.out; import static java.lang.Math.*; public class Main { static boolean[][] grid; static int m,n; public static void main(String[] args) throws IOException ...
Java
["3 4\nWWBW\nBWWW\nWWWB", "3 1\nB\nB\nW"]
2 seconds
["NO", "YES"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
3631eba1b28fae473cf438bc2f0552b7
The first line of the input contains two integers n and m (1 ≤ n, m ≤ 50) — the size of the grid. Each of the next n lines contains m characters "B" or "W". Character "B" denotes a black cell of the grid and "W" denotes a white cell of the grid. It's guaranteed that the grid has at least one black cell.
1,700
On the only line of the output print "YES" if the grid is convex, otherwise print "NO". Do not print quotes.
standard output
PASSED
1402caca82c0c18749ad39da9a90e510
train_001.jsonl
1361374200
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any black cell to any another black cell using a path of side-adjacent black cells changing his direction at most once during the pa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import static java.lang.Integer.*; import static java.lang.System.out; import static java.lang.Math.*; public class Main { static boolean[][] grid; static int m,n; public static void main(String[] args) throws IOException ...
Java
["3 4\nWWBW\nBWWW\nWWWB", "3 1\nB\nB\nW"]
2 seconds
["NO", "YES"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
3631eba1b28fae473cf438bc2f0552b7
The first line of the input contains two integers n and m (1 ≤ n, m ≤ 50) — the size of the grid. Each of the next n lines contains m characters "B" or "W". Character "B" denotes a black cell of the grid and "W" denotes a white cell of the grid. It's guaranteed that the grid has at least one black cell.
1,700
On the only line of the output print "YES" if the grid is convex, otherwise print "NO". Do not print quotes.
standard output
PASSED
bf9974c15efebb72e2b99a8f9fdf79fb
train_001.jsonl
1361374200
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any black cell to any another black cell using a path of side-adjacent black cells changing his direction at most once during the pa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class B { static boolean[][] black; static int[][] b; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new Inp...
Java
["3 4\nWWBW\nBWWW\nWWWB", "3 1\nB\nB\nW"]
2 seconds
["NO", "YES"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
3631eba1b28fae473cf438bc2f0552b7
The first line of the input contains two integers n and m (1 ≤ n, m ≤ 50) — the size of the grid. Each of the next n lines contains m characters "B" or "W". Character "B" denotes a black cell of the grid and "W" denotes a white cell of the grid. It's guaranteed that the grid has at least one black cell.
1,700
On the only line of the output print "YES" if the grid is convex, otherwise print "NO". Do not print quotes.
standard output
PASSED
c6de12ff5e3b46a694be9b6d3a9a5d48
train_001.jsonl
1361374200
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any black cell to any another black cell using a path of side-adjacent black cells changing his direction at most once during the pa...
256 megabytes
import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; public class B { static int[][] ch; static int a; static int b; public static void main(String[] args) { Scanner in = new Scanner(System.in); a = in.nextInt(); b = in.nextInt(); char[][] m...
Java
["3 4\nWWBW\nBWWW\nWWWB", "3 1\nB\nB\nW"]
2 seconds
["NO", "YES"]
null
Java 6
standard input
[ "constructive algorithms", "implementation" ]
3631eba1b28fae473cf438bc2f0552b7
The first line of the input contains two integers n and m (1 ≤ n, m ≤ 50) — the size of the grid. Each of the next n lines contains m characters "B" or "W". Character "B" denotes a black cell of the grid and "W" denotes a white cell of the grid. It's guaranteed that the grid has at least one black cell.
1,700
On the only line of the output print "YES" if the grid is convex, otherwise print "NO". Do not print quotes.
standard output
PASSED
c09eda87a0df1dc21a2f17bde5bb4bb9
train_001.jsonl
1494171900
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Abc{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int bef[]=new int[n]; int aft[]=new int[n]; for (int i=0;i<n;i++){ bef[i]=sc.nextInt(); ...
Java
["6\n3060 3060\n2194 2194\n2876 2903\n2624 2624\n3007 2991\n2884 2884", "4\n1500 1500\n1300 1300\n1200 1200\n1400 1400", "5\n3123 3123\n2777 2777\n2246 2246\n2246 2246\n1699 1699"]
2 seconds
["rated", "unrated", "maybe"]
NoteIn the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, s...
Java 8
standard input
[ "implementation", "sortings" ]
88686e870bd3bfbf45a9b6b19e5ec68a
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the...
900
If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".
standard output
PASSED
cb3058769462aab230b9ec809cd576db
train_001.jsonl
1494171900
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
256 megabytes
/** * @author uglypish * Problem: Is It Rated? * Description: Code forces has conducted another challenge round. Two participants will be compared by their scores if it is rated, unrated or impossible to rate. The scores will be known from top to bottom of their standings. */ import java.util.Scanner; ...
Java
["6\n3060 3060\n2194 2194\n2876 2903\n2624 2624\n3007 2991\n2884 2884", "4\n1500 1500\n1300 1300\n1200 1200\n1400 1400", "5\n3123 3123\n2777 2777\n2246 2246\n2246 2246\n1699 1699"]
2 seconds
["rated", "unrated", "maybe"]
NoteIn the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, s...
Java 8
standard input
[ "implementation", "sortings" ]
88686e870bd3bfbf45a9b6b19e5ec68a
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the...
900
If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".
standard output
PASSED
ccd9980c1221dd2ffba6a27bc97cb28d
train_001.jsonl
1494171900
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
256 megabytes
public class Main { public static void main(String[] args) { java.util.Scanner sc = new java.util.Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; int[] b = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); b[i] = sc.nextInt...
Java
["6\n3060 3060\n2194 2194\n2876 2903\n2624 2624\n3007 2991\n2884 2884", "4\n1500 1500\n1300 1300\n1200 1200\n1400 1400", "5\n3123 3123\n2777 2777\n2246 2246\n2246 2246\n1699 1699"]
2 seconds
["rated", "unrated", "maybe"]
NoteIn the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, s...
Java 8
standard input
[ "implementation", "sortings" ]
88686e870bd3bfbf45a9b6b19e5ec68a
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the...
900
If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".
standard output
PASSED
21bb6d6243a145c40952312df8d611f8
train_001.jsonl
1494171900
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
256 megabytes
import java.util.*; public class Solution { static Scanner sc = new Scanner(System.in); public static void main(String args[]) { int size = sc.nextInt(); int pf = sc.nextInt(); int ps = sc.nextInt(); int c = 0; if (pf - ps != 0) { System.out.println("rate...
Java
["6\n3060 3060\n2194 2194\n2876 2903\n2624 2624\n3007 2991\n2884 2884", "4\n1500 1500\n1300 1300\n1200 1200\n1400 1400", "5\n3123 3123\n2777 2777\n2246 2246\n2246 2246\n1699 1699"]
2 seconds
["rated", "unrated", "maybe"]
NoteIn the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, s...
Java 8
standard input
[ "implementation", "sortings" ]
88686e870bd3bfbf45a9b6b19e5ec68a
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the...
900
If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".
standard output
PASSED
8cc2e368ea8af4fb9bee96bb383fd0aa
train_001.jsonl
1494171900
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
256 megabytes
import java.util.*; public class CODE { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int n = sc.nextInt(); int n1 = sc.nextInt(); int n2 = sc.nextInt(); boolean flag = false; for (int i = 1; i < n; i++) { if (n1 -...
Java
["6\n3060 3060\n2194 2194\n2876 2903\n2624 2624\n3007 2991\n2884 2884", "4\n1500 1500\n1300 1300\n1200 1200\n1400 1400", "5\n3123 3123\n2777 2777\n2246 2246\n2246 2246\n1699 1699"]
2 seconds
["rated", "unrated", "maybe"]
NoteIn the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, s...
Java 8
standard input
[ "implementation", "sortings" ]
88686e870bd3bfbf45a9b6b19e5ec68a
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the...
900
If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".
standard output
PASSED
c0e5f314f81f3b2b1257f10fc0e5e7eb
train_001.jsonl
1494171900
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
256 megabytes
import java.util.Scanner; import java.lang.Math; public class knk { public static void main(String[] args) { Scanner in = new Scanner(System.in) ; int n = in.nextInt() ; int [] a = new int[n] ; int [] b = new int[n] ; for(int i = 0 ;i<n;i++) { a[i] = in.nextInt() ; b[i] = in.nextInt() ; if(a[i] != b...
Java
["6\n3060 3060\n2194 2194\n2876 2903\n2624 2624\n3007 2991\n2884 2884", "4\n1500 1500\n1300 1300\n1200 1200\n1400 1400", "5\n3123 3123\n2777 2777\n2246 2246\n2246 2246\n1699 1699"]
2 seconds
["rated", "unrated", "maybe"]
NoteIn the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, s...
Java 8
standard input
[ "implementation", "sortings" ]
88686e870bd3bfbf45a9b6b19e5ec68a
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the...
900
If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".
standard output
PASSED
011f2506ed330af7c44ef66d3322ae52
train_001.jsonl
1494171900
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
256 megabytes
import java.io.*; import java.util.*; public class Task { static final StdIn in = new StdIn(); static final PrintWriter out = new PrintWriter(System.out); public static void main(String[] args) { // int t = in.nextInt(); int n = in.nextInt(); //rating notequals = rated //rating equals and rating order :...
Java
["6\n3060 3060\n2194 2194\n2876 2903\n2624 2624\n3007 2991\n2884 2884", "4\n1500 1500\n1300 1300\n1200 1200\n1400 1400", "5\n3123 3123\n2777 2777\n2246 2246\n2246 2246\n1699 1699"]
2 seconds
["rated", "unrated", "maybe"]
NoteIn the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, s...
Java 8
standard input
[ "implementation", "sortings" ]
88686e870bd3bfbf45a9b6b19e5ec68a
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the...
900
If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".
standard output
PASSED
80f5404f5faabea06526b9023bf44f73
train_001.jsonl
1494171900
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
256 megabytes
import java.io.*; import java.util.*; public class Isitrated { public static void main(String[]args) { Scanner sc = new Scanner(System.in); int counter = 0; int n = sc.nextInt(); PrintWriter r = new PrintWriter(System.out); int []a = new int[n*2]; int i =0; int j =0; String s =""; while(n > j){ int x = sc.nextInt(); in...
Java
["6\n3060 3060\n2194 2194\n2876 2903\n2624 2624\n3007 2991\n2884 2884", "4\n1500 1500\n1300 1300\n1200 1200\n1400 1400", "5\n3123 3123\n2777 2777\n2246 2246\n2246 2246\n1699 1699"]
2 seconds
["rated", "unrated", "maybe"]
NoteIn the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, s...
Java 8
standard input
[ "implementation", "sortings" ]
88686e870bd3bfbf45a9b6b19e5ec68a
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the...
900
If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".
standard output
PASSED
c2b97b601edd45cc68036c6cf8afa7cb
train_001.jsonl
1494171900
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { static int[] befor, after; static int n; public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer tk...
Java
["6\n3060 3060\n2194 2194\n2876 2903\n2624 2624\n3007 2991\n2884 2884", "4\n1500 1500\n1300 1300\n1200 1200\n1400 1400", "5\n3123 3123\n2777 2777\n2246 2246\n2246 2246\n1699 1699"]
2 seconds
["rated", "unrated", "maybe"]
NoteIn the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, s...
Java 8
standard input
[ "implementation", "sortings" ]
88686e870bd3bfbf45a9b6b19e5ec68a
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the...
900
If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".
standard output
PASSED
c106c4eec2ba4a879a1d6d7d2f90c632
train_001.jsonl
1494171900
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
256 megabytes
import java.io.*; import java.util.*; public class Problems1 { public static void main(String[] args) throws IOException { FastScanner sc=new FastScanner(System.in); int n=sc.nextInt(); int x,y; int p=1000000000; boolean f=false; for(int i=0;i<n;i++){ x=sc.nextInt();...
Java
["6\n3060 3060\n2194 2194\n2876 2903\n2624 2624\n3007 2991\n2884 2884", "4\n1500 1500\n1300 1300\n1200 1200\n1400 1400", "5\n3123 3123\n2777 2777\n2246 2246\n2246 2246\n1699 1699"]
2 seconds
["rated", "unrated", "maybe"]
NoteIn the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, s...
Java 8
standard input
[ "implementation", "sortings" ]
88686e870bd3bfbf45a9b6b19e5ec68a
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the...
900
If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".
standard output
PASSED
bba421dde5624f71ee625cd97153e673
train_001.jsonl
1494171900
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
256 megabytes
import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; public class JavaApplication35 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); PrintWriter out=new PrintWriter(new OutputS...
Java
["6\n3060 3060\n2194 2194\n2876 2903\n2624 2624\n3007 2991\n2884 2884", "4\n1500 1500\n1300 1300\n1200 1200\n1400 1400", "5\n3123 3123\n2777 2777\n2246 2246\n2246 2246\n1699 1699"]
2 seconds
["rated", "unrated", "maybe"]
NoteIn the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, s...
Java 8
standard input
[ "implementation", "sortings" ]
88686e870bd3bfbf45a9b6b19e5ec68a
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the...
900
If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".
standard output
PASSED
5d6fb8796732ab753fb80464f87cf829
train_001.jsonl
1494171900
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
256 megabytes
import java.io.*; import java.util.*; public class Problems1 { public static void main(String[] args) throws IOException { FastScanner sc=new FastScanner(System.in); int n=sc.nextInt(); int x,y; int p=1000000000; boolean f=false; for(int i=0;i<n;i++){ x=sc.nextInt(); ...
Java
["6\n3060 3060\n2194 2194\n2876 2903\n2624 2624\n3007 2991\n2884 2884", "4\n1500 1500\n1300 1300\n1200 1200\n1400 1400", "5\n3123 3123\n2777 2777\n2246 2246\n2246 2246\n1699 1699"]
2 seconds
["rated", "unrated", "maybe"]
NoteIn the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, s...
Java 8
standard input
[ "implementation", "sortings" ]
88686e870bd3bfbf45a9b6b19e5ec68a
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the...
900
If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".
standard output
PASSED
9f6282cc9b50216777ca488e9ac58fc2
train_001.jsonl
1494171900
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
256 megabytes
import java.util.*; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class isitrated { // better solution for less steps pu...
Java
["6\n3060 3060\n2194 2194\n2876 2903\n2624 2624\n3007 2991\n2884 2884", "4\n1500 1500\n1300 1300\n1200 1200\n1400 1400", "5\n3123 3123\n2777 2777\n2246 2246\n2246 2246\n1699 1699"]
2 seconds
["rated", "unrated", "maybe"]
NoteIn the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, s...
Java 8
standard input
[ "implementation", "sortings" ]
88686e870bd3bfbf45a9b6b19e5ec68a
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the...
900
If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".
standard output
PASSED
0f092ec6dc94f00c5e612e2b03131e0b
train_001.jsonl
1494171900
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
256 megabytes
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n + 1]; int[] b = new int[n + 1]; for(int i = 0; i < n; i++){ int a1 = sc.nextInt()...
Java
["6\n3060 3060\n2194 2194\n2876 2903\n2624 2624\n3007 2991\n2884 2884", "4\n1500 1500\n1300 1300\n1200 1200\n1400 1400", "5\n3123 3123\n2777 2777\n2246 2246\n2246 2246\n1699 1699"]
2 seconds
["rated", "unrated", "maybe"]
NoteIn the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, s...
Java 8
standard input
[ "implementation", "sortings" ]
88686e870bd3bfbf45a9b6b19e5ec68a
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the...
900
If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".
standard output
PASSED
7bdf668b9fd39358bf89e2d0d058188f
train_001.jsonl
1494171900
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.Stack; public class Main { public static void main(String[] args) throws IOException { int t = 1; Scanner sc = new Scanner(Syste...
Java
["6\n3060 3060\n2194 2194\n2876 2903\n2624 2624\n3007 2991\n2884 2884", "4\n1500 1500\n1300 1300\n1200 1200\n1400 1400", "5\n3123 3123\n2777 2777\n2246 2246\n2246 2246\n1699 1699"]
2 seconds
["rated", "unrated", "maybe"]
NoteIn the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, s...
Java 8
standard input
[ "implementation", "sortings" ]
88686e870bd3bfbf45a9b6b19e5ec68a
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the...
900
If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".
standard output
PASSED
49481291f1dbce5c4391b971197c8377
train_001.jsonl
1494171900
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
256 megabytes
import java.util.Scanner; import java.util.Arrays; public class Main { public static void main(String args[]) { Scanner scanner = new Scanner(System.in); int x; x = scanner.nextInt(); boolean f = true, f1 = true; int[][] arr = new int[x][2]; int[] arr1 = new int[x]; for (int i = 0; i < x; ++i) { ar...
Java
["6\n3060 3060\n2194 2194\n2876 2903\n2624 2624\n3007 2991\n2884 2884", "4\n1500 1500\n1300 1300\n1200 1200\n1400 1400", "5\n3123 3123\n2777 2777\n2246 2246\n2246 2246\n1699 1699"]
2 seconds
["rated", "unrated", "maybe"]
NoteIn the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, s...
Java 8
standard input
[ "implementation", "sortings" ]
88686e870bd3bfbf45a9b6b19e5ec68a
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the...
900
If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".
standard output
PASSED
97732fe2c65adc12f22dd46835ebf17c
train_001.jsonl
1494171900
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
256 megabytes
import java.util.Arrays; import java.util.Collections; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int a[] = new int[n]; Integer j[] = new Integer[n]; for(int i ...
Java
["6\n3060 3060\n2194 2194\n2876 2903\n2624 2624\n3007 2991\n2884 2884", "4\n1500 1500\n1300 1300\n1200 1200\n1400 1400", "5\n3123 3123\n2777 2777\n2246 2246\n2246 2246\n1699 1699"]
2 seconds
["rated", "unrated", "maybe"]
NoteIn the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, s...
Java 8
standard input
[ "implementation", "sortings" ]
88686e870bd3bfbf45a9b6b19e5ec68a
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the...
900
If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".
standard output
PASSED
023695ae29e9388c646d3826e265cdbf
train_001.jsonl
1494171900
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
256 megabytes
import java.util.*; public class apples{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int i=0; int x=1; double temp=99e80; boolean flag=true; boolean car=true; boolean cops=true; while(n!=0) { int a=sc.nextInt(); int b=sc.nextInt(); if(a==b...
Java
["6\n3060 3060\n2194 2194\n2876 2903\n2624 2624\n3007 2991\n2884 2884", "4\n1500 1500\n1300 1300\n1200 1200\n1400 1400", "5\n3123 3123\n2777 2777\n2246 2246\n2246 2246\n1699 1699"]
2 seconds
["rated", "unrated", "maybe"]
NoteIn the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, s...
Java 8
standard input
[ "implementation", "sortings" ]
88686e870bd3bfbf45a9b6b19e5ec68a
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the...
900
If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".
standard output
PASSED
de257170bcd2603b14b4fa7956bebd4c
train_001.jsonl
1494171900
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
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.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Scanner; //import java.io.Reader; //import java.math.BigDecimal; //imp...
Java
["6\n3060 3060\n2194 2194\n2876 2903\n2624 2624\n3007 2991\n2884 2884", "4\n1500 1500\n1300 1300\n1200 1200\n1400 1400", "5\n3123 3123\n2777 2777\n2246 2246\n2246 2246\n1699 1699"]
2 seconds
["rated", "unrated", "maybe"]
NoteIn the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, s...
Java 8
standard input
[ "implementation", "sortings" ]
88686e870bd3bfbf45a9b6b19e5ec68a
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the...
900
If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".
standard output
PASSED
1af82feb82c7c6daafbcb8cfbd4a1685
train_001.jsonl
1494171900
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
256 megabytes
import java.util.Scanner; public class isit { public static void main(String[] args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int []y=new int[n*2]; for(int i=0;i<y.length;i++){ y[i]=sc.nextInt(); } int c=0; boolean flag=true; for(int i=0;i<y.length-2;i+=2){ if(y[i]!=y[i+1]) c++...
Java
["6\n3060 3060\n2194 2194\n2876 2903\n2624 2624\n3007 2991\n2884 2884", "4\n1500 1500\n1300 1300\n1200 1200\n1400 1400", "5\n3123 3123\n2777 2777\n2246 2246\n2246 2246\n1699 1699"]
2 seconds
["rated", "unrated", "maybe"]
NoteIn the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, s...
Java 8
standard input
[ "implementation", "sortings" ]
88686e870bd3bfbf45a9b6b19e5ec68a
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the...
900
If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".
standard output
PASSED
6b9b228c62fb04fc99180ebf4ac057f7
train_001.jsonl
1494171900
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
256 megabytes
import java.io.BufferedReader; import java.io.PrintWriter; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { PrintWriter o...
Java
["6\n3060 3060\n2194 2194\n2876 2903\n2624 2624\n3007 2991\n2884 2884", "4\n1500 1500\n1300 1300\n1200 1200\n1400 1400", "5\n3123 3123\n2777 2777\n2246 2246\n2246 2246\n1699 1699"]
2 seconds
["rated", "unrated", "maybe"]
NoteIn the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, s...
Java 8
standard input
[ "implementation", "sortings" ]
88686e870bd3bfbf45a9b6b19e5ec68a
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the...
900
If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".
standard output
PASSED
f8db5280b78e67575293278b8277ceec
train_001.jsonl
1494171900
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { FastScanner fs=new FastScanner(); int n=fs.nextInt(); int flag=...
Java
["6\n3060 3060\n2194 2194\n2876 2903\n2624 2624\n3007 2991\n2884 2884", "4\n1500 1500\n1300 1300\n1200 1200\n1400 1400", "5\n3123 3123\n2777 2777\n2246 2246\n2246 2246\n1699 1699"]
2 seconds
["rated", "unrated", "maybe"]
NoteIn the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, s...
Java 8
standard input
[ "implementation", "sortings" ]
88686e870bd3bfbf45a9b6b19e5ec68a
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the...
900
If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".
standard output
PASSED
5aae6f037fee997ec64c4c5a80bbdaae
train_001.jsonl
1494171900
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
256 megabytes
import java.util.*; public class rated { public static void main (String args[]) { Scanner a=new Scanner(System.in); int x=a.nextInt(); boolean f=false; boolean g=true; int [] []y=new int [x][2]; for(int i=0;i<x;i++) for(int j=0;j<2;j++) y[i][j]=a.nextInt(); for(int k=0;k<x;k++) { for(int...
Java
["6\n3060 3060\n2194 2194\n2876 2903\n2624 2624\n3007 2991\n2884 2884", "4\n1500 1500\n1300 1300\n1200 1200\n1400 1400", "5\n3123 3123\n2777 2777\n2246 2246\n2246 2246\n1699 1699"]
2 seconds
["rated", "unrated", "maybe"]
NoteIn the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, s...
Java 8
standard input
[ "implementation", "sortings" ]
88686e870bd3bfbf45a9b6b19e5ec68a
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the...
900
If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".
standard output
PASSED
da966d433d2b2c7301fcf22c0b8ac60a
train_001.jsonl
1494171900
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
256 megabytes
import java.util.*; import java.io.*; import java.io.IOException; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; ...
Java
["6\n3060 3060\n2194 2194\n2876 2903\n2624 2624\n3007 2991\n2884 2884", "4\n1500 1500\n1300 1300\n1200 1200\n1400 1400", "5\n3123 3123\n2777 2777\n2246 2246\n2246 2246\n1699 1699"]
2 seconds
["rated", "unrated", "maybe"]
NoteIn the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, s...
Java 8
standard input
[ "implementation", "sortings" ]
88686e870bd3bfbf45a9b6b19e5ec68a
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the...
900
If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".
standard output
PASSED
8e34230ccab5c278049fc8665e5163f3
train_001.jsonl
1494171900
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
256 megabytes
import java.util.Scanner; public class aaaa { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[][] x= new int[2][n]; for(int j=0;j<n;j++) { for(int i=0;i<2;i++) { x[i][j] = sc.nextInt(); } } boolean r =false; boolean m =true; for(int j=0...
Java
["6\n3060 3060\n2194 2194\n2876 2903\n2624 2624\n3007 2991\n2884 2884", "4\n1500 1500\n1300 1300\n1200 1200\n1400 1400", "5\n3123 3123\n2777 2777\n2246 2246\n2246 2246\n1699 1699"]
2 seconds
["rated", "unrated", "maybe"]
NoteIn the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, s...
Java 8
standard input
[ "implementation", "sortings" ]
88686e870bd3bfbf45a9b6b19e5ec68a
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the...
900
If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".
standard output
PASSED
b45f6b7b712ef075b05ea48c113d78e6
train_001.jsonl
1494171900
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
256 megabytes
//author: Ala Abid import java.io.*; import java.util.*; public class A { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int n= Integer.parseInt(st...
Java
["6\n3060 3060\n2194 2194\n2876 2903\n2624 2624\n3007 2991\n2884 2884", "4\n1500 1500\n1300 1300\n1200 1200\n1400 1400", "5\n3123 3123\n2777 2777\n2246 2246\n2246 2246\n1699 1699"]
2 seconds
["rated", "unrated", "maybe"]
NoteIn the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, s...
Java 8
standard input
[ "implementation", "sortings" ]
88686e870bd3bfbf45a9b6b19e5ec68a
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the...
900
If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".
standard output
PASSED
d9cc87ad88e8e6bdf2b17464baecac7e
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
import java.io.*; import java.util.*; public class main { public static String getParity(long n){ String l="000000000000000000"; int c=17; while(c>=0){ long p=n%10; if(p%2==1){ if(c==17){ l=l.substring(0,17)+"1"; } else if(c==0){ l="1"+l.substring(0); } else l=l.substrin...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
0d8660c4ef42cd0414b97b26aa952c94
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.File; import java.io.FileNotFoundException; import java.util.TreeMap; import java.util.StringTokenize...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
e74bb93157e8226a26c2251af580dc4a
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.util.HashMap; import java.io.IOException; import java.io.InputStreamReader; import java.io.File; import java.io.FileNotFoundException; import java.util.StringTokenize...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
dfb7f7a8352a773951eb032200a272a8
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
/** * Created by mo on 9/14/16. */ import java.io.*; import java.util.*; public class C { public static void main(String[] args) { FastScanner sc = new FastScanner(); int n = sc.nextInt(); int[] freqs = new int[1 << 18]; StringBuilder sb = new StringBuilder(); for (int i =...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
2174be07d222a09d3c9f00f21e1e2c5e
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; public class SonyaandQueries { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStrea...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
a7cdc095afe7ed60244d5f7ac31d8c61
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashMap; import java.util.StringTokenizer; public class C { //IO static BufferedReader f; static PrintWriter out; static StringTokenizer st; final public static void main( ...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
b86bd12b226307b7503b2c02a89d0cac
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; import java.util.HashMap; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Swatantra */ public class Main { public static void main(String[] a...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
56bcba021aadd9f74e513f414794c31d
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Scanner; import java.util.StringTokenizer; /** * Created by Akshay on 12/4/17. */ public class Week_8_Codeforces_C { public static void main(String[] args) throws IOException{ ...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
3b8320f6d4e8ee8fc1415560d6e5964d
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
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.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
db979257cc2119587b13faf248ca77de
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
/* * Remember a 6.0 student can know more than a 10.0 student. * Grades don't determine intelligence, they test obedience. * I Never Give Up. * I will become Candidate Master. * I will defeat Saurabh Anand. * Skills are Cheap,Passion is Priceless. */ import java.util.*; import java.util.Map.Entry; import java.i...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
6958c9e31eb5acffb5ee9ae2224de845
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
import java.util.HashMap; import java.util.Scanner; public class C { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); HashMap<String, Integer> hm = new HashMap<>(); while (t-- > 0) { String q = scan.next(); if (q.equals("+")) { String s = scan....
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
bbbd963d465ec72509da848e21d06633
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
//package CodeForces.Round371; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashMap; import java.util.StringTokenizer; public class C714 { public static void main(String[] args) { ...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
43419505f55b3ab4e1a4d2ce29d1b6af
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; private final static Random rnd = new Random(); boolean checkIndex(int index, int size) { return (0 <= index && index < size); } String shablon...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
6431c8e2c651d1fd4ad8df0895a7b61a
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; import java.util.StringTokenizer; public class C371 { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new Inpu...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
b93c26e3352a034517e4a11f3efc626f
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.TreeMap; public class c { static class Trie { Trie[] child; int count; public Trie() { child = new Trie[2]; count = 0; } void add(String s) { Trie ro...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
e5c222c8f91a574a2f89bcbd9c2f4a45
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { Reader in = new Reader(System.in); PrintWriter out = new PrintWriter(System.out); new Main().run(in, out); out.close(); } public void run(Reader in, PrintWriter out) { ...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
8d59151a4699afa6373c9155892130b3
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
import java.util.*; import java.util.Arrays; import java.math.*; import java.io.*; /** * * @author Zach */ public class ACM { public static long simplify(long i){ long x = 2000000000; x*=1000000000; while(x>1){ while(i%(5*x)>=x){ i-=x; } x/=10; ...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
edbc22cf08566af3e2e2f86b7bfe962f
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
/* package whatever; // 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 Ideone { static int MOD = 1000000007; public static void main (String[] args) throws java.lang.Exception { // your code...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
588db2f1d37618d5eea5f8e6db409293
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
/* package whatever; // 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 Ideone { static int MOD = 1000000007; public static void main (String[] args) throws java.lang.Exception { // your code...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
e749325934d5669c5d333e0b35fb597b
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class SonyaAndQueries { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
be374b0ea94ed99244ec2473c2de0e09
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
/* * UMANG PANCHAL * DAIICT */ import java.util.*; import java.io.*; import java.math.*; import java.util.Comparator; public class Main { private static final Comparator<? super Integer> Comparator = null; static LinkedList<Integer> adj[]; static ArrayList<Integer> adj1[]; static int[] color,visited1; stati...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
a56c6b9f148d3c285c5c59ca7a88cf68
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
import org.omg.PortableInterceptor.INACTIVE; import java.io.*; import java.util.*; /** * Created by Алексей on 06/26/2016. */ import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.random; import static java.lang.Math.*; public class TriangleEasy { public static void...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
4414322295d7365b44fca80705484286
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
import org.omg.PortableInterceptor.INACTIVE; import java.io.*; import java.util.*; /** * Created by Алексей on 06/26/2016. */ import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.random; import static java.lang.Math.*; public class TriangleEasy { public static void...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
47fb92a88b07300ac523c3265d05ab52
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
import org.omg.PortableInterceptor.INACTIVE; import java.io.*; import java.util.*; /** * Created by Алексей on 06/26/2016. */ import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.random; import static java.lang.Math.*; public class TriangleEasy { public static void...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
9bc1e6c9a859ac16c37a54232bc88151
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
import java.util.*; /** * Created by Kafukaaa on 16/9/17. */ /* ����scanner.nextLine()ʱ����һ������Ч�ģ����� * */ public class SonyaAndQueries { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); String[] order = new String[t+1]; int[] answe...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
a76f404dd7abbc36618eccea37e8c37b
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; public class Main { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream d...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
953a343fb037338c4ae859673008726c
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
/** * Created by ankeet on 9/13/16. */ import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.PriorityQueue; import java.util.StringTokenizer; public class C714 { static FastReader in = null; static PrintWriter out = null; ...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
1c8399a07cfacfc7650c8e7c50a9d785
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
import java.util.*; import java.io.*; public class SonyaAndQueries { public static InputReader in; public static PrintWriter out; public static final int MOD = (int) (1e9 + 7); public static void main(String[] args) { in = new InputReader(System.in); out = new PrintWriter(System.out);...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
7ebe4d6b3482a3ce6f73421e69f336d2
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
import java.util.*; import java.io.*; public class SonyaAndQueries { public static InputReader in; public static PrintWriter out; public static final int MOD = (int) (1e9 + 7); public static void main(String[] args) { in = new InputReader(System.in); out = new PrintWriter(System.out);...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
4ad7cdf66e432588ca80b9674eb213a6
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
/** * Code Author Savaliya Sagar * DA-IICT */ import java.awt.image.ReplicateScaleFilter; import java.io.*; import java.math.*; import java.util.*; import javax.swing.RepaintManager; public class C714 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(); Pri...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
2e54d5de07531c0e03970b1575e59bfc
train_001.jsonl
1473784500
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of the following type:  +  ai — add non-negative integer ai to the multiset. Note, that she has a multiset, thus there may be many occurrenc...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Main{ public static final int mod = 1000003; public static void main(String[] args)throws IOException { // TODO Auto-generated method stub InputStream input = System.in; BufferedReader br = new BufferedReader(new InputStr...
Java
["12\n+ 1\n+ 241\n? 1\n+ 361\n- 241\n? 0101\n+ 101\n? 101\n- 101\n? 101\n+ 4000\n? 0", "4\n+ 200\n+ 200\n- 200\n? 0"]
1 second
["2\n1\n2\n1\n1", "1"]
NoteConsider the integers matching the patterns from the queries of the third type. Queries are numbered in the order they appear in the input. 1 and 241. 361. 101 and 361. 361. 4000.
Java 8
standard input
[ "data structures", "implementation" ]
0ca6c7ff6a2d110a8f4153717910378f
The first line of the input contains an integer t (1 ≤ t ≤ 100 000) — the number of operation Sonya has to perform. Next t lines provide the descriptions of the queries in order they appear in the input file. The i-th row starts with a character ci — the type of the corresponding operation. If ci is equal to '+' or '-'...
1,400
For each query of the third type print the number of integers matching the given pattern. Each integer is counted as many times, as it appears in the multiset at this moment of time.
standard output
PASSED
326eec9d4b6ab8e80ade2a2057a03cb5
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.HashSet; import java.util.Scanner; import java.util.Set; import java.util.Vector; public class cf { static final Scanner sc = new Scanner(System.in); static final int mod = (...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
97469238d2f307e07af5b15f4643974c
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { static long sx = 0, sy = 0, m = (long) (1e9 + 7); static ArrayList<pair>[] a; static int[][] dp; static long[] farr; static boolean b = true; // static HashMap<Long, Integer> hm = new HashMap<>(); static TreeMap<Integer, ...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
ec31ce9b265caf357c66ea9ef3b3c92a
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
/* *created by Kraken on 12-05-2020 at 16:42 */ //package com.kraken.cf.practice; import java.util.*; import java.io.*; public class C1325 { public static void main(String[] args) { FastReader sc = new FastReader(); int n = sc.nextInt(); int[] degree = new int[n + 1]; int[][] edges = new int[n - ...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
f0960b247deeef0cf994e186dbed5699
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
//package codeforces; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.StringTokenizer; import j...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
305910e615142ce27f44158fd98050f0
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int[] numberOfEdgesFrom = new int[n]; int[][] edges = new int[n - 1][2]; int u, v; for (int i = 0; i < n - 1; i...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
69502bf4e025741593758add4ff56d69
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.io.*; import java.util.*; public class cf1325_Div2_C { public static class Edge{ int val = -1; int pos = -1; int a; int b; public Edge(int x, int y, int p) { pos = p; a = x; b = y; } } public static void main(String[] args) throws IOException { FastScanner in = new F...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
b6a75aeea60a7cdffd6b6319d1071e2b
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.util.*; public class Solution { /*static ArrayList<Integer> ar[]; static boolean vis[]; static void dfs(int s) { vis[s]=true; c++; for(int j=0;j<ar[s].size();j++) { if(vis[ar[s].get(j)]==false) ...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
5b82d7dd1eaaf873a7c43cabdd539394
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
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.Map; import java.util.Scanner; import java.util.HashMap; import java.util.ArrayList; /** * Built using CHelper plug-in * Actual solution is at the top */ public cl...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
9dbde77aa3997cc56bbce5f4435489f7
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
//package CodeforcesProject; import java.io.*; import java.lang.*; import java.util.*; import java.util.function.BiFunction; public class Main extends IO { static Set<Integer> leafs = new HashSet<>(); static List<int[]> buffer = new ArrayList<>(); static int[] knot; public static void main(String[] ...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
bd93cb383d33864e29cc3213d15e9ec7
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashSet; import java.util.LinkedList; import java.util.StringTokenizer; public class Solution{ static long mod = 998244353L; public static void main(String[] args) throws Exce...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
dc6e28d71702a1a95d03f6d9e647063d
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; import java.awt.geom.*; import static java.lang.Math.*; public class Solution implements Runnable { class FastScanner { BufferedReader in; StringTokenizer st; public FastScanner(BufferedReader in) { this.in = in; } public String nextToken() t...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
e5033f784e9858f35b605d45fd203de2
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
a0158f7bc717ee8055ababda37c7681e
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.io.*; import java.util.*; public class C { Reader source; BufferedReader br; StringTokenizer in; PrintWriter out; public String nextToken() throws Exception { while (in == null || !in.hasMoreTokens()) { in = new StringTokenizer(br.readLine()); } return in.nextToken(); } public int nextInt(...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
90a08d118f197af8f0121c4f1a0ca433
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.util.*; import java.io.*; // Ashraf EzzEldin Mahmoud Teleb Taha Mohamed Soltan Saleemy Elkalaby // public class dsu { static ArrayList<Integer>[] adj; public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(Syste...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
6873c7684e13931f108b75bf3a891155
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; import javafx.util.Pair; public class Solve6 {...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
44b3d133609ea996a574676afe119cad
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import javafx.util.Pair; import java.io.*; import java.util.*; public class CF1325C { public static void main(String ...args) { Reader in = new Reader(); Writer out = new Writer(); int n = in.nextInt(); ArrayList<Pair<Integer, Integer>> edges = new ArrayList<>(); int[] deg...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
4ce0437a43c4e9805a175cfd71834893
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import javafx.util.Pair; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.*; public class CF1325C { public static void main(String ...args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamR...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
9d7f9f2bd0b833845ae93f5cb628282b
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import javafx.util.Pair; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Template { public static void solve(int testCase, Reader in, PrintWriter out){ int n = in.nextInt(); ArrayList<Pair<Int...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
fa30f0475641e74e4be77e6a985adc54
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.util.*;import java.io.*;import java.math.*; public class Main { static class Edge{ int a,b,label; public Edge(int a,int b){ this.a=a; this.b=b; label=-1; } } static class Graph{ int V,deg[],cnt=0; ArrayList<Edg...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
8391b83db21ebd1c5ca4fd8cb71e6aac
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { static class Edge{ int u , v, label; public Edge(int u, int v){ this.u = u; this.v = v; label = -1; } } public static void process()throws IOException { int...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
5895c1d4a39214c013d7ec2d41cd4799
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.io.*; import java.util.*; public class CF1325C extends PrintWriter { CF1325C() { super(System.out); } Scanner sc = new Scanner(System.in); public static void main(String[] $) { CF1325C o = new CF1325C(); o.main(); o.flush(); } int[] h1, h2, h3, ans; boolean deg3(int u, int h) { if (h1[u] == 0) ...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
da588daacc792b5cc46510d8b8a9d309
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import javax.sound.sampled.Line; import java.io.*; import java.math.BigInteger; import java.util.*; public class A { public static void main(String[] args) throws Throwable { long time = System.currentTimeMillis(); Scanner sc = new Scanner(); PrintWriter pw = new PrintWriter(System.out); ...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
06974bde3e9aca5d095acec1bf72a2fc
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.io.*; import java.util.*; public class Main{ static LinkedList<int[]>[]adj; public static void main(String[] args) throws Exception{ MScanner sc=new MScanner(System.in); PrintWriter pw=new PrintWriter(System.out); int n=sc.nextInt(); adj=new LinkedList[n]; for(int i=0;i<n;i++)adj[i]=new Lin...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
2c4affacefef21fdf241213ea7b8b6d7
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.*; import java.util.ArrayList; import java.util.HashSet; public class Solution { static int n; static ArrayList<Integer> tree[]; public static void main(String[] args) throws IOException { FastReader in = new FastReader(System....
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
4d0ba81b91358ddb4b0e9aef25eb80ec
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class C { final int INF = 0x3f3f3f3f; BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof; public C() { br = new BufferedR...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
dd6344915619409650d78de79146ba94
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
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 Buffer...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
b33d890473edb106079e7d47e3382717
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.io.*; import java.util.*; public class B { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(); PrintWriter out = new PrintWriter(System.out); int n = sc.nextInt(); ArrayList<Integer>[] adj = new ArrayList[n]; for (int i = 0; i < n; i++) adj[i] = new ArrayL...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
79eca352c43ecca6e7a2ca2f6088d116
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
// Problem: C. Ehab and Path-etic MEXs // Contest: Codeforces - Codeforces Round #628 (Div. 2) // URL: http://codeforces.com/contest/1325/problem/C // Memory Limit: 256 MB // Time Limit: 1000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) import java.io.*; import java.util.*; public class Main { ...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
e5a0b23d5563303cd577dcd59f36a07e
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class cf1325c { static Map<Long, Integer> ind = new HashMap<>(); static int lbl = 0, ans[]; public static void main(String[] args) throws IOException { int n = ri(); List<List<In...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output