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
9933be7885e905b5cd8f874639e0eb95
train_002.jsonl
1469804400
You are given n points on the straight line β€” the positions (x-coordinates) of the cities and m points on the same line β€” the positions (x-coordinates) of the cellular towers. All towers work in the same way β€” they provide cellular network for all cities, which are located at the distance which is no more than r from t...
256 megabytes
import java.util.Scanner; public class Q4 { int[] cities; int[] cells; public void solver() { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); cities = new int[n]; cells = new int[m]; for (int i = 0; i < n; i++) { cities[i] = sc.nextInt(); } for (int i = 0; i < m; ...
Java
["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"]
3 seconds
["4", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation" ]
9fd8e75cb441dc809b1b2c48c4012c76
The first line contains two positive integers n and m (1 ≀ n, m ≀ 105) β€” the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≀ ai ≀ 109) β€” the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo...
1,500
Print minimal r so that each city will be covered by cellular network.
standard output
PASSED
a4e664af161019a1cb476f4396ccfafc
train_002.jsonl
1469804400
You are given n points on the straight line β€” the positions (x-coordinates) of the cities and m points on the same line β€” the positions (x-coordinates) of the cellular towers. All towers work in the same way β€” they provide cellular network for all cities, which are located at the distance which is no more than r from t...
256 megabytes
import java.util.Scanner; public class Q4 { int[] cities; int[] cells; public void solver() { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); cities = new int[n]; cells = new int[m]; for (int i = 0; i < n; i++) { cities[i] = sc.nextInt(); } for (int i = 0; i < m; ...
Java
["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"]
3 seconds
["4", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation" ]
9fd8e75cb441dc809b1b2c48c4012c76
The first line contains two positive integers n and m (1 ≀ n, m ≀ 105) β€” the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≀ ai ≀ 109) β€” the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo...
1,500
Print minimal r so that each city will be covered by cellular network.
standard output
PASSED
ed53e9dabd9dd5f1a384c87cc53a5ab0
train_002.jsonl
1469804400
You are given n points on the straight line β€” the positions (x-coordinates) of the cities and m points on the same line β€” the positions (x-coordinates) of the cellular towers. All towers work in the same way β€” they provide cellular network for all cities, which are located at the distance which is no more than r from t...
256 megabytes
import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; import java.util.Scanner; import java.util.TreeSet; /** * Created by Khamid_Sarmanov on 3/1/2016. */ public class Main { public static int search(int value, int[] a) { int lo = 0; int hi = a.length - 1; int la...
Java
["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"]
3 seconds
["4", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation" ]
9fd8e75cb441dc809b1b2c48c4012c76
The first line contains two positive integers n and m (1 ≀ n, m ≀ 105) β€” the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≀ ai ≀ 109) β€” the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo...
1,500
Print minimal r so that each city will be covered by cellular network.
standard output
PASSED
971e2a37c546d09e0b3a05b50346cdf4
train_002.jsonl
1571754900
The only difference between easy and hard versions is constraints.You are given $$$n$$$ segments on the coordinate axis $$$OX$$$. Segments can intersect, lie inside each other and even coincide. The $$$i$$$-th segment is $$$[l_i; r_i]$$$ ($$$l_i \le r_i$$$) and it covers all integer points $$$j$$$ such that $$$l_i \le ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.PriorityQueue; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashSet; import java.util.StringTokenizer; import java.io.BufferedRe...
Java
["7 2\n11 11\n9 11\n7 8\n8 9\n7 8\n9 11\n7 9", "5 1\n29 30\n30 30\n29 29\n28 30\n30 30", "6 1\n2 3\n3 3\n2 3\n2 2\n2 3\n2 3"]
1 second
["3\n1 4 7", "3\n1 2 4", "4\n1 3 5 6"]
null
Java 11
standard input
[ "greedy" ]
7f9c5a137e9304d4d7eee5ee1a891d1d
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 200$$$) β€” the number of segments and the maximum number of segments by which each integer point can be covered. The next $$$n$$$ lines contain segments. The $$$i$$$-th line contains two integers $$$l_i$$$ and $$$r_i$$$ ($$$1 \le...
1,800
In the first line print one integer $$$m$$$ ($$$0 \le m \le n$$$) β€” the minimum number of segments you need to remove so that there are no bad points. In the second line print $$$m$$$ distinct integers $$$p_1, p_2, \dots, p_m$$$ ($$$1 \le p_i \le n$$$) β€” indices of segments you remove in any order. If there are multipl...
standard output
PASSED
48eb169c25190b3b6a65d51178943f7c
train_002.jsonl
1571754900
The only difference between easy and hard versions is constraints.You are given $$$n$$$ segments on the coordinate axis $$$OX$$$. Segments can intersect, lie inside each other and even coincide. The $$$i$$$-th segment is $$$[l_i; r_i]$$$ ($$$l_i \le r_i$$$) and it covers all integer points $$$j$$$ such that $$$l_i \le ...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.*; public class TooManySegments { static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); static BufferedWriter ...
Java
["7 2\n11 11\n9 11\n7 8\n8 9\n7 8\n9 11\n7 9", "5 1\n29 30\n30 30\n29 29\n28 30\n30 30", "6 1\n2 3\n3 3\n2 3\n2 2\n2 3\n2 3"]
1 second
["3\n1 4 7", "3\n1 2 4", "4\n1 3 5 6"]
null
Java 11
standard input
[ "greedy" ]
7f9c5a137e9304d4d7eee5ee1a891d1d
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 200$$$) β€” the number of segments and the maximum number of segments by which each integer point can be covered. The next $$$n$$$ lines contain segments. The $$$i$$$-th line contains two integers $$$l_i$$$ and $$$r_i$$$ ($$$1 \le...
1,800
In the first line print one integer $$$m$$$ ($$$0 \le m \le n$$$) β€” the minimum number of segments you need to remove so that there are no bad points. In the second line print $$$m$$$ distinct integers $$$p_1, p_2, \dots, p_m$$$ ($$$1 \le p_i \le n$$$) β€” indices of segments you remove in any order. If there are multipl...
standard output
PASSED
85607182f4fb05894420e68fa5995562
train_002.jsonl
1571754900
The only difference between easy and hard versions is constraints.You are given $$$n$$$ segments on the coordinate axis $$$OX$$$. Segments can intersect, lie inside each other and even coincide. The $$$i$$$-th segment is $$$[l_i; r_i]$$$ ($$$l_i \le r_i$$$) and it covers all integer points $$$j$$$ such that $$$l_i \le ...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; import static java.lang.Math.max; import static java.lang.Math.min; public class Main { void run() throws IOException { int n = nextInt(); int k = nextInt(); int[][] a = new int[n][2]; TreeSet<Event> ts = new T...
Java
["7 2\n11 11\n9 11\n7 8\n8 9\n7 8\n9 11\n7 9", "5 1\n29 30\n30 30\n29 29\n28 30\n30 30", "6 1\n2 3\n3 3\n2 3\n2 2\n2 3\n2 3"]
1 second
["3\n1 4 7", "3\n1 2 4", "4\n1 3 5 6"]
null
Java 11
standard input
[ "greedy" ]
7f9c5a137e9304d4d7eee5ee1a891d1d
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 200$$$) β€” the number of segments and the maximum number of segments by which each integer point can be covered. The next $$$n$$$ lines contain segments. The $$$i$$$-th line contains two integers $$$l_i$$$ and $$$r_i$$$ ($$$1 \le...
1,800
In the first line print one integer $$$m$$$ ($$$0 \le m \le n$$$) β€” the minimum number of segments you need to remove so that there are no bad points. In the second line print $$$m$$$ distinct integers $$$p_1, p_2, \dots, p_m$$$ ($$$1 \le p_i \le n$$$) β€” indices of segments you remove in any order. If there are multipl...
standard output
PASSED
4a843d566121b095e64ad90eafbacccc
train_002.jsonl
1571754900
The only difference between easy and hard versions is constraints.You are given $$$n$$$ segments on the coordinate axis $$$OX$$$. Segments can intersect, lie inside each other and even coincide. The $$$i$$$-th segment is $$$[l_i; r_i]$$$ ($$$l_i \le r_i$$$) and it covers all integer points $$$j$$$ such that $$$l_i \le ...
256 megabytes
import java.io.*; import java.math.*; import java.text.DecimalFormat; import java.util.*; public class MainClass { InputStream in; PrintWriter out; long mod=(long)1e9+7; int MAX=(int)2e5+7; double eps=1e-6; String high=""; void solve() { int n = ni(); int k = ni(); int []cnt = new int[MAX]; Arr...
Java
["7 2\n11 11\n9 11\n7 8\n8 9\n7 8\n9 11\n7 9", "5 1\n29 30\n30 30\n29 29\n28 30\n30 30", "6 1\n2 3\n3 3\n2 3\n2 2\n2 3\n2 3"]
1 second
["3\n1 4 7", "3\n1 2 4", "4\n1 3 5 6"]
null
Java 11
standard input
[ "greedy" ]
7f9c5a137e9304d4d7eee5ee1a891d1d
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 200$$$) β€” the number of segments and the maximum number of segments by which each integer point can be covered. The next $$$n$$$ lines contain segments. The $$$i$$$-th line contains two integers $$$l_i$$$ and $$$r_i$$$ ($$$1 \le...
1,800
In the first line print one integer $$$m$$$ ($$$0 \le m \le n$$$) β€” the minimum number of segments you need to remove so that there are no bad points. In the second line print $$$m$$$ distinct integers $$$p_1, p_2, \dots, p_m$$$ ($$$1 \le p_i \le n$$$) β€” indices of segments you remove in any order. If there are multipl...
standard output
PASSED
095fab93b6db038bbe78e22841abcf72
train_002.jsonl
1571754900
The only difference between easy and hard versions is constraints.You are given $$$n$$$ segments on the coordinate axis $$$OX$$$. Segments can intersect, lie inside each other and even coincide. The $$$i$$$-th segment is $$$[l_i; r_i]$$$ ($$$l_i \le r_i$$$) and it covers all integer points $$$j$$$ such that $$$l_i \le ...
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) throws IOException { BufferedReader br = new BufferedReader(ne...
Java
["7 2\n11 11\n9 11\n7 8\n8 9\n7 8\n9 11\n7 9", "5 1\n29 30\n30 30\n29 29\n28 30\n30 30", "6 1\n2 3\n3 3\n2 3\n2 2\n2 3\n2 3"]
1 second
["3\n1 4 7", "3\n1 2 4", "4\n1 3 5 6"]
null
Java 11
standard input
[ "greedy" ]
7f9c5a137e9304d4d7eee5ee1a891d1d
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 200$$$) β€” the number of segments and the maximum number of segments by which each integer point can be covered. The next $$$n$$$ lines contain segments. The $$$i$$$-th line contains two integers $$$l_i$$$ and $$$r_i$$$ ($$$1 \le...
1,800
In the first line print one integer $$$m$$$ ($$$0 \le m \le n$$$) β€” the minimum number of segments you need to remove so that there are no bad points. In the second line print $$$m$$$ distinct integers $$$p_1, p_2, \dots, p_m$$$ ($$$1 \le p_i \le n$$$) β€” indices of segments you remove in any order. If there are multipl...
standard output
PASSED
9e20e6ff1dc7d4c19bf555496ddf63ab
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.util.Scanner; public class Night { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int f=sc.nextInt(); int compt=0; for(int i=0;i<n;i++) for(int j=0;j<f;j++) if((...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
66d9ff0df8693bbcebb1c8b9f5a7eade
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.util.*; public class hello { public static void main(String [] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int m = scan.nextInt(); int a[][] = new int[105][205]; for (int i = 0; i < n; ++i) { for (int j = 0; j < 2 * m; ++j) { a[i][j] = scan.nextInt(); } } ...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
deb6db1994d1272966f6536026e01728
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.util.Scanner; public class VitalityAndNight { public static void main(String[] args){ Scanner stdin = new Scanner(System.in); int n = stdin.nextInt(); int m = stdin.nextInt(); int[][] windows = new int[n][m*2]; int[][] flats = new int[n][m*2]; for(int i = 0; i < n; i++){ for(int j = 0; ...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
0d250c56f93f40ef660a554689b90f54
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.util.*; public class Main { public static void main(String []args) { Scanner s=new Scanner (System.in); int n=s.nextInt(),m=s.nextInt(); int arr[][] = new int[n][m*2+1]; for (int i=0;i<n;i++) for (int j=0;j<2*m;j++) arr[i][j]=s.nextInt(); int ans=0; for (int i=0;i<n;i++) { for (int j=0;...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
f3ffcb21a69cec3a06b8ede571eca317
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.io.*; import java.util.*; public class vitaly { public static void main(String[] args) throws Exception{ BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(f.readLine()); int N = Integer.parseInt(st.nextToken()); int M = Integer.par...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
2283ca55c87e5efe301b31e0b7f81247
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); int awake = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { b...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
0c8abad9659bc7d8d8202b6a9ff6c78d
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; /** * Created by Anusuya on 11/8/2015. */ public class Solution { public static void main(String[] args) throws IOException { BufferedReader bufferRead = new Buf...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
939728465a738f837fb5a3be00baed8a
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.util.Scanner; public class CF_597A { public static void main(String args[]) { Scanner in=new Scanner(System.in); int a,b,n,i,j=0,k=0,count=0; a=in.nextInt(); b=in.nextInt(); for(i=0;i<a;i++) { for(int m=0;m<b*2;m++) { n=in.nextInt(); j++; if(n==1) { k++; } if(j==2...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
2eec2534d7ec832ca51c65d4465d8a31
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.util.Scanner; /** * * @author ingysoft */ public class BasicMain { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String s = scanner.nextLine(); String split[] = s.split(" "); ...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
59a1a932a91094e836ccd83783b28d8a
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.util.Scanner; public class VitalyAndNight { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int count = 0; for(int i = 0; i < n ; i++) { int arr[] = new int[2 * m]; ...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
8feec722f2e82a1700f5a0fd6ec570e9
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Program { BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof; static final int Mod = 1000000007; static final double inf = 10000000000.0; void solve() throws IOException { int n, m, ...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
ee7918f529fd80417dee00000513ce8d
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.util.Scanner; public class A { public void solve() { Scanner cin = new Scanner(System.in); int n = cin.nextInt(); int m = cin.nextInt(); int[][] a = new int[n][m * 2]; for(int i = 0;i < n;i++) { for(int j = 0;j < m * 2;j++) { ...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
bd36664464efdbeac6038dbb9f4a5133
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class A_Div2_330 { public static void main(String[]arg) throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int i,m,n,j; ...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
7054d98287ec5071e138f63a122459f2
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class A { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static PrintWriter out; public st...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
c6a24cd9f3099824a597f55e92a6a257
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class A { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static PrintWriter out; public st...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
0c5a112cb1eba91003f85db309fe1909
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.util.*; public class a595 { public static void main(String[] args) { Scanner ob=new Scanner(System.in); int n=ob.nextInt(); int m=ob.nextInt(); int ans=0; for(int i=0;i<m;i++) { for(int j=0;j<n;j++) { int a=ob.nextInt(); int b=ob.nextInt(); if(a==1 || b==1) ans++; } ...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
3e45ed6f53686c626fd548bc01e8a44e
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.io.*; public class VitalyAndNight { public static void main (String[] args) { try { InputStreamReader in = new InputStreamReader(System.in); BufferedReader input = new BufferedReader(in); int lineNum = 0; String str; int n = 0; int m = 0; if (lineNum == 0 && (str = input.readLine())...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
1a9087c94d6b4bebb6a6d5f49f34c793
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.util.Scanner; public class Codeforces { public static Scanner in = new Scanner(System.in); public static void main(String[] args) { int ans = 0; int[] nm = inputInts(); int n = nm[0]; int m = nm[1]; for (int i = 0; i < n; i++) { int[] lights = inputInts(); for (int...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
28363576efd3bba31b3a8f34dea0a8b7
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.util.Scanner; public class Cf_study_again { public static void main(String[] args) { Scanner s=new Scanner(System.in); int n=s.nextInt(); int m=s.nextInt(); int count=0; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { ...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
f67e12ffba4ba7c494bace1e6d32d8e0
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.util.Scanner; public class A { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int m = s.nextInt(); int count = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < 2 * m; j++) { int t =...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
0253a91b5c39f3d6a16ddaa74bc91d0a
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.io.*; import java.util.StringTokenizer; /** * Created by peacefrog on 11/8/15. * Time : 10:33 PM */ public class Task_A { final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; PrintWriter out; long timeBegin, timeEnd; public void runIO() throws IOException { timeBegin = System...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
9981b40feadd245d162c2caec43b0f09
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.util.Scanner; public class a { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); int c = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { boolean a = in.nextInt() == 1; boolean b = in.nextInt() == ...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
74580ef4245984eae258292211742ff7
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.util.Scanner ; public class main { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner s = new Scanner(System.in) ; int n = s.nextInt() , m = s.nextInt() ; int ar [][] = new int[n][2*m] ; ...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
f2ac877680e7b35043d54d629433a4f9
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.util.*; public class Codef{ public static void main(String[] args){ Scanner in=new Scanner(System.in); int n=in.nextInt(),m=in.nextInt(),ans=0; int[][] ar=new int[n][m*2]; for (int i=0; i<n; i++) for (int j=0; j<m*2; j++) ar[i][j]=in.nextInt();...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
cac8cb961af977d3aa542a0aa302a301
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class VitalyAndNight { public static void main(String[] args) throws IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); String[] ss = bf.readLine().split(" "); int n = Intege...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
d9135da9cc48fa5d9e321197382fee5a
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.util.Scanner; public class VitalyandNight { public static void main(String[] args) { Scanner sc= new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int count = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { int temp1 =sc.nextInt(),temp2=sc.nextInt(); ...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
b945e286009f0dbfc66a5be477c05d5e
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Oleksii Sosevych (alexey_sosevich@ukr.net) */ public class Main { public static void main(Str...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
3dd5f78c2ff2853dcd1148a3b32ab98d
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; public class CF595A { public static void main(String[] args)throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); for(String ln;(ln=in.readLine())!=null;){ StringTokenizer...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
99355bab60b4d8e7073812ed84ce673f
train_002.jsonl
1447000200
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.Vitaly sees a building of n floors and 2Β·m windows on each floor. On each floor there are m flats numbered fr...
256 megabytes
//package solution; 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.StringTokenizer; public class Solution implements Runnable { BufferedReader in; P...
Java
["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0"]
1 second
["3", "2"]
NoteIn the first test case the house has two floors, two flats on each floor. That is, in total there are 4 flats. The light isn't on only on the second floor in the left flat. That is, in both rooms of the flat the light is off.In the second test case the house has one floor and the first floor has three flats. The li...
Java 7
standard input
[ "constructive algorithms", "implementation" ]
5b9aed235094de7de36247a3b2a34e0f
The first line of the input contains two integers n and m (1 ≀ n, m ≀ 100)Β β€” the number of floors in the house and the number of flats on each floor respectively. Next n lines describe the floors from top to bottom and contain 2Β·m characters each. If the i-th window of the given floor has lights on, then the i-th chara...
800
Print a single integerΒ β€” the number of flats that have lights on in at least one window, that is, the flats where, according to Vitaly, people aren't sleeping.
standard output
PASSED
f0715e4cf2ab9fd9089f79a9290d278c
train_002.jsonl
1349105400
Alice and Bob don't play games anymore. Now they study properties of all sorts of graphs together. Alice invented the following task: she takes a complete undirected graph with n vertices, chooses some m edges and keeps them. Bob gets the remaining edges.Alice and Bob are fond of "triangles" in graphs, that is, cycles...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StreamTokenizer; public class Main { static StreamTokenizer in = new StreamTokenizer(new BufferedReader( new InputStreamReader(System.in))); static PrintWriter out = new PrintWriter(System.ou...
Java
["5 5\n1 2\n1 3\n2 3\n2 4\n3 4", "5 3\n1 2\n2 3\n1 3"]
2 seconds
["3", "4"]
NoteIn the first sample Alice has 2 triangles: (1, 2, 3) and (2, 3, 4). Bob's graph has only 1 triangle : (1, 4, 5). That's why the two graphs in total contain 3 triangles.In the second sample Alice's graph has only one triangle: (1, 2, 3). Bob's graph has three triangles: (1, 4, 5), (2, 4, 5) and (3, 4, 5). In this ca...
Java 7
standard input
[ "combinatorics", "graphs", "math" ]
cbd87a55161ca9c66bf0095dbdce2a9b
The first line contains two space-separated integers n and m (1 ≀ n ≀ 106, 0 ≀ m ≀ 106) β€” the number of vertices in the initial complete graph and the number of edges in Alice's graph, correspondingly. Then m lines follow: the i-th line contains two space-separated integers ai, bi (1 ≀ ai, bi ≀ n, ai ≠ bi), β€” the numbe...
1,900
Print a single number β€” the total number of cycles of length 3 in Alice and Bob's graphs together. Please, do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is advised to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
2eae255f097a01f0e326da2577c591c4
train_002.jsonl
1349105400
Alice and Bob don't play games anymore. Now they study properties of all sorts of graphs together. Alice invented the following task: she takes a complete undirected graph with n vertices, chooses some m edges and keeps them. Bob gets the remaining edges.Alice and Bob are fond of "triangles" in graphs, that is, cycles...
256 megabytes
// Test .. import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHelper plug-in ...
Java
["5 5\n1 2\n1 3\n2 3\n2 4\n3 4", "5 3\n1 2\n2 3\n1 3"]
2 seconds
["3", "4"]
NoteIn the first sample Alice has 2 triangles: (1, 2, 3) and (2, 3, 4). Bob's graph has only 1 triangle : (1, 4, 5). That's why the two graphs in total contain 3 triangles.In the second sample Alice's graph has only one triangle: (1, 2, 3). Bob's graph has three triangles: (1, 4, 5), (2, 4, 5) and (3, 4, 5). In this ca...
Java 7
standard input
[ "combinatorics", "graphs", "math" ]
cbd87a55161ca9c66bf0095dbdce2a9b
The first line contains two space-separated integers n and m (1 ≀ n ≀ 106, 0 ≀ m ≀ 106) β€” the number of vertices in the initial complete graph and the number of edges in Alice's graph, correspondingly. Then m lines follow: the i-th line contains two space-separated integers ai, bi (1 ≀ ai, bi ≀ n, ai ≠ bi), β€” the numbe...
1,900
Print a single number β€” the total number of cycles of length 3 in Alice and Bob's graphs together. Please, do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is advised to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
d866838811cadb6498e2acb2d3c22689
train_002.jsonl
1349105400
Alice and Bob don't play games anymore. Now they study properties of all sorts of graphs together. Alice invented the following task: she takes a complete undirected graph with n vertices, chooses some m edges and keeps them. Bob gets the remaining edges.Alice and Bob are fond of "triangles" in graphs, that is, cycles...
256 megabytes
// Test .. import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHelper plug-in ...
Java
["5 5\n1 2\n1 3\n2 3\n2 4\n3 4", "5 3\n1 2\n2 3\n1 3"]
2 seconds
["3", "4"]
NoteIn the first sample Alice has 2 triangles: (1, 2, 3) and (2, 3, 4). Bob's graph has only 1 triangle : (1, 4, 5). That's why the two graphs in total contain 3 triangles.In the second sample Alice's graph has only one triangle: (1, 2, 3). Bob's graph has three triangles: (1, 4, 5), (2, 4, 5) and (3, 4, 5). In this ca...
Java 7
standard input
[ "combinatorics", "graphs", "math" ]
cbd87a55161ca9c66bf0095dbdce2a9b
The first line contains two space-separated integers n and m (1 ≀ n ≀ 106, 0 ≀ m ≀ 106) β€” the number of vertices in the initial complete graph and the number of edges in Alice's graph, correspondingly. Then m lines follow: the i-th line contains two space-separated integers ai, bi (1 ≀ ai, bi ≀ n, ai ≠ bi), β€” the numbe...
1,900
Print a single number β€” the total number of cycles of length 3 in Alice and Bob's graphs together. Please, do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is advised to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
f1de8f66025a5b887a591518ab7c3722
train_002.jsonl
1349105400
Alice and Bob don't play games anymore. Now they study properties of all sorts of graphs together. Alice invented the following task: she takes a complete undirected graph with n vertices, chooses some m edges and keeps them. Bob gets the remaining edges.Alice and Bob are fond of "triangles" in graphs, that is, cycles...
256 megabytes
// @author Sanzhar import java.io.*; import java.util.*; import java.awt.Point; public class Template { BufferedReader in; PrintWriter out; StringTokenizer st; String next() { while (st == null || !st.hasMoreTokens()) { try { st = new StringTokenizer(in.readLine()...
Java
["5 5\n1 2\n1 3\n2 3\n2 4\n3 4", "5 3\n1 2\n2 3\n1 3"]
2 seconds
["3", "4"]
NoteIn the first sample Alice has 2 triangles: (1, 2, 3) and (2, 3, 4). Bob's graph has only 1 triangle : (1, 4, 5). That's why the two graphs in total contain 3 triangles.In the second sample Alice's graph has only one triangle: (1, 2, 3). Bob's graph has three triangles: (1, 4, 5), (2, 4, 5) and (3, 4, 5). In this ca...
Java 7
standard input
[ "combinatorics", "graphs", "math" ]
cbd87a55161ca9c66bf0095dbdce2a9b
The first line contains two space-separated integers n and m (1 ≀ n ≀ 106, 0 ≀ m ≀ 106) β€” the number of vertices in the initial complete graph and the number of edges in Alice's graph, correspondingly. Then m lines follow: the i-th line contains two space-separated integers ai, bi (1 ≀ ai, bi ≀ n, ai ≠ bi), β€” the numbe...
1,900
Print a single number β€” the total number of cycles of length 3 in Alice and Bob's graphs together. Please, do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is advised to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
330ec24ebbbac492a7ec849e604e8fad
train_002.jsonl
1349105400
Alice and Bob don't play games anymore. Now they study properties of all sorts of graphs together. Alice invented the following task: she takes a complete undirected graph with n vertices, chooses some m edges and keeps them. Bob gets the remaining edges.Alice and Bob are fond of "triangles" in graphs, that is, cycles...
256 megabytes
import java.util.*; import java.io.*; public class cf229c { public static void main(String[] args) { FastIO in = new FastIO(), out = in; int n = in.nextInt(), m = in.nextInt(); int[] deg = new int[n]; for(int i=0; i<2*m; i++) deg[in.nextInt()-1]++; long ans = 0; for(int i=0; i<n; i++) ...
Java
["5 5\n1 2\n1 3\n2 3\n2 4\n3 4", "5 3\n1 2\n2 3\n1 3"]
2 seconds
["3", "4"]
NoteIn the first sample Alice has 2 triangles: (1, 2, 3) and (2, 3, 4). Bob's graph has only 1 triangle : (1, 4, 5). That's why the two graphs in total contain 3 triangles.In the second sample Alice's graph has only one triangle: (1, 2, 3). Bob's graph has three triangles: (1, 4, 5), (2, 4, 5) and (3, 4, 5). In this ca...
Java 7
standard input
[ "combinatorics", "graphs", "math" ]
cbd87a55161ca9c66bf0095dbdce2a9b
The first line contains two space-separated integers n and m (1 ≀ n ≀ 106, 0 ≀ m ≀ 106) β€” the number of vertices in the initial complete graph and the number of edges in Alice's graph, correspondingly. Then m lines follow: the i-th line contains two space-separated integers ai, bi (1 ≀ ai, bi ≀ n, ai ≠ bi), β€” the numbe...
1,900
Print a single number β€” the total number of cycles of length 3 in Alice and Bob's graphs together. Please, do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is advised to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
4d4e4f6695c306db1d378c07b9b5a5ff
train_002.jsonl
1349105400
Alice and Bob don't play games anymore. Now they study properties of all sorts of graphs together. Alice invented the following task: she takes a complete undirected graph with n vertices, chooses some m edges and keeps them. Bob gets the remaining edges.Alice and Bob are fond of "triangles" in graphs, that is, cycles...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHe...
Java
["5 5\n1 2\n1 3\n2 3\n2 4\n3 4", "5 3\n1 2\n2 3\n1 3"]
2 seconds
["3", "4"]
NoteIn the first sample Alice has 2 triangles: (1, 2, 3) and (2, 3, 4). Bob's graph has only 1 triangle : (1, 4, 5). That's why the two graphs in total contain 3 triangles.In the second sample Alice's graph has only one triangle: (1, 2, 3). Bob's graph has three triangles: (1, 4, 5), (2, 4, 5) and (3, 4, 5). In this ca...
Java 7
standard input
[ "combinatorics", "graphs", "math" ]
cbd87a55161ca9c66bf0095dbdce2a9b
The first line contains two space-separated integers n and m (1 ≀ n ≀ 106, 0 ≀ m ≀ 106) β€” the number of vertices in the initial complete graph and the number of edges in Alice's graph, correspondingly. Then m lines follow: the i-th line contains two space-separated integers ai, bi (1 ≀ ai, bi ≀ n, ai ≠ bi), β€” the numbe...
1,900
Print a single number β€” the total number of cycles of length 3 in Alice and Bob's graphs together. Please, do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is advised to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
873addb6236596bed81a7f8575bee7eb
train_002.jsonl
1349105400
Alice and Bob don't play games anymore. Now they study properties of all sorts of graphs together. Alice invented the following task: she takes a complete undirected graph with n vertices, chooses some m edges and keeps them. Bob gets the remaining edges.Alice and Bob are fond of "triangles" in graphs, that is, cycles...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; import java.util.LinkedLi...
Java
["5 5\n1 2\n1 3\n2 3\n2 4\n3 4", "5 3\n1 2\n2 3\n1 3"]
2 seconds
["3", "4"]
NoteIn the first sample Alice has 2 triangles: (1, 2, 3) and (2, 3, 4). Bob's graph has only 1 triangle : (1, 4, 5). That's why the two graphs in total contain 3 triangles.In the second sample Alice's graph has only one triangle: (1, 2, 3). Bob's graph has three triangles: (1, 4, 5), (2, 4, 5) and (3, 4, 5). In this ca...
Java 7
standard input
[ "combinatorics", "graphs", "math" ]
cbd87a55161ca9c66bf0095dbdce2a9b
The first line contains two space-separated integers n and m (1 ≀ n ≀ 106, 0 ≀ m ≀ 106) β€” the number of vertices in the initial complete graph and the number of edges in Alice's graph, correspondingly. Then m lines follow: the i-th line contains two space-separated integers ai, bi (1 ≀ ai, bi ≀ n, ai ≠ bi), β€” the numbe...
1,900
Print a single number β€” the total number of cycles of length 3 in Alice and Bob's graphs together. Please, do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is advised to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
546e7d1ba7cbbf439dda4e5058815740
train_002.jsonl
1349105400
Alice and Bob don't play games anymore. Now they study properties of all sorts of graphs together. Alice invented the following task: she takes a complete undirected graph with n vertices, chooses some m edges and keeps them. Bob gets the remaining edges.Alice and Bob are fond of "triangles" in graphs, that is, cycles...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import java.util.St...
Java
["5 5\n1 2\n1 3\n2 3\n2 4\n3 4", "5 3\n1 2\n2 3\n1 3"]
2 seconds
["3", "4"]
NoteIn the first sample Alice has 2 triangles: (1, 2, 3) and (2, 3, 4). Bob's graph has only 1 triangle : (1, 4, 5). That's why the two graphs in total contain 3 triangles.In the second sample Alice's graph has only one triangle: (1, 2, 3). Bob's graph has three triangles: (1, 4, 5), (2, 4, 5) and (3, 4, 5). In this ca...
Java 7
standard input
[ "combinatorics", "graphs", "math" ]
cbd87a55161ca9c66bf0095dbdce2a9b
The first line contains two space-separated integers n and m (1 ≀ n ≀ 106, 0 ≀ m ≀ 106) β€” the number of vertices in the initial complete graph and the number of edges in Alice's graph, correspondingly. Then m lines follow: the i-th line contains two space-separated integers ai, bi (1 ≀ ai, bi ≀ n, ai ≠ bi), β€” the numbe...
1,900
Print a single number β€” the total number of cycles of length 3 in Alice and Bob's graphs together. Please, do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is advised to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
68399674dbde795754287896c273a8e4
train_002.jsonl
1349105400
Alice and Bob don't play games anymore. Now they study properties of all sorts of graphs together. Alice invented the following task: she takes a complete undirected graph with n vertices, chooses some m edges and keeps them. Bob gets the remaining edges.Alice and Bob are fond of "triangles" in graphs, that is, cycles...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHelper plug-in * Actual so...
Java
["5 5\n1 2\n1 3\n2 3\n2 4\n3 4", "5 3\n1 2\n2 3\n1 3"]
2 seconds
["3", "4"]
NoteIn the first sample Alice has 2 triangles: (1, 2, 3) and (2, 3, 4). Bob's graph has only 1 triangle : (1, 4, 5). That's why the two graphs in total contain 3 triangles.In the second sample Alice's graph has only one triangle: (1, 2, 3). Bob's graph has three triangles: (1, 4, 5), (2, 4, 5) and (3, 4, 5). In this ca...
Java 7
standard input
[ "combinatorics", "graphs", "math" ]
cbd87a55161ca9c66bf0095dbdce2a9b
The first line contains two space-separated integers n and m (1 ≀ n ≀ 106, 0 ≀ m ≀ 106) β€” the number of vertices in the initial complete graph and the number of edges in Alice's graph, correspondingly. Then m lines follow: the i-th line contains two space-separated integers ai, bi (1 ≀ ai, bi ≀ n, ai ≠ bi), β€” the numbe...
1,900
Print a single number β€” the total number of cycles of length 3 in Alice and Bob's graphs together. Please, do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is advised to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
bb2772453f88636bd48600957064327b
train_002.jsonl
1349105400
Alice and Bob don't play games anymore. Now they study properties of all sorts of graphs together. Alice invented the following task: she takes a complete undirected graph with n vertices, chooses some m edges and keeps them. Bob gets the remaining edges.Alice and Bob are fond of "triangles" in graphs, that is, cycles...
256 megabytes
import java.io.*; import java.util.*; public class c { public static void main(String[] args) throws IOException { input.init(System.in); PrintWriter out = new PrintWriter(System.out); int n = input.nextInt(), m = input.nextInt(); long[] ds = new long[n]; for(int i = 0; i<m; i++) { int a = input.nextInt()-1, b ...
Java
["5 5\n1 2\n1 3\n2 3\n2 4\n3 4", "5 3\n1 2\n2 3\n1 3"]
2 seconds
["3", "4"]
NoteIn the first sample Alice has 2 triangles: (1, 2, 3) and (2, 3, 4). Bob's graph has only 1 triangle : (1, 4, 5). That's why the two graphs in total contain 3 triangles.In the second sample Alice's graph has only one triangle: (1, 2, 3). Bob's graph has three triangles: (1, 4, 5), (2, 4, 5) and (3, 4, 5). In this ca...
Java 7
standard input
[ "combinatorics", "graphs", "math" ]
cbd87a55161ca9c66bf0095dbdce2a9b
The first line contains two space-separated integers n and m (1 ≀ n ≀ 106, 0 ≀ m ≀ 106) β€” the number of vertices in the initial complete graph and the number of edges in Alice's graph, correspondingly. Then m lines follow: the i-th line contains two space-separated integers ai, bi (1 ≀ ai, bi ≀ n, ai ≠ bi), β€” the numbe...
1,900
Print a single number β€” the total number of cycles of length 3 in Alice and Bob's graphs together. Please, do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is advised to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
75cffa56e9a933f98a2d0559c2a8a47d
train_002.jsonl
1349105400
Alice and Bob don't play games anymore. Now they study properties of all sorts of graphs together. Alice invented the following task: she takes a complete undirected graph with n vertices, chooses some m edges and keeps them. Bob gets the remaining edges.Alice and Bob are fond of "triangles" in graphs, that is, cycles...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.math.BigDecimal; import java.io.BufferedWriter; import java.util.Locale; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.math.BigInteger; import java.io.InputSt...
Java
["5 5\n1 2\n1 3\n2 3\n2 4\n3 4", "5 3\n1 2\n2 3\n1 3"]
2 seconds
["3", "4"]
NoteIn the first sample Alice has 2 triangles: (1, 2, 3) and (2, 3, 4). Bob's graph has only 1 triangle : (1, 4, 5). That's why the two graphs in total contain 3 triangles.In the second sample Alice's graph has only one triangle: (1, 2, 3). Bob's graph has three triangles: (1, 4, 5), (2, 4, 5) and (3, 4, 5). In this ca...
Java 7
standard input
[ "combinatorics", "graphs", "math" ]
cbd87a55161ca9c66bf0095dbdce2a9b
The first line contains two space-separated integers n and m (1 ≀ n ≀ 106, 0 ≀ m ≀ 106) β€” the number of vertices in the initial complete graph and the number of edges in Alice's graph, correspondingly. Then m lines follow: the i-th line contains two space-separated integers ai, bi (1 ≀ ai, bi ≀ n, ai ≠ bi), β€” the numbe...
1,900
Print a single number β€” the total number of cycles of length 3 in Alice and Bob's graphs together. Please, do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is advised to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
078583e6130ae7dffa4ae9bbb6d2bbae
train_002.jsonl
1349105400
Alice and Bob don't play games anymore. Now they study properties of all sorts of graphs together. Alice invented the following task: she takes a complete undirected graph with n vertices, chooses some m edges and keeps them. Bob gets the remaining edges.Alice and Bob are fond of "triangles" in graphs, that is, cycles...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class Main { public static InputReader in; public static PrintWriter out; public static void main(String[] args) throws IOException { in = new InputReader(S...
Java
["5 5\n1 2\n1 3\n2 3\n2 4\n3 4", "5 3\n1 2\n2 3\n1 3"]
2 seconds
["3", "4"]
NoteIn the first sample Alice has 2 triangles: (1, 2, 3) and (2, 3, 4). Bob's graph has only 1 triangle : (1, 4, 5). That's why the two graphs in total contain 3 triangles.In the second sample Alice's graph has only one triangle: (1, 2, 3). Bob's graph has three triangles: (1, 4, 5), (2, 4, 5) and (3, 4, 5). In this ca...
Java 7
standard input
[ "combinatorics", "graphs", "math" ]
cbd87a55161ca9c66bf0095dbdce2a9b
The first line contains two space-separated integers n and m (1 ≀ n ≀ 106, 0 ≀ m ≀ 106) β€” the number of vertices in the initial complete graph and the number of edges in Alice's graph, correspondingly. Then m lines follow: the i-th line contains two space-separated integers ai, bi (1 ≀ ai, bi ≀ n, ai ≠ bi), β€” the numbe...
1,900
Print a single number β€” the total number of cycles of length 3 in Alice and Bob's graphs together. Please, do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is advised to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
7a4938513f508a51e96b7d65bf29d5f0
train_002.jsonl
1349105400
Alice and Bob don't play games anymore. Now they study properties of all sorts of graphs together. Alice invented the following task: she takes a complete undirected graph with n vertices, chooses some m edges and keeps them. Bob gets the remaining edges.Alice and Bob are fond of "triangles" in graphs, that is, cycles...
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.OutputStreamWriter; import java.io.PrintWriter; import java.util.StringTokenizer; public class Solver { public static void main(String[] Args) t...
Java
["5 5\n1 2\n1 3\n2 3\n2 4\n3 4", "5 3\n1 2\n2 3\n1 3"]
2 seconds
["3", "4"]
NoteIn the first sample Alice has 2 triangles: (1, 2, 3) and (2, 3, 4). Bob's graph has only 1 triangle : (1, 4, 5). That's why the two graphs in total contain 3 triangles.In the second sample Alice's graph has only one triangle: (1, 2, 3). Bob's graph has three triangles: (1, 4, 5), (2, 4, 5) and (3, 4, 5). In this ca...
Java 7
standard input
[ "combinatorics", "graphs", "math" ]
cbd87a55161ca9c66bf0095dbdce2a9b
The first line contains two space-separated integers n and m (1 ≀ n ≀ 106, 0 ≀ m ≀ 106) β€” the number of vertices in the initial complete graph and the number of edges in Alice's graph, correspondingly. Then m lines follow: the i-th line contains two space-separated integers ai, bi (1 ≀ ai, bi ≀ n, ai ≠ bi), β€” the numbe...
1,900
Print a single number β€” the total number of cycles of length 3 in Alice and Bob's graphs together. Please, do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is advised to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
7087ecfc603ab3a78d9f4fa404a5db88
train_002.jsonl
1349105400
Alice and Bob don't play games anymore. Now they study properties of all sorts of graphs together. Alice invented the following task: she takes a complete undirected graph with n vertices, chooses some m edges and keeps them. Bob gets the remaining edges.Alice and Bob are fond of "triangles" in graphs, that is, cycles...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collecti...
Java
["5 5\n1 2\n1 3\n2 3\n2 4\n3 4", "5 3\n1 2\n2 3\n1 3"]
2 seconds
["3", "4"]
NoteIn the first sample Alice has 2 triangles: (1, 2, 3) and (2, 3, 4). Bob's graph has only 1 triangle : (1, 4, 5). That's why the two graphs in total contain 3 triangles.In the second sample Alice's graph has only one triangle: (1, 2, 3). Bob's graph has three triangles: (1, 4, 5), (2, 4, 5) and (3, 4, 5). In this ca...
Java 7
standard input
[ "combinatorics", "graphs", "math" ]
cbd87a55161ca9c66bf0095dbdce2a9b
The first line contains two space-separated integers n and m (1 ≀ n ≀ 106, 0 ≀ m ≀ 106) β€” the number of vertices in the initial complete graph and the number of edges in Alice's graph, correspondingly. Then m lines follow: the i-th line contains two space-separated integers ai, bi (1 ≀ ai, bi ≀ n, ai ≠ bi), β€” the numbe...
1,900
Print a single number β€” the total number of cycles of length 3 in Alice and Bob's graphs together. Please, do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is advised to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
09d6d3206a8361f6fe656ae1093a1be2
train_002.jsonl
1349105400
Alice and Bob don't play games anymore. Now they study properties of all sorts of graphs together. Alice invented the following task: she takes a complete undirected graph with n vertices, chooses some m edges and keeps them. Bob gets the remaining edges.Alice and Bob are fond of "triangles" in graphs, that is, cycles...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collecti...
Java
["5 5\n1 2\n1 3\n2 3\n2 4\n3 4", "5 3\n1 2\n2 3\n1 3"]
2 seconds
["3", "4"]
NoteIn the first sample Alice has 2 triangles: (1, 2, 3) and (2, 3, 4). Bob's graph has only 1 triangle : (1, 4, 5). That's why the two graphs in total contain 3 triangles.In the second sample Alice's graph has only one triangle: (1, 2, 3). Bob's graph has three triangles: (1, 4, 5), (2, 4, 5) and (3, 4, 5). In this ca...
Java 7
standard input
[ "combinatorics", "graphs", "math" ]
cbd87a55161ca9c66bf0095dbdce2a9b
The first line contains two space-separated integers n and m (1 ≀ n ≀ 106, 0 ≀ m ≀ 106) β€” the number of vertices in the initial complete graph and the number of edges in Alice's graph, correspondingly. Then m lines follow: the i-th line contains two space-separated integers ai, bi (1 ≀ ai, bi ≀ n, ai ≠ bi), β€” the numbe...
1,900
Print a single number β€” the total number of cycles of length 3 in Alice and Bob's graphs together. Please, do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is advised to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
166e83c38562337352132b80d8cb9892
train_002.jsonl
1349105400
Alice and Bob don't play games anymore. Now they study properties of all sorts of graphs together. Alice invented the following task: she takes a complete undirected graph with n vertices, chooses some m edges and keeps them. Bob gets the remaining edges.Alice and Bob are fond of "triangles" in graphs, that is, cycles...
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.HashSet; import java.util.InputMismatchException; import java.util.List; import java.util.Set; publi...
Java
["5 5\n1 2\n1 3\n2 3\n2 4\n3 4", "5 3\n1 2\n2 3\n1 3"]
2 seconds
["3", "4"]
NoteIn the first sample Alice has 2 triangles: (1, 2, 3) and (2, 3, 4). Bob's graph has only 1 triangle : (1, 4, 5). That's why the two graphs in total contain 3 triangles.In the second sample Alice's graph has only one triangle: (1, 2, 3). Bob's graph has three triangles: (1, 4, 5), (2, 4, 5) and (3, 4, 5). In this ca...
Java 7
standard input
[ "combinatorics", "graphs", "math" ]
cbd87a55161ca9c66bf0095dbdce2a9b
The first line contains two space-separated integers n and m (1 ≀ n ≀ 106, 0 ≀ m ≀ 106) β€” the number of vertices in the initial complete graph and the number of edges in Alice's graph, correspondingly. Then m lines follow: the i-th line contains two space-separated integers ai, bi (1 ≀ ai, bi ≀ n, ai ≠ bi), β€” the numbe...
1,900
Print a single number β€” the total number of cycles of length 3 in Alice and Bob's graphs together. Please, do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is advised to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
d0893c20091d66f52d08afa9c1747316
train_002.jsonl
1349105400
Alice and Bob don't play games anymore. Now they study properties of all sorts of graphs together. Alice invented the following task: she takes a complete undirected graph with n vertices, chooses some m edges and keeps them. Bob gets the remaining edges.Alice and Bob are fond of "triangles" in graphs, that is, cycles...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; /** * Created with IntelliJ IDEA. */ public class ProblemC { public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter out = new Pri...
Java
["5 5\n1 2\n1 3\n2 3\n2 4\n3 4", "5 3\n1 2\n2 3\n1 3"]
2 seconds
["3", "4"]
NoteIn the first sample Alice has 2 triangles: (1, 2, 3) and (2, 3, 4). Bob's graph has only 1 triangle : (1, 4, 5). That's why the two graphs in total contain 3 triangles.In the second sample Alice's graph has only one triangle: (1, 2, 3). Bob's graph has three triangles: (1, 4, 5), (2, 4, 5) and (3, 4, 5). In this ca...
Java 7
standard input
[ "combinatorics", "graphs", "math" ]
cbd87a55161ca9c66bf0095dbdce2a9b
The first line contains two space-separated integers n and m (1 ≀ n ≀ 106, 0 ≀ m ≀ 106) β€” the number of vertices in the initial complete graph and the number of edges in Alice's graph, correspondingly. Then m lines follow: the i-th line contains two space-separated integers ai, bi (1 ≀ ai, bi ≀ n, ai ≠ bi), β€” the numbe...
1,900
Print a single number β€” the total number of cycles of length 3 in Alice and Bob's graphs together. Please, do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is advised to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
10937e73a089ad6f3af2202f7db0fad6
train_002.jsonl
1349105400
Alice and Bob don't play games anymore. Now they study properties of all sorts of graphs together. Alice invented the following task: she takes a complete undirected graph with n vertices, chooses some m edges and keeps them. Bob gets the remaining edges.Alice and Bob are fond of "triangles" in graphs, that is, cycles...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.Arrays; import java.util.StringTokenizer; public class Solution implements Runnable { private BufferedR...
Java
["5 5\n1 2\n1 3\n2 3\n2 4\n3 4", "5 3\n1 2\n2 3\n1 3"]
2 seconds
["3", "4"]
NoteIn the first sample Alice has 2 triangles: (1, 2, 3) and (2, 3, 4). Bob's graph has only 1 triangle : (1, 4, 5). That's why the two graphs in total contain 3 triangles.In the second sample Alice's graph has only one triangle: (1, 2, 3). Bob's graph has three triangles: (1, 4, 5), (2, 4, 5) and (3, 4, 5). In this ca...
Java 7
standard input
[ "combinatorics", "graphs", "math" ]
cbd87a55161ca9c66bf0095dbdce2a9b
The first line contains two space-separated integers n and m (1 ≀ n ≀ 106, 0 ≀ m ≀ 106) β€” the number of vertices in the initial complete graph and the number of edges in Alice's graph, correspondingly. Then m lines follow: the i-th line contains two space-separated integers ai, bi (1 ≀ ai, bi ≀ n, ai ≠ bi), β€” the numbe...
1,900
Print a single number β€” the total number of cycles of length 3 in Alice and Bob's graphs together. Please, do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is advised to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
dc3b1f41632a298cbda40cf72c486daf
train_002.jsonl
1349105400
Alice and Bob don't play games anymore. Now they study properties of all sorts of graphs together. Alice invented the following task: she takes a complete undirected graph with n vertices, chooses some m edges and keeps them. Bob gets the remaining edges.Alice and Bob are fond of "triangles" in graphs, that is, cycles...
256 megabytes
import java.math.*; import java.awt.geom.Line2D; import java.io.*; import java.lang.*; import java.util.*; public class C implements Runnable { public void run() { int n = nextInt(); int m = nextInt(); ArrayList<Integer>[] gg = new ArrayList[n]; for (int i = 0; i < n; ++i) { ...
Java
["5 5\n1 2\n1 3\n2 3\n2 4\n3 4", "5 3\n1 2\n2 3\n1 3"]
2 seconds
["3", "4"]
NoteIn the first sample Alice has 2 triangles: (1, 2, 3) and (2, 3, 4). Bob's graph has only 1 triangle : (1, 4, 5). That's why the two graphs in total contain 3 triangles.In the second sample Alice's graph has only one triangle: (1, 2, 3). Bob's graph has three triangles: (1, 4, 5), (2, 4, 5) and (3, 4, 5). In this ca...
Java 7
standard input
[ "combinatorics", "graphs", "math" ]
cbd87a55161ca9c66bf0095dbdce2a9b
The first line contains two space-separated integers n and m (1 ≀ n ≀ 106, 0 ≀ m ≀ 106) β€” the number of vertices in the initial complete graph and the number of edges in Alice's graph, correspondingly. Then m lines follow: the i-th line contains two space-separated integers ai, bi (1 ≀ ai, bi ≀ n, ai ≠ bi), β€” the numbe...
1,900
Print a single number β€” the total number of cycles of length 3 in Alice and Bob's graphs together. Please, do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is advised to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
71456bdd2c165e2475aeee32d1a06997
train_002.jsonl
1349105400
Alice and Bob don't play games anymore. Now they study properties of all sorts of graphs together. Alice invented the following task: she takes a complete undirected graph with n vertices, chooses some m edges and keeps them. Bob gets the remaining edges.Alice and Bob are fond of "triangles" in graphs, that is, cycles...
256 megabytes
import java.math.*; import java.awt.geom.Line2D; import java.io.*; import java.lang.*; import java.util.*; public class C implements Runnable { public void run() { int n = nextInt(); int m = nextInt(); /*ArrayList<Integer>[] g = new ArrayList[n]; for (int i = 0; i < n; ++i) { ...
Java
["5 5\n1 2\n1 3\n2 3\n2 4\n3 4", "5 3\n1 2\n2 3\n1 3"]
2 seconds
["3", "4"]
NoteIn the first sample Alice has 2 triangles: (1, 2, 3) and (2, 3, 4). Bob's graph has only 1 triangle : (1, 4, 5). That's why the two graphs in total contain 3 triangles.In the second sample Alice's graph has only one triangle: (1, 2, 3). Bob's graph has three triangles: (1, 4, 5), (2, 4, 5) and (3, 4, 5). In this ca...
Java 7
standard input
[ "combinatorics", "graphs", "math" ]
cbd87a55161ca9c66bf0095dbdce2a9b
The first line contains two space-separated integers n and m (1 ≀ n ≀ 106, 0 ≀ m ≀ 106) β€” the number of vertices in the initial complete graph and the number of edges in Alice's graph, correspondingly. Then m lines follow: the i-th line contains two space-separated integers ai, bi (1 ≀ ai, bi ≀ n, ai ≠ bi), β€” the numbe...
1,900
Print a single number β€” the total number of cycles of length 3 in Alice and Bob's graphs together. Please, do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is advised to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
b2b884611aa7a33e403f792250053478
train_002.jsonl
1349105400
Alice and Bob don't play games anymore. Now they study properties of all sorts of graphs together. Alice invented the following task: she takes a complete undirected graph with n vertices, chooses some m edges and keeps them. Bob gets the remaining edges.Alice and Bob are fond of "triangles" in graphs, that is, cycles...
256 megabytes
import java.math.*; import java.awt.geom.Line2D; import java.io.*; import java.lang.*; import java.util.*; public class C implements Runnable { public void run() { int n = nextInt(); int m = nextInt(); ArrayList<Integer>[] g = new ArrayList[n]; for (int i = 0; i < n; ++i) { ...
Java
["5 5\n1 2\n1 3\n2 3\n2 4\n3 4", "5 3\n1 2\n2 3\n1 3"]
2 seconds
["3", "4"]
NoteIn the first sample Alice has 2 triangles: (1, 2, 3) and (2, 3, 4). Bob's graph has only 1 triangle : (1, 4, 5). That's why the two graphs in total contain 3 triangles.In the second sample Alice's graph has only one triangle: (1, 2, 3). Bob's graph has three triangles: (1, 4, 5), (2, 4, 5) and (3, 4, 5). In this ca...
Java 7
standard input
[ "combinatorics", "graphs", "math" ]
cbd87a55161ca9c66bf0095dbdce2a9b
The first line contains two space-separated integers n and m (1 ≀ n ≀ 106, 0 ≀ m ≀ 106) β€” the number of vertices in the initial complete graph and the number of edges in Alice's graph, correspondingly. Then m lines follow: the i-th line contains two space-separated integers ai, bi (1 ≀ ai, bi ≀ n, ai ≠ bi), β€” the numbe...
1,900
Print a single number β€” the total number of cycles of length 3 in Alice and Bob's graphs together. Please, do not use the %lld specifier to read or write 64-bit integers in Π‘++. It is advised to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
05a0b6bf4ad77b57d223c9e01d675f94
train_002.jsonl
1498401300
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.PriorityQueue; import java.util.StringTokenizer; public class div2420 { public static PrintWriter out; //------...
Java
["3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove", "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove"]
3 seconds
["1", "2"]
NoteIn the first sample, Daru should reorder the boxes after adding box 3 to the stack.In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack.
Java 8
standard input
[ "data structures", "greedy", "trees" ]
2535fc09ce74b829c26e1ebfc1ee17c6
The first line of input contains the integer n (1 ≀ n ≀ 3Β·105)Β β€” the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 ≀ x ≀ n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guar...
1,500
Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe's commands.
standard output
PASSED
e343cf4520163b78f4ecd2bbd0ca093b
train_002.jsonl
1498401300
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw...
256 megabytes
//package HackerEarthA; import java.io.*; import java.util.*; import java.util.Map.Entry; import java.text.*; import java.math.*; import java.util.regex.*; import javafx.scene.layout.Priority; import java.awt.Point; /** * * @author prabhat // use stringbuilder, priorityQueue */ public class easy18{ public st...
Java
["3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove", "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove"]
3 seconds
["1", "2"]
NoteIn the first sample, Daru should reorder the boxes after adding box 3 to the stack.In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack.
Java 8
standard input
[ "data structures", "greedy", "trees" ]
2535fc09ce74b829c26e1ebfc1ee17c6
The first line of input contains the integer n (1 ≀ n ≀ 3Β·105)Β β€” the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 ≀ x ≀ n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guar...
1,500
Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe's commands.
standard output
PASSED
895474417bba5c27d84e48682ee807f7
train_002.jsonl
1498401300
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw...
256 megabytes
import java.util.Scanner; import java.util.Stack; public class C420C { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = Integer.parseInt(sc.nextLine()); int count = 0; int goal = 1; int safe = 0; int peeked = 0; int curStack = 0; Stack<Integer> st = new...
Java
["3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove", "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove"]
3 seconds
["1", "2"]
NoteIn the first sample, Daru should reorder the boxes after adding box 3 to the stack.In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack.
Java 8
standard input
[ "data structures", "greedy", "trees" ]
2535fc09ce74b829c26e1ebfc1ee17c6
The first line of input contains the integer n (1 ≀ n ≀ 3Β·105)Β β€” the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 ≀ x ≀ n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guar...
1,500
Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe's commands.
standard output
PASSED
73170b14464dba7a7d26a55173db2c49
train_002.jsonl
1498401300
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw...
256 megabytes
import java.util.*; import java.io.*; public class _0821_C_OkabeAndBoxes { public static void main(String[] args) throws IOException { int N = readInt(), cnt = 1, ans = 0; Stack<Integer> stk = new Stack<>(); for(int i = 1; i<=2*N; i++) { if(read().equals("add")) stk.add(readInt()); else { if(!stk.isEmpty(...
Java
["3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove", "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove"]
3 seconds
["1", "2"]
NoteIn the first sample, Daru should reorder the boxes after adding box 3 to the stack.In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack.
Java 8
standard input
[ "data structures", "greedy", "trees" ]
2535fc09ce74b829c26e1ebfc1ee17c6
The first line of input contains the integer n (1 ≀ n ≀ 3Β·105)Β β€” the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 ≀ x ≀ n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guar...
1,500
Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe's commands.
standard output
PASSED
4f3704cf496ab8d689c8f43dfac743e0
train_002.jsonl
1498401300
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class MainClass { public static long hits=0; public static void main(String[] args) throws IOException { InputReader in = new InputReader(System.in); PrintWriter out = new PrintWriter(System.out); int n=in.nextInt(); int n2=2*n; int c=...
Java
["3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove", "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove"]
3 seconds
["1", "2"]
NoteIn the first sample, Daru should reorder the boxes after adding box 3 to the stack.In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack.
Java 8
standard input
[ "data structures", "greedy", "trees" ]
2535fc09ce74b829c26e1ebfc1ee17c6
The first line of input contains the integer n (1 ≀ n ≀ 3Β·105)Β β€” the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 ≀ x ≀ n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guar...
1,500
Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe's commands.
standard output
PASSED
17ed1159ae32de7cce49e144f11839bc
train_002.jsonl
1498401300
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; /** * Created by mostafa on 7/8/17. */ public class C { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(); int n = sc.nextInt() * 2; int ...
Java
["3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove", "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove"]
3 seconds
["1", "2"]
NoteIn the first sample, Daru should reorder the boxes after adding box 3 to the stack.In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack.
Java 8
standard input
[ "data structures", "greedy", "trees" ]
2535fc09ce74b829c26e1ebfc1ee17c6
The first line of input contains the integer n (1 ≀ n ≀ 3Β·105)Β β€” the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 ≀ x ≀ n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guar...
1,500
Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe's commands.
standard output
PASSED
55322c7081fd1659728c3bc87f01cc08
train_002.jsonl
1498401300
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw...
256 megabytes
import java.io.*; import java.util.*; public class C { public static void solution(BufferedReader reader, PrintWriter writer) throws IOException { In in = new In(reader); Out out = new Out(writer); int n = in.nextInt(), cnt = 0, rst = 0; int[] list = new int[1000000]; ...
Java
["3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove", "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove"]
3 seconds
["1", "2"]
NoteIn the first sample, Daru should reorder the boxes after adding box 3 to the stack.In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack.
Java 8
standard input
[ "data structures", "greedy", "trees" ]
2535fc09ce74b829c26e1ebfc1ee17c6
The first line of input contains the integer n (1 ≀ n ≀ 3Β·105)Β β€” the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 ≀ x ≀ n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guar...
1,500
Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe's commands.
standard output
PASSED
6d25d8c85e2089cc3eabe9cb1d0fc94d
train_002.jsonl
1498401300
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw...
256 megabytes
import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.*; public class C { private static final String REGEX = " "; private static final Boolean DEBUG = false; private static final String FILE_NAME = "input.txt"; public static void main(String[] args) throws...
Java
["3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove", "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove"]
3 seconds
["1", "2"]
NoteIn the first sample, Daru should reorder the boxes after adding box 3 to the stack.In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack.
Java 8
standard input
[ "data structures", "greedy", "trees" ]
2535fc09ce74b829c26e1ebfc1ee17c6
The first line of input contains the integer n (1 ≀ n ≀ 3Β·105)Β β€” the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 ≀ x ≀ n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guar...
1,500
Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe's commands.
standard output
PASSED
2af870a290478cd22f8b6c362b44bfaa
train_002.jsonl
1498401300
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; import java.security.KeyStore.Entry; public class Q2 { static ArrayList<Integer> adj[]; static int color[],red[],black[],previs[]; static boolean b[],visited[],possible; static Map<Long,Long> dict; static int totalnodes,colored,time,v[],l[],r[]; static...
Java
["3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove", "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove"]
3 seconds
["1", "2"]
NoteIn the first sample, Daru should reorder the boxes after adding box 3 to the stack.In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack.
Java 8
standard input
[ "data structures", "greedy", "trees" ]
2535fc09ce74b829c26e1ebfc1ee17c6
The first line of input contains the integer n (1 ≀ n ≀ 3Β·105)Β β€” the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 ≀ x ≀ n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guar...
1,500
Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe's commands.
standard output
PASSED
9470c4c40d506390c1f3f35f637d99db
train_002.jsonl
1498401300
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw...
256 megabytes
/* * @Author Silviase(@silviasetitech) * For ProCon */ import java.util.*; import java.lang.*; import java.math.*; public class Main{ static int MOD = (int)1e9+7; // for dfs static int n; static int ansi; static int[] w; static int[] ww; static boole...
Java
["3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove", "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove"]
3 seconds
["1", "2"]
NoteIn the first sample, Daru should reorder the boxes after adding box 3 to the stack.In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack.
Java 8
standard input
[ "data structures", "greedy", "trees" ]
2535fc09ce74b829c26e1ebfc1ee17c6
The first line of input contains the integer n (1 ≀ n ≀ 3Β·105)Β β€” the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 ≀ x ≀ n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guar...
1,500
Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe's commands.
standard output
PASSED
b37cd77ef00ccbdeac53238d83be98f6
train_002.jsonl
1498401300
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Collections; import java.util.Comparator; import java.util.PriorityQueue; import java.util.Stack; import java.util.StringTokenizer; public class Main{ public static void main(String[] args) throws NumberForm...
Java
["3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove", "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove"]
3 seconds
["1", "2"]
NoteIn the first sample, Daru should reorder the boxes after adding box 3 to the stack.In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack.
Java 8
standard input
[ "data structures", "greedy", "trees" ]
2535fc09ce74b829c26e1ebfc1ee17c6
The first line of input contains the integer n (1 ≀ n ≀ 3Β·105)Β β€” the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 ≀ x ≀ n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guar...
1,500
Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe's commands.
standard output
PASSED
7a9eced983229e8976c7439aafe4f9d8
train_002.jsonl
1498401300
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.AbstractCollection; import java.util.PriorityQueue; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Ac...
Java
["3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove", "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove"]
3 seconds
["1", "2"]
NoteIn the first sample, Daru should reorder the boxes after adding box 3 to the stack.In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack.
Java 8
standard input
[ "data structures", "greedy", "trees" ]
2535fc09ce74b829c26e1ebfc1ee17c6
The first line of input contains the integer n (1 ≀ n ≀ 3Β·105)Β β€” the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 ≀ x ≀ n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guar...
1,500
Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe's commands.
standard output
PASSED
b805aee4d33bedd1d2998dea98c144b6
train_002.jsonl
1498401300
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw...
256 megabytes
import java.util.*; import java.io.*; public class Main { static int q,mx,sumG,level,sumB,c,n,m,cnt,cnt1,sum; static char t; static int arr[]; static int mat[][]; static int freq[]; static int lvl[]; static boolean vis2[][]; static boolean vis[]; static Set<Integer>adj[]; static TreeSet<Integer>set=new TreeSet<>(); sta...
Java
["3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove", "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove"]
3 seconds
["1", "2"]
NoteIn the first sample, Daru should reorder the boxes after adding box 3 to the stack.In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack.
Java 8
standard input
[ "data structures", "greedy", "trees" ]
2535fc09ce74b829c26e1ebfc1ee17c6
The first line of input contains the integer n (1 ≀ n ≀ 3Β·105)Β β€” the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 ≀ x ≀ n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guar...
1,500
Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe's commands.
standard output
PASSED
31ad65e49ef5b09621abcd08ef3e353b
train_002.jsonl
1498401300
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw...
256 megabytes
import java.util.*; import java.io.*; public class A { public static void main(String ar[]) throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int n=Integer.parseInt(br.readLine()); Stack<Integer> st=new Stack<Integer>(); ...
Java
["3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove", "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove"]
3 seconds
["1", "2"]
NoteIn the first sample, Daru should reorder the boxes after adding box 3 to the stack.In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack.
Java 8
standard input
[ "data structures", "greedy", "trees" ]
2535fc09ce74b829c26e1ebfc1ee17c6
The first line of input contains the integer n (1 ≀ n ≀ 3Β·105)Β β€” the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 ≀ x ≀ n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guar...
1,500
Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe's commands.
standard output
PASSED
203b0ff0f8606f42b54a020510dcc083
train_002.jsonl
1498401300
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw...
256 megabytes
import java.util.*; import java.io.*; public class A { public static void main(String ar[]) throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int n=Integer.parseInt(br.readLine()); Stack<Integer> st=new Stack<Integer>(); ...
Java
["3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove", "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove"]
3 seconds
["1", "2"]
NoteIn the first sample, Daru should reorder the boxes after adding box 3 to the stack.In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack.
Java 8
standard input
[ "data structures", "greedy", "trees" ]
2535fc09ce74b829c26e1ebfc1ee17c6
The first line of input contains the integer n (1 ≀ n ≀ 3Β·105)Β β€” the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 ≀ x ≀ n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guar...
1,500
Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe's commands.
standard output
PASSED
d30894ef2be034f7c928d85ed731cbff
train_002.jsonl
1498401300
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { FastScanner sc = new FastScanner(); PrintWriter pw = new PrintWriter(System.out); while (sc.hasNext()) { int n=sc.nextInt(); int count=0; int temp=-1; int cur=1; boolean p=false; int max=-1; St...
Java
["3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove", "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove"]
3 seconds
["1", "2"]
NoteIn the first sample, Daru should reorder the boxes after adding box 3 to the stack.In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack.
Java 8
standard input
[ "data structures", "greedy", "trees" ]
2535fc09ce74b829c26e1ebfc1ee17c6
The first line of input contains the integer n (1 ≀ n ≀ 3Β·105)Β β€” the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 ≀ x ≀ n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guar...
1,500
Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe's commands.
standard output
PASSED
bc442b3ab6f8355507a7f8433df6b55b
train_002.jsonl
1498401300
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import java.math.*; public class Prac{ static class InputReader { private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, snumChars; public InputReader(InputStream st) { ...
Java
["3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove", "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove"]
3 seconds
["1", "2"]
NoteIn the first sample, Daru should reorder the boxes after adding box 3 to the stack.In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack.
Java 8
standard input
[ "data structures", "greedy", "trees" ]
2535fc09ce74b829c26e1ebfc1ee17c6
The first line of input contains the integer n (1 ≀ n ≀ 3Β·105)Β β€” the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 ≀ x ≀ n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guar...
1,500
Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe's commands.
standard output
PASSED
52bf6caab346cd185e83d9428f74ca5e
train_002.jsonl
1498401300
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import java.math.*; public class Prac{ static class InputReader { private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, snumChars; public InputReader(InputStream st) { ...
Java
["3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove", "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove"]
3 seconds
["1", "2"]
NoteIn the first sample, Daru should reorder the boxes after adding box 3 to the stack.In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack.
Java 8
standard input
[ "data structures", "greedy", "trees" ]
2535fc09ce74b829c26e1ebfc1ee17c6
The first line of input contains the integer n (1 ≀ n ≀ 3Β·105)Β β€” the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 ≀ x ≀ n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guar...
1,500
Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe's commands.
standard output
PASSED
ea3c40709b90ff7716c8bb84a04d0528
train_002.jsonl
1402673400
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. The park can be represented as a rectangular n × m field. The park has k spiders, each spider at time 0 is...
256 megabytes
import java.io.*; import java.util.*; public class Main { private static PrintWriter out; private static FastReader in; private static class FastReader { public BufferedReader reader; public StringTokenizer tokenizer; public FastReader(InputStream inputStream) { reade...
Java
["3 3 4\n...\nR.L\nR.U", "2 2 2\n..\nRL", "2 2 2\n..\nLR", "3 4 8\n....\nRRLL\nUUUU", "2 2 2\n..\nUU"]
3 seconds
["0 2 2", "1 1", "0 0", "1 3 3 1", "0 0"]
NoteConsider the first sample. The notes below show how the spider arrangement changes on the field over time:... ... ..U ...R.L -&gt; .*U -&gt; L.R -&gt; ...R.U .R. ..R ...Character "*" represents a cell that contains two spiders at the same time. If Om Nom starts fr...
Java 7
standard input
[ "implementation", "math" ]
d8c89bb83592a1ff1b639f7d53056d67
The first line contains three integers n, m, k (2 ≀ n, m ≀ 2000;Β 0 ≀ k ≀ m(n - 1)). Each of the next n lines contains m characters β€” the description of the park. The characters in the i-th line describe the i-th row of the park field. If the character in the line equals ".", that means that the corresponding cell of t...
1,400
Print m integers: the j-th integer must show the number of spiders Om Nom will see if he starts his walk from the j-th cell of the first row. The cells in any row of the field are numbered from left to right.
standard output
PASSED
14a9b20a742db6051cdecab6f34ef425
train_002.jsonl
1402673400
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. The park can be represented as a rectangular n × m field. The park has k spiders, each spider at time 0 is...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; /** * @author master_j * @version 0.4 * @since May 3, 2014 */ public class Main { private void solve() throws IOException { int n = io.nI(), m = io.nI(), k = io.nI(); io.wc(".LRUD"); char[][] map = new char[n][]; ...
Java
["3 3 4\n...\nR.L\nR.U", "2 2 2\n..\nRL", "2 2 2\n..\nLR", "3 4 8\n....\nRRLL\nUUUU", "2 2 2\n..\nUU"]
3 seconds
["0 2 2", "1 1", "0 0", "1 3 3 1", "0 0"]
NoteConsider the first sample. The notes below show how the spider arrangement changes on the field over time:... ... ..U ...R.L -&gt; .*U -&gt; L.R -&gt; ...R.U .R. ..R ...Character "*" represents a cell that contains two spiders at the same time. If Om Nom starts fr...
Java 7
standard input
[ "implementation", "math" ]
d8c89bb83592a1ff1b639f7d53056d67
The first line contains three integers n, m, k (2 ≀ n, m ≀ 2000;Β 0 ≀ k ≀ m(n - 1)). Each of the next n lines contains m characters β€” the description of the park. The characters in the i-th line describe the i-th row of the park field. If the character in the line equals ".", that means that the corresponding cell of t...
1,400
Print m integers: the j-th integer must show the number of spiders Om Nom will see if he starts his walk from the j-th cell of the first row. The cells in any row of the field are numbered from left to right.
standard output
PASSED
2bf01ae92349d20a7ab9f910d8086993
train_002.jsonl
1402673400
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. The park can be represented as a rectangular n × m field. The park has k spiders, each spider at time 0 is...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.io.FileReader; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is ...
Java
["3 3 4\n...\nR.L\nR.U", "2 2 2\n..\nRL", "2 2 2\n..\nLR", "3 4 8\n....\nRRLL\nUUUU", "2 2 2\n..\nUU"]
3 seconds
["0 2 2", "1 1", "0 0", "1 3 3 1", "0 0"]
NoteConsider the first sample. The notes below show how the spider arrangement changes on the field over time:... ... ..U ...R.L -&gt; .*U -&gt; L.R -&gt; ...R.U .R. ..R ...Character "*" represents a cell that contains two spiders at the same time. If Om Nom starts fr...
Java 7
standard input
[ "implementation", "math" ]
d8c89bb83592a1ff1b639f7d53056d67
The first line contains three integers n, m, k (2 ≀ n, m ≀ 2000;Β 0 ≀ k ≀ m(n - 1)). Each of the next n lines contains m characters β€” the description of the park. The characters in the i-th line describe the i-th row of the park field. If the character in the line equals ".", that means that the corresponding cell of t...
1,400
Print m integers: the j-th integer must show the number of spiders Om Nom will see if he starts his walk from the j-th cell of the first row. The cells in any row of the field are numbered from left to right.
standard output
PASSED
69d366e497ea40e1911b363ad677bb93
train_002.jsonl
1402673400
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. The park can be represented as a rectangular n × m field. The park has k spiders, each spider at time 0 is...
256 megabytes
import java.io.*; import java.util.StringTokenizer; /** * Created by Andrew Govorovsky on 15.06.14 */ public final class cf436b { public static void main(String[] args) { InputReader inputReader = new InputReader(System.in); PrintWriter outputStreamWriter = new PrintWriter(System.out); T...
Java
["3 3 4\n...\nR.L\nR.U", "2 2 2\n..\nRL", "2 2 2\n..\nLR", "3 4 8\n....\nRRLL\nUUUU", "2 2 2\n..\nUU"]
3 seconds
["0 2 2", "1 1", "0 0", "1 3 3 1", "0 0"]
NoteConsider the first sample. The notes below show how the spider arrangement changes on the field over time:... ... ..U ...R.L -&gt; .*U -&gt; L.R -&gt; ...R.U .R. ..R ...Character "*" represents a cell that contains two spiders at the same time. If Om Nom starts fr...
Java 7
standard input
[ "implementation", "math" ]
d8c89bb83592a1ff1b639f7d53056d67
The first line contains three integers n, m, k (2 ≀ n, m ≀ 2000;Β 0 ≀ k ≀ m(n - 1)). Each of the next n lines contains m characters β€” the description of the park. The characters in the i-th line describe the i-th row of the park field. If the character in the line equals ".", that means that the corresponding cell of t...
1,400
Print m integers: the j-th integer must show the number of spiders Om Nom will see if he starts his walk from the j-th cell of the first row. The cells in any row of the field are numbered from left to right.
standard output
PASSED
2efc209c7d338848ecf0bf0d17e7f5c6
train_002.jsonl
1402673400
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. The park can be represented as a rectangular n × m field. The park has k spiders, each spider at time 0 is...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class B { static void solve(char[][] f, int k, int[] out) { int n=f.length, m=f[0].length; for (int col=0; col<m; col++) { for (int row=0; row<...
Java
["3 3 4\n...\nR.L\nR.U", "2 2 2\n..\nRL", "2 2 2\n..\nLR", "3 4 8\n....\nRRLL\nUUUU", "2 2 2\n..\nUU"]
3 seconds
["0 2 2", "1 1", "0 0", "1 3 3 1", "0 0"]
NoteConsider the first sample. The notes below show how the spider arrangement changes on the field over time:... ... ..U ...R.L -&gt; .*U -&gt; L.R -&gt; ...R.U .R. ..R ...Character "*" represents a cell that contains two spiders at the same time. If Om Nom starts fr...
Java 7
standard input
[ "implementation", "math" ]
d8c89bb83592a1ff1b639f7d53056d67
The first line contains three integers n, m, k (2 ≀ n, m ≀ 2000;Β 0 ≀ k ≀ m(n - 1)). Each of the next n lines contains m characters β€” the description of the park. The characters in the i-th line describe the i-th row of the park field. If the character in the line equals ".", that means that the corresponding cell of t...
1,400
Print m integers: the j-th integer must show the number of spiders Om Nom will see if he starts his walk from the j-th cell of the first row. The cells in any row of the field are numbered from left to right.
standard output
PASSED
c3013a8d5f92d75e244d7c2e342e4163
train_002.jsonl
1402673400
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. The park can be represented as a rectangular n × m field. The park has k spiders, each spider at time 0 is...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.Scanner; /** * Author: Sergey Paramonov * Date: 13.06.14 * Time: 19:03 */ public class Zepto_20140613_B { Scanner scanner = new Scanner(System.in); BufferedReader buffered = new BufferedReader(new InputStreamReader(System.in)); StreamTokenize...
Java
["3 3 4\n...\nR.L\nR.U", "2 2 2\n..\nRL", "2 2 2\n..\nLR", "3 4 8\n....\nRRLL\nUUUU", "2 2 2\n..\nUU"]
3 seconds
["0 2 2", "1 1", "0 0", "1 3 3 1", "0 0"]
NoteConsider the first sample. The notes below show how the spider arrangement changes on the field over time:... ... ..U ...R.L -&gt; .*U -&gt; L.R -&gt; ...R.U .R. ..R ...Character "*" represents a cell that contains two spiders at the same time. If Om Nom starts fr...
Java 7
standard input
[ "implementation", "math" ]
d8c89bb83592a1ff1b639f7d53056d67
The first line contains three integers n, m, k (2 ≀ n, m ≀ 2000;Β 0 ≀ k ≀ m(n - 1)). Each of the next n lines contains m characters β€” the description of the park. The characters in the i-th line describe the i-th row of the park field. If the character in the line equals ".", that means that the corresponding cell of t...
1,400
Print m integers: the j-th integer must show the number of spiders Om Nom will see if he starts his walk from the j-th cell of the first row. The cells in any row of the field are numbered from left to right.
standard output
PASSED
e8adeccc39c1879d586b996b1eb165e5
train_002.jsonl
1402673400
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. The park can be represented as a rectangular n × m field. The park has k spiders, each spider at time 0 is...
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 { public static void main (String[] args) throws java.lang.Exception { Scanner sc =new Scanner(System...
Java
["3 3 4\n...\nR.L\nR.U", "2 2 2\n..\nRL", "2 2 2\n..\nLR", "3 4 8\n....\nRRLL\nUUUU", "2 2 2\n..\nUU"]
3 seconds
["0 2 2", "1 1", "0 0", "1 3 3 1", "0 0"]
NoteConsider the first sample. The notes below show how the spider arrangement changes on the field over time:... ... ..U ...R.L -&gt; .*U -&gt; L.R -&gt; ...R.U .R. ..R ...Character "*" represents a cell that contains two spiders at the same time. If Om Nom starts fr...
Java 7
standard input
[ "implementation", "math" ]
d8c89bb83592a1ff1b639f7d53056d67
The first line contains three integers n, m, k (2 ≀ n, m ≀ 2000;Β 0 ≀ k ≀ m(n - 1)). Each of the next n lines contains m characters β€” the description of the park. The characters in the i-th line describe the i-th row of the park field. If the character in the line equals ".", that means that the corresponding cell of t...
1,400
Print m integers: the j-th integer must show the number of spiders Om Nom will see if he starts his walk from the j-th cell of the first row. The cells in any row of the field are numbered from left to right.
standard output
PASSED
e7df4e3e572a60d617621ea153f7fa90
train_002.jsonl
1402673400
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. The park can be represented as a rectangular n × m field. The park has k spiders, each spider at time 0 is...
256 megabytes
import java.io.*; import java.util.*; public class B { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out)); StringTokenizer tokenizer = new StringToken...
Java
["3 3 4\n...\nR.L\nR.U", "2 2 2\n..\nRL", "2 2 2\n..\nLR", "3 4 8\n....\nRRLL\nUUUU", "2 2 2\n..\nUU"]
3 seconds
["0 2 2", "1 1", "0 0", "1 3 3 1", "0 0"]
NoteConsider the first sample. The notes below show how the spider arrangement changes on the field over time:... ... ..U ...R.L -&gt; .*U -&gt; L.R -&gt; ...R.U .R. ..R ...Character "*" represents a cell that contains two spiders at the same time. If Om Nom starts fr...
Java 7
standard input
[ "implementation", "math" ]
d8c89bb83592a1ff1b639f7d53056d67
The first line contains three integers n, m, k (2 ≀ n, m ≀ 2000;Β 0 ≀ k ≀ m(n - 1)). Each of the next n lines contains m characters β€” the description of the park. The characters in the i-th line describe the i-th row of the park field. If the character in the line equals ".", that means that the corresponding cell of t...
1,400
Print m integers: the j-th integer must show the number of spiders Om Nom will see if he starts his walk from the j-th cell of the first row. The cells in any row of the field are numbered from left to right.
standard output
PASSED
f79a4b2ea30c9dff210f572344a1e108
train_002.jsonl
1402673400
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. The park can be represented as a rectangular n × m field. The park has k spiders, each spider at time 0 is...
256 megabytes
import java.util.Scanner; public class ProblemB { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n, m, k; n = sc.nextInt(); m = sc.nextInt(); k = sc.nextInt(); sc.nextLine(); String[] mat = new String[n]; for(int i = 0...
Java
["3 3 4\n...\nR.L\nR.U", "2 2 2\n..\nRL", "2 2 2\n..\nLR", "3 4 8\n....\nRRLL\nUUUU", "2 2 2\n..\nUU"]
3 seconds
["0 2 2", "1 1", "0 0", "1 3 3 1", "0 0"]
NoteConsider the first sample. The notes below show how the spider arrangement changes on the field over time:... ... ..U ...R.L -&gt; .*U -&gt; L.R -&gt; ...R.U .R. ..R ...Character "*" represents a cell that contains two spiders at the same time. If Om Nom starts fr...
Java 7
standard input
[ "implementation", "math" ]
d8c89bb83592a1ff1b639f7d53056d67
The first line contains three integers n, m, k (2 ≀ n, m ≀ 2000;Β 0 ≀ k ≀ m(n - 1)). Each of the next n lines contains m characters β€” the description of the park. The characters in the i-th line describe the i-th row of the park field. If the character in the line equals ".", that means that the corresponding cell of t...
1,400
Print m integers: the j-th integer must show the number of spiders Om Nom will see if he starts his walk from the j-th cell of the first row. The cells in any row of the field are numbered from left to right.
standard output
PASSED
65c1eb264f4fd0015670bcbd8ddedf6c
train_002.jsonl
1402673400
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. The park can be represented as a rectangular n × m field. The park has k spiders, each spider at time 0 is...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static class pair implements Comparable<pair> { int a; int b; public pair(int pa, int pb) { a = pa; b= pb; } @Override public int compareTo(pair o) { if(this.a < o.a) return -1; if(this.a > o.a) return 1; return Inte...
Java
["3 3 4\n...\nR.L\nR.U", "2 2 2\n..\nRL", "2 2 2\n..\nLR", "3 4 8\n....\nRRLL\nUUUU", "2 2 2\n..\nUU"]
3 seconds
["0 2 2", "1 1", "0 0", "1 3 3 1", "0 0"]
NoteConsider the first sample. The notes below show how the spider arrangement changes on the field over time:... ... ..U ...R.L -&gt; .*U -&gt; L.R -&gt; ...R.U .R. ..R ...Character "*" represents a cell that contains two spiders at the same time. If Om Nom starts fr...
Java 7
standard input
[ "implementation", "math" ]
d8c89bb83592a1ff1b639f7d53056d67
The first line contains three integers n, m, k (2 ≀ n, m ≀ 2000;Β 0 ≀ k ≀ m(n - 1)). Each of the next n lines contains m characters β€” the description of the park. The characters in the i-th line describe the i-th row of the park field. If the character in the line equals ".", that means that the corresponding cell of t...
1,400
Print m integers: the j-th integer must show the number of spiders Om Nom will see if he starts his walk from the j-th cell of the first row. The cells in any row of the field are numbered from left to right.
standard output
PASSED
051879bf6cf274fc1487479f88b183a8
train_002.jsonl
1402673400
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. The park can be represented as a rectangular n × m field. The park has k spiders, each spider at time 0 is...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); int k = in.nextInt(); char[][] a = new char[n][m]; for (int i = 0; i < n; i++) { String s = in.next(); for (int j = 0; j < m; j++) { a...
Java
["3 3 4\n...\nR.L\nR.U", "2 2 2\n..\nRL", "2 2 2\n..\nLR", "3 4 8\n....\nRRLL\nUUUU", "2 2 2\n..\nUU"]
3 seconds
["0 2 2", "1 1", "0 0", "1 3 3 1", "0 0"]
NoteConsider the first sample. The notes below show how the spider arrangement changes on the field over time:... ... ..U ...R.L -&gt; .*U -&gt; L.R -&gt; ...R.U .R. ..R ...Character "*" represents a cell that contains two spiders at the same time. If Om Nom starts fr...
Java 7
standard input
[ "implementation", "math" ]
d8c89bb83592a1ff1b639f7d53056d67
The first line contains three integers n, m, k (2 ≀ n, m ≀ 2000;Β 0 ≀ k ≀ m(n - 1)). Each of the next n lines contains m characters β€” the description of the park. The characters in the i-th line describe the i-th row of the park field. If the character in the line equals ".", that means that the corresponding cell of t...
1,400
Print m integers: the j-th integer must show the number of spiders Om Nom will see if he starts his walk from the j-th cell of the first row. The cells in any row of the field are numbered from left to right.
standard output
PASSED
fafd979cc858b04494f24a6de698e1c5
train_002.jsonl
1402673400
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. The park can be represented as a rectangular n × m field. The park has k spiders, each spider at time 0 is...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { public static void main(String args[]) throws NumberFormatException,IOException { Stdin in = new Stdin(); PrintWriter out = new PrintWr...
Java
["3 3 4\n...\nR.L\nR.U", "2 2 2\n..\nRL", "2 2 2\n..\nLR", "3 4 8\n....\nRRLL\nUUUU", "2 2 2\n..\nUU"]
3 seconds
["0 2 2", "1 1", "0 0", "1 3 3 1", "0 0"]
NoteConsider the first sample. The notes below show how the spider arrangement changes on the field over time:... ... ..U ...R.L -&gt; .*U -&gt; L.R -&gt; ...R.U .R. ..R ...Character "*" represents a cell that contains two spiders at the same time. If Om Nom starts fr...
Java 7
standard input
[ "implementation", "math" ]
d8c89bb83592a1ff1b639f7d53056d67
The first line contains three integers n, m, k (2 ≀ n, m ≀ 2000;Β 0 ≀ k ≀ m(n - 1)). Each of the next n lines contains m characters β€” the description of the park. The characters in the i-th line describe the i-th row of the park field. If the character in the line equals ".", that means that the corresponding cell of t...
1,400
Print m integers: the j-th integer must show the number of spiders Om Nom will see if he starts his walk from the j-th cell of the first row. The cells in any row of the field are numbered from left to right.
standard output
PASSED
25836587b0ca8601a7e2440041dc6e3d
train_002.jsonl
1402673400
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. The park can be represented as a rectangular n × m field. The park has k spiders, each spider at time 0 is...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class P436B { @SuppressWarnings("unchecked") public void run() throws Exception { int n = nextInt(); int m = nextInt(); int k = nextInt(); String [] f = new String [n]; for (int i = 0; i < n; i++) { f[i] = nextLine(); }...
Java
["3 3 4\n...\nR.L\nR.U", "2 2 2\n..\nRL", "2 2 2\n..\nLR", "3 4 8\n....\nRRLL\nUUUU", "2 2 2\n..\nUU"]
3 seconds
["0 2 2", "1 1", "0 0", "1 3 3 1", "0 0"]
NoteConsider the first sample. The notes below show how the spider arrangement changes on the field over time:... ... ..U ...R.L -&gt; .*U -&gt; L.R -&gt; ...R.U .R. ..R ...Character "*" represents a cell that contains two spiders at the same time. If Om Nom starts fr...
Java 7
standard input
[ "implementation", "math" ]
d8c89bb83592a1ff1b639f7d53056d67
The first line contains three integers n, m, k (2 ≀ n, m ≀ 2000;Β 0 ≀ k ≀ m(n - 1)). Each of the next n lines contains m characters β€” the description of the park. The characters in the i-th line describe the i-th row of the park field. If the character in the line equals ".", that means that the corresponding cell of t...
1,400
Print m integers: the j-th integer must show the number of spiders Om Nom will see if he starts his walk from the j-th cell of the first row. The cells in any row of the field are numbered from left to right.
standard output
PASSED
6c27f2c75ede8cde0cd0de0b25c442fb
train_002.jsonl
1402673400
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. The park can be represented as a rectangular n × m field. The park has k spiders, each spider at time 0 is...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Scanner; import java.util.TreeMap; import java.util.TreeSet; public class Main { public static void main(String[] args) { Sca...
Java
["3 3 4\n...\nR.L\nR.U", "2 2 2\n..\nRL", "2 2 2\n..\nLR", "3 4 8\n....\nRRLL\nUUUU", "2 2 2\n..\nUU"]
3 seconds
["0 2 2", "1 1", "0 0", "1 3 3 1", "0 0"]
NoteConsider the first sample. The notes below show how the spider arrangement changes on the field over time:... ... ..U ...R.L -&gt; .*U -&gt; L.R -&gt; ...R.U .R. ..R ...Character "*" represents a cell that contains two spiders at the same time. If Om Nom starts fr...
Java 7
standard input
[ "implementation", "math" ]
d8c89bb83592a1ff1b639f7d53056d67
The first line contains three integers n, m, k (2 ≀ n, m ≀ 2000;Β 0 ≀ k ≀ m(n - 1)). Each of the next n lines contains m characters β€” the description of the park. The characters in the i-th line describe the i-th row of the park field. If the character in the line equals ".", that means that the corresponding cell of t...
1,400
Print m integers: the j-th integer must show the number of spiders Om Nom will see if he starts his walk from the j-th cell of the first row. The cells in any row of the field are numbered from left to right.
standard output
PASSED
b432033dd526075c4b25b854f4f5211e
train_002.jsonl
1402673400
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. The park can be represented as a rectangular n × m field. The park has k spiders, each spider at time 0 is...
256 megabytes
public class B { public B () { int N = sc.nextInt(), M = sc.nextInt(); sc.nextInt(); char [][] B = sc.nextChars(N); int [] T = new int [M]; for (int i : rep(N)) for (int j : rep(M)) switch(B[i][j]) { case 'U': if (i%2 == 0) ++T[j]; break; case 'R': if (j+i < M) ++T[j+i]; break; case 'L': i...
Java
["3 3 4\n...\nR.L\nR.U", "2 2 2\n..\nRL", "2 2 2\n..\nLR", "3 4 8\n....\nRRLL\nUUUU", "2 2 2\n..\nUU"]
3 seconds
["0 2 2", "1 1", "0 0", "1 3 3 1", "0 0"]
NoteConsider the first sample. The notes below show how the spider arrangement changes on the field over time:... ... ..U ...R.L -&gt; .*U -&gt; L.R -&gt; ...R.U .R. ..R ...Character "*" represents a cell that contains two spiders at the same time. If Om Nom starts fr...
Java 7
standard input
[ "implementation", "math" ]
d8c89bb83592a1ff1b639f7d53056d67
The first line contains three integers n, m, k (2 ≀ n, m ≀ 2000;Β 0 ≀ k ≀ m(n - 1)). Each of the next n lines contains m characters β€” the description of the park. The characters in the i-th line describe the i-th row of the park field. If the character in the line equals ".", that means that the corresponding cell of t...
1,400
Print m integers: the j-th integer must show the number of spiders Om Nom will see if he starts his walk from the j-th cell of the first row. The cells in any row of the field are numbered from left to right.
standard output
PASSED
878a3850821788b1d07f2ef375f46192
train_002.jsonl
1402673400
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. The park can be represented as a rectangular n × m field. The park has k spiders, each spider at time 0 is...
256 megabytes
public class B { public B () { int N = sc.nextInt(), M = sc.nextInt(); sc.nextInt(); char [][] B = sc.nextChars(N); int [] T = new int [M]; for (int i : rep(N)) for (int j : rep(M)) switch(B[i][j]) { case 'U': if (i%2 == 0) ++T[j]; break; case 'R': if (j+i < M) ++T[j+i]; break; case 'L': i...
Java
["3 3 4\n...\nR.L\nR.U", "2 2 2\n..\nRL", "2 2 2\n..\nLR", "3 4 8\n....\nRRLL\nUUUU", "2 2 2\n..\nUU"]
3 seconds
["0 2 2", "1 1", "0 0", "1 3 3 1", "0 0"]
NoteConsider the first sample. The notes below show how the spider arrangement changes on the field over time:... ... ..U ...R.L -&gt; .*U -&gt; L.R -&gt; ...R.U .R. ..R ...Character "*" represents a cell that contains two spiders at the same time. If Om Nom starts fr...
Java 7
standard input
[ "implementation", "math" ]
d8c89bb83592a1ff1b639f7d53056d67
The first line contains three integers n, m, k (2 ≀ n, m ≀ 2000;Β 0 ≀ k ≀ m(n - 1)). Each of the next n lines contains m characters β€” the description of the park. The characters in the i-th line describe the i-th row of the park field. If the character in the line equals ".", that means that the corresponding cell of t...
1,400
Print m integers: the j-th integer must show the number of spiders Om Nom will see if he starts his walk from the j-th cell of the first row. The cells in any row of the field are numbered from left to right.
standard output
PASSED
83f4b486f27f88bd383399b94248e802
train_002.jsonl
1402673400
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. The park can be represented as a rectangular n × m field. The park has k spiders, each spider at time 0 is...
256 megabytes
import java.io.*; import java.util.*; public class Main{ static InputStreamReader inp = new InputStreamReader( System.in ); static BufferedReader buf = new BufferedReader( inp ); static StreamTokenizer tok = new StreamTokenizer( buf ); static OutputStreamWriter out = new OutputStreamWriter( System.out ); static...
Java
["3 3 4\n...\nR.L\nR.U", "2 2 2\n..\nRL", "2 2 2\n..\nLR", "3 4 8\n....\nRRLL\nUUUU", "2 2 2\n..\nUU"]
3 seconds
["0 2 2", "1 1", "0 0", "1 3 3 1", "0 0"]
NoteConsider the first sample. The notes below show how the spider arrangement changes on the field over time:... ... ..U ...R.L -&gt; .*U -&gt; L.R -&gt; ...R.U .R. ..R ...Character "*" represents a cell that contains two spiders at the same time. If Om Nom starts fr...
Java 7
standard input
[ "implementation", "math" ]
d8c89bb83592a1ff1b639f7d53056d67
The first line contains three integers n, m, k (2 ≀ n, m ≀ 2000;Β 0 ≀ k ≀ m(n - 1)). Each of the next n lines contains m characters β€” the description of the park. The characters in the i-th line describe the i-th row of the park field. If the character in the line equals ".", that means that the corresponding cell of t...
1,400
Print m integers: the j-th integer must show the number of spiders Om Nom will see if he starts his walk from the j-th cell of the first row. The cells in any row of the field are numbered from left to right.
standard output
PASSED
d9286fca3b884baef81f286ca9a20d54
train_002.jsonl
1402673400
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. The park can be represented as a rectangular n × m field. The park has k spiders, each spider at time 0 is...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class B_Spiders { public static void main(String[] args) throws java.io.IOException { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); String[] params = input.readLine().split(" "); final in...
Java
["3 3 4\n...\nR.L\nR.U", "2 2 2\n..\nRL", "2 2 2\n..\nLR", "3 4 8\n....\nRRLL\nUUUU", "2 2 2\n..\nUU"]
3 seconds
["0 2 2", "1 1", "0 0", "1 3 3 1", "0 0"]
NoteConsider the first sample. The notes below show how the spider arrangement changes on the field over time:... ... ..U ...R.L -&gt; .*U -&gt; L.R -&gt; ...R.U .R. ..R ...Character "*" represents a cell that contains two spiders at the same time. If Om Nom starts fr...
Java 7
standard input
[ "implementation", "math" ]
d8c89bb83592a1ff1b639f7d53056d67
The first line contains three integers n, m, k (2 ≀ n, m ≀ 2000;Β 0 ≀ k ≀ m(n - 1)). Each of the next n lines contains m characters β€” the description of the park. The characters in the i-th line describe the i-th row of the park field. If the character in the line equals ".", that means that the corresponding cell of t...
1,400
Print m integers: the j-th integer must show the number of spiders Om Nom will see if he starts his walk from the j-th cell of the first row. The cells in any row of the field are numbered from left to right.
standard output
PASSED
b49b3bdf1f62dc6e54c3f862ef51702d
train_002.jsonl
1402673400
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. The park can be represented as a rectangular n × m field. The park has k spiders, each spider at time 0 is...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Reader; import java.io.UnsupportedEncodingException; import java.text.DecimalFormat...
Java
["3 3 4\n...\nR.L\nR.U", "2 2 2\n..\nRL", "2 2 2\n..\nLR", "3 4 8\n....\nRRLL\nUUUU", "2 2 2\n..\nUU"]
3 seconds
["0 2 2", "1 1", "0 0", "1 3 3 1", "0 0"]
NoteConsider the first sample. The notes below show how the spider arrangement changes on the field over time:... ... ..U ...R.L -&gt; .*U -&gt; L.R -&gt; ...R.U .R. ..R ...Character "*" represents a cell that contains two spiders at the same time. If Om Nom starts fr...
Java 7
standard input
[ "implementation", "math" ]
d8c89bb83592a1ff1b639f7d53056d67
The first line contains three integers n, m, k (2 ≀ n, m ≀ 2000;Β 0 ≀ k ≀ m(n - 1)). Each of the next n lines contains m characters β€” the description of the park. The characters in the i-th line describe the i-th row of the park field. If the character in the line equals ".", that means that the corresponding cell of t...
1,400
Print m integers: the j-th integer must show the number of spiders Om Nom will see if he starts his walk from the j-th cell of the first row. The cells in any row of the field are numbered from left to right.
standard output
PASSED
7296bef4a30f9de5f5c6dc4fd6f1b493
train_002.jsonl
1402673400
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. The park can be represented as a rectangular n × m field. The park has k spiders, each spider at time 0 is...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.util.InputMismatchException; import java.io.PrintStream; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Reader; import java.io.Writer; import java.io.InputStream; /** * Built using CHelper...
Java
["3 3 4\n...\nR.L\nR.U", "2 2 2\n..\nRL", "2 2 2\n..\nLR", "3 4 8\n....\nRRLL\nUUUU", "2 2 2\n..\nUU"]
3 seconds
["0 2 2", "1 1", "0 0", "1 3 3 1", "0 0"]
NoteConsider the first sample. The notes below show how the spider arrangement changes on the field over time:... ... ..U ...R.L -&gt; .*U -&gt; L.R -&gt; ...R.U .R. ..R ...Character "*" represents a cell that contains two spiders at the same time. If Om Nom starts fr...
Java 7
standard input
[ "implementation", "math" ]
d8c89bb83592a1ff1b639f7d53056d67
The first line contains three integers n, m, k (2 ≀ n, m ≀ 2000;Β 0 ≀ k ≀ m(n - 1)). Each of the next n lines contains m characters β€” the description of the park. The characters in the i-th line describe the i-th row of the park field. If the character in the line equals ".", that means that the corresponding cell of t...
1,400
Print m integers: the j-th integer must show the number of spiders Om Nom will see if he starts his walk from the j-th cell of the first row. The cells in any row of the field are numbered from left to right.
standard output
PASSED
14e8cb16a5d205eae8a87a986dcf9727
train_002.jsonl
1402673400
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. The park can be represented as a rectangular n × m field. The park has k spiders, each spider at time 0 is...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.*; import static java.util.Collections.reverseOrder; /** * Created with IntelliJ IDEA. * User: AUtemuratov * Date: 07.04.14 * Time: 15:43 * To change this template use File |...
Java
["3 3 4\n...\nR.L\nR.U", "2 2 2\n..\nRL", "2 2 2\n..\nLR", "3 4 8\n....\nRRLL\nUUUU", "2 2 2\n..\nUU"]
3 seconds
["0 2 2", "1 1", "0 0", "1 3 3 1", "0 0"]
NoteConsider the first sample. The notes below show how the spider arrangement changes on the field over time:... ... ..U ...R.L -&gt; .*U -&gt; L.R -&gt; ...R.U .R. ..R ...Character "*" represents a cell that contains two spiders at the same time. If Om Nom starts fr...
Java 7
standard input
[ "implementation", "math" ]
d8c89bb83592a1ff1b639f7d53056d67
The first line contains three integers n, m, k (2 ≀ n, m ≀ 2000;Β 0 ≀ k ≀ m(n - 1)). Each of the next n lines contains m characters β€” the description of the park. The characters in the i-th line describe the i-th row of the park field. If the character in the line equals ".", that means that the corresponding cell of t...
1,400
Print m integers: the j-th integer must show the number of spiders Om Nom will see if he starts his walk from the j-th cell of the first row. The cells in any row of the field are numbered from left to right.
standard output
PASSED
e9fd8cd27c6713224844e2670b33552f
train_002.jsonl
1402673400
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. The park can be represented as a rectangular n × m field. The park has k spiders, each spider at time 0 is...
256 megabytes
import java.util.*; import java.io.*; public class B { static char map[][]; public static void main(String[]args)throws IOException { DataInputStream in=new DataInputStream(System.in); String S=in.readLine(); StringTokenizer s=new StringTokenizer(S); int n=Integer.p...
Java
["3 3 4\n...\nR.L\nR.U", "2 2 2\n..\nRL", "2 2 2\n..\nLR", "3 4 8\n....\nRRLL\nUUUU", "2 2 2\n..\nUU"]
3 seconds
["0 2 2", "1 1", "0 0", "1 3 3 1", "0 0"]
NoteConsider the first sample. The notes below show how the spider arrangement changes on the field over time:... ... ..U ...R.L -&gt; .*U -&gt; L.R -&gt; ...R.U .R. ..R ...Character "*" represents a cell that contains two spiders at the same time. If Om Nom starts fr...
Java 7
standard input
[ "implementation", "math" ]
d8c89bb83592a1ff1b639f7d53056d67
The first line contains three integers n, m, k (2 ≀ n, m ≀ 2000;Β 0 ≀ k ≀ m(n - 1)). Each of the next n lines contains m characters β€” the description of the park. The characters in the i-th line describe the i-th row of the park field. If the character in the line equals ".", that means that the corresponding cell of t...
1,400
Print m integers: the j-th integer must show the number of spiders Om Nom will see if he starts his walk from the j-th cell of the first row. The cells in any row of the field are numbered from left to right.
standard output
PASSED
1db28bb913237c7ac1211ed11a5b05fb
train_002.jsonl
1402673400
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. The park can be represented as a rectangular n × m field. The park has k spiders, each spider at time 0 is...
256 megabytes
import java.io.*; import java.util.*; import java.awt.Point; public class Template { BufferedReader in; PrintWriter out; StringTokenizer st; String next() { while (st == null || !st.hasMoreTokens()) { try { st = new StringTokenizer(in.readLine()); } ca...
Java
["3 3 4\n...\nR.L\nR.U", "2 2 2\n..\nRL", "2 2 2\n..\nLR", "3 4 8\n....\nRRLL\nUUUU", "2 2 2\n..\nUU"]
3 seconds
["0 2 2", "1 1", "0 0", "1 3 3 1", "0 0"]
NoteConsider the first sample. The notes below show how the spider arrangement changes on the field over time:... ... ..U ...R.L -&gt; .*U -&gt; L.R -&gt; ...R.U .R. ..R ...Character "*" represents a cell that contains two spiders at the same time. If Om Nom starts fr...
Java 7
standard input
[ "implementation", "math" ]
d8c89bb83592a1ff1b639f7d53056d67
The first line contains three integers n, m, k (2 ≀ n, m ≀ 2000;Β 0 ≀ k ≀ m(n - 1)). Each of the next n lines contains m characters β€” the description of the park. The characters in the i-th line describe the i-th row of the park field. If the character in the line equals ".", that means that the corresponding cell of t...
1,400
Print m integers: the j-th integer must show the number of spiders Om Nom will see if he starts his walk from the j-th cell of the first row. The cells in any row of the field are numbered from left to right.
standard output
PASSED
a831ee93e9a9c3ee8d2d14dad2d97f60
train_002.jsonl
1402673400
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. The park can be represented as a rectangular n × m field. The park has k spiders, each spider at time 0 is...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; import java.math.*; public class B { public static void main(String[] args) throws Exception { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); // Scanner scan = new Scanner(System.in); // PrintWriter out = ne...
Java
["3 3 4\n...\nR.L\nR.U", "2 2 2\n..\nRL", "2 2 2\n..\nLR", "3 4 8\n....\nRRLL\nUUUU", "2 2 2\n..\nUU"]
3 seconds
["0 2 2", "1 1", "0 0", "1 3 3 1", "0 0"]
NoteConsider the first sample. The notes below show how the spider arrangement changes on the field over time:... ... ..U ...R.L -&gt; .*U -&gt; L.R -&gt; ...R.U .R. ..R ...Character "*" represents a cell that contains two spiders at the same time. If Om Nom starts fr...
Java 7
standard input
[ "implementation", "math" ]
d8c89bb83592a1ff1b639f7d53056d67
The first line contains three integers n, m, k (2 ≀ n, m ≀ 2000;Β 0 ≀ k ≀ m(n - 1)). Each of the next n lines contains m characters β€” the description of the park. The characters in the i-th line describe the i-th row of the park field. If the character in the line equals ".", that means that the corresponding cell of t...
1,400
Print m integers: the j-th integer must show the number of spiders Om Nom will see if he starts his walk from the j-th cell of the first row. The cells in any row of the field are numbered from left to right.
standard output