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
64f53f5f99e06fe2b01a17be27146b25
train_002.jsonl
1492965900
Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg...
256 megabytes
import java.io.*; import java.util.*; public class Main { private static PrintWriter out = new PrintWriter(System.out); private static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); private static StringTokenizer st; public static void main(String[] args) throws IOException...
Java
["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"]
1 second
["3", "-1", "2999999997"]
NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther...
Java 8
standard input
[ "implementation", "math" ]
9e71b4117a24b906dbc16e6a6d110f50
The first line contains two integers n and k (1 ≀ n ≀ 105, 1 ≀ k ≀ 109)Β β€” the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≀ ai ≀ 109)Β β€” the initial prices.
900
Print the only line containing the minimum number of seconds needed for prices to become equal, of Β«-1Β» if it is impossible.
standard output
PASSED
02fd4b8b22d364437ccbab30daba2887
train_002.jsonl
1492965900
Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; public class A793 { private static long mod = 1000000007; public static void main(String[] args) { InputReader in=new InputReader(System.in); PrintWriter pw=new PrintWriter(System.out); int n=in.nextInt(); int k=in.nextInt(); int[] a=new int...
Java
["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"]
1 second
["3", "-1", "2999999997"]
NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther...
Java 8
standard input
[ "implementation", "math" ]
9e71b4117a24b906dbc16e6a6d110f50
The first line contains two integers n and k (1 ≀ n ≀ 105, 1 ≀ k ≀ 109)Β β€” the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≀ ai ≀ 109)Β β€” the initial prices.
900
Print the only line containing the minimum number of seconds needed for prices to become equal, of Β«-1Β» if it is impossible.
standard output
PASSED
b3647c9d10a9ef28fd5db0ab8b7f185a
train_002.jsonl
1492965900
Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg...
256 megabytes
import java.util.Scanner; import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Check2 implements Runnable{ static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numC...
Java
["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"]
1 second
["3", "-1", "2999999997"]
NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther...
Java 8
standard input
[ "implementation", "math" ]
9e71b4117a24b906dbc16e6a6d110f50
The first line contains two integers n and k (1 ≀ n ≀ 105, 1 ≀ k ≀ 109)Β β€” the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≀ ai ≀ 109)Β β€” the initial prices.
900
Print the only line containing the minimum number of seconds needed for prices to become equal, of Β«-1Β» if it is impossible.
standard output
PASSED
9c16a5ead679ab05a428250a879df666
train_002.jsonl
1492965900
Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg...
256 megabytes
import java.io.IOException; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Random; import java.util.StringTokenizer; import java.util.concurrent.ThreadLocalRandom; public class A { public static void main(String[] args) throws IO...
Java
["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"]
1 second
["3", "-1", "2999999997"]
NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther...
Java 8
standard input
[ "implementation", "math" ]
9e71b4117a24b906dbc16e6a6d110f50
The first line contains two integers n and k (1 ≀ n ≀ 105, 1 ≀ k ≀ 109)Β β€” the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≀ ai ≀ 109)Β β€” the initial prices.
900
Print the only line containing the minimum number of seconds needed for prices to become equal, of Β«-1Β» if it is impossible.
standard output
PASSED
17e410c001ed9d05e11d624d759b217d
train_002.jsonl
1492965900
Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg...
256 megabytes
import java.util.Arrays; import java.util.Collections; import java.util.Scanner; import java.util.Vector; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Vector<Integer> tab = new Vector(); int j = 1, n = sc.nextInt(); int k = sc.ne...
Java
["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"]
1 second
["3", "-1", "2999999997"]
NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther...
Java 8
standard input
[ "implementation", "math" ]
9e71b4117a24b906dbc16e6a6d110f50
The first line contains two integers n and k (1 ≀ n ≀ 105, 1 ≀ k ≀ 109)Β β€” the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≀ ai ≀ 109)Β β€” the initial prices.
900
Print the only line containing the minimum number of seconds needed for prices to become equal, of Β«-1Β» if it is impossible.
standard output
PASSED
1486a3733ec84c2d7a4abeee75fde4ec
train_002.jsonl
1492965900
Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg...
256 megabytes
import java.util.Scanner; /* Name of the class has to be "Main" only if the class is public. */ public class Main { public static void main (String[] args) throws java.lang.Exception { try { Scanner sc = new Scanner(System.in); int n,k,i,flag; long min,s; n=sc.nextInt(); k=sc.nextInt()...
Java
["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"]
1 second
["3", "-1", "2999999997"]
NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther...
Java 8
standard input
[ "implementation", "math" ]
9e71b4117a24b906dbc16e6a6d110f50
The first line contains two integers n and k (1 ≀ n ≀ 105, 1 ≀ k ≀ 109)Β β€” the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≀ ai ≀ 109)Β β€” the initial prices.
900
Print the only line containing the minimum number of seconds needed for prices to become equal, of Β«-1Β» if it is impossible.
standard output
PASSED
6099732aeba60e4fa91c8a516f54effc
train_002.jsonl
1492965900
Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg...
256 megabytes
import java.util.Scanner; /** * * @author οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½ */ public class JavaClass1 { public static void main(String[] args) { Scanner in=new Scanner(System.in); int a=in.nextInt(); int k=in.nextInt(); long[] t=new long[a]; boolean possible=true; for(int i=0;i<a;i++) {t[i]=in.next...
Java
["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"]
1 second
["3", "-1", "2999999997"]
NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther...
Java 8
standard input
[ "implementation", "math" ]
9e71b4117a24b906dbc16e6a6d110f50
The first line contains two integers n and k (1 ≀ n ≀ 105, 1 ≀ k ≀ 109)Β β€” the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≀ ai ≀ 109)Β β€” the initial prices.
900
Print the only line containing the minimum number of seconds needed for prices to become equal, of Β«-1Β» if it is impossible.
standard output
PASSED
70c3dc7fab0c9c1bcd753ab5f316361f
train_002.jsonl
1492965900
Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg...
256 megabytes
import java.lang.reflect.Array; import java.util.*; /** * Created by Debabrata on 4/10/2017. */ public class demo7 { public static void main(String[] args) { Scanner scan=new Scanner(System.in); int N=scan.nextInt(); int k=scan.nextInt(); int array[]=new int[N]; int a; i...
Java
["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"]
1 second
["3", "-1", "2999999997"]
NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther...
Java 8
standard input
[ "implementation", "math" ]
9e71b4117a24b906dbc16e6a6d110f50
The first line contains two integers n and k (1 ≀ n ≀ 105, 1 ≀ k ≀ 109)Β β€” the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≀ ai ≀ 109)Β β€” the initial prices.
900
Print the only line containing the minimum number of seconds needed for prices to become equal, of Β«-1Β» if it is impossible.
standard output
PASSED
0246371a20ee41b98dfcd62367ce1d22
train_002.jsonl
1492965900
Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg...
256 megabytes
import java.util.*; import java.math.BigInteger; public class A { static Scanner in = new Scanner(System.in); static BigInteger n,k; static ArrayList<BigInteger> prices = new ArrayList<>(),max=new ArrayList<>(); static BigInteger x; public static void main(String[] args) { n = new BigInteger...
Java
["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"]
1 second
["3", "-1", "2999999997"]
NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther...
Java 8
standard input
[ "implementation", "math" ]
9e71b4117a24b906dbc16e6a6d110f50
The first line contains two integers n and k (1 ≀ n ≀ 105, 1 ≀ k ≀ 109)Β β€” the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≀ ai ≀ 109)Β β€” the initial prices.
900
Print the only line containing the minimum number of seconds needed for prices to become equal, of Β«-1Β» if it is impossible.
standard output
PASSED
5f38163d3d710649686846fe8c669fda
train_002.jsonl
1492965900
Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg...
256 megabytes
// CodeForces Round #815 A TODO import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; public class OlegShares { int n; int k; int []a; long nSec; // number unique private void readData(BufferedReader bin) throws IOExcep...
Java
["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"]
1 second
["3", "-1", "2999999997"]
NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther...
Java 8
standard input
[ "implementation", "math" ]
9e71b4117a24b906dbc16e6a6d110f50
The first line contains two integers n and k (1 ≀ n ≀ 105, 1 ≀ k ≀ 109)Β β€” the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≀ ai ≀ 109)Β β€” the initial prices.
900
Print the only line containing the minimum number of seconds needed for prices to become equal, of Β«-1Β» if it is impossible.
standard output
PASSED
52382f7bae74285ba2d345cd05559e1e
train_002.jsonl
1492965900
Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg...
256 megabytes
// CodeForces Round #580 C done, no problem. import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.List; public class OlegAndShares { int n,k; // num...
Java
["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"]
1 second
["3", "-1", "2999999997"]
NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther...
Java 8
standard input
[ "implementation", "math" ]
9e71b4117a24b906dbc16e6a6d110f50
The first line contains two integers n and k (1 ≀ n ≀ 105, 1 ≀ k ≀ 109)Β β€” the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≀ ai ≀ 109)Β β€” the initial prices.
900
Print the only line containing the minimum number of seconds needed for prices to become equal, of Β«-1Β» if it is impossible.
standard output
PASSED
1b5ed97ea61d4f44cf649d5f8d856683
train_002.jsonl
1492965900
Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.Scanner; import java.uti...
Java
["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"]
1 second
["3", "-1", "2999999997"]
NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther...
Java 8
standard input
[ "implementation", "math" ]
9e71b4117a24b906dbc16e6a6d110f50
The first line contains two integers n and k (1 ≀ n ≀ 105, 1 ≀ k ≀ 109)Β β€” the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≀ ai ≀ 109)Β β€” the initial prices.
900
Print the only line containing the minimum number of seconds needed for prices to become equal, of Β«-1Β» if it is impossible.
standard output
PASSED
11650f4cbc2931c5f6b6bf398bf99c6d
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
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.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.StringTokenizer; import java.util.TreeMap; import java.util.TreeSet; p...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
23d869fe88e119e59b3ae30e3ce0a253
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Solution { private static class Player { Player(int n, int first) { this.n = n; bids = new ArrayList<>(); bids.add(first); } in...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
18a6d876b431fcce1d1855317b4660b3
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.io.*; import java.util.*; public class Mainn { FastReader scn; PrintWriter out; String INPUT = ""; class pair implements Comparable<pair> { int bid = 0, ind = 0; TreeSet<Integer> list = new TreeSet<>(); public int compareTo(pair o) { return this.bid - o.bid; } // public String toString()...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
2952f4e12abb8e7431ce1f15228db3ff
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.util.*; import java.util.stream.IntStream; public class D { public static void main(String[] args) { // Scanner sc = new Scanner(System.in); FastScanner sc = new FastScanne...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
62539602602cf7828b68f6ef23536517
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.*; public class Main { static class Man implements Comparable<Man>{ int idx ; TreeSet<Integer> bids; ...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
bafe26a3fb87c05fbbf93a7f8835a31c
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.math.*; import java.io.*; import java.util.*; public class C749D { public static long[] fact, factInv; public static int N,M,K; public static long MOD = 1000000007; public static void main(String[] args) throws IOException { InputReader in = new InputReader(new InputStreamReader(System.in)...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
3a650d5cabbf80ab8f5bbf96d35b5631
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.Comparator; import java.util.TreeSet; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution ...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
a8a86057ed277b5c2e1db98b74dc1273
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
//JDope import java.util.*; import java.io.*; import java.math.*; public class D{ public static void main(String[] omkar) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(in.readLine()); StringBuilder sb = new StringBuilder();...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
13dcc890e21dc8f8a4d9fedaba2734ec
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; import static java.lang.Math.*; public class D implements Runnable { public static void main(String[] args) { new Thread(null, new D(), "", 1 << 28).start(); } public void run() { Scanner sc = new Scanner(); int n = sc.nextInt(); TreeSe...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
6d1ceab2b166fd998906a58de4bcea32
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; import static java.lang.Math.*; public class D implements Runnable { public static void main(String[] args) { new Thread(null, new D(), "", 1 << 28).start(); } public void run() { Scanner sc = new Scanner(); int n = sc.nextInt(); TreeSe...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
aace17b7677e487accc086755b6a28c0
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.NoSuchElementException; import java.util.TreeSet; import java.util.List; import java.util.ArrayList; import java.util.Collections; public class Main{ static int n; static int[] max; public static void main(Stri...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
2863ada5441c0faa61ad8201a2a52890
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.InputStreamReader; import java.util.TreeSet; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.StringTokenizer; import j...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
8f7f3c5d743924a661357f81c9d231e8
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import sun.reflect.generics.tree.Tree; import java.io.*; import java.text.DecimalFormat; import java.util.*; import java.awt.Point; public class Newbie { static InputReader sc = new InputReader(System.in); static PrintWriter out = new PrintWriter(System.out); public static void main(String[] args) th...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
6a052890513bfdabdab993f1da6a66dd
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.PrintStream; import java.util.SortedSet; import java.util.Set; import java.io.IOException; import java.io.InputStreamReader; import java.util.TreeSet; import java.util.ArrayList; import java.u...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
a537d681d9cd8ab59b914748f170a336
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.util.TreeSet; public class AuctionNlogN { private void solve() throws IOException { int n = readInt(); int...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
2b18d89895264850a4238f54ec1a126d
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import javafx.scene.layout.Priority; import java.io.*; import java.lang.reflect.Array; import java.net.Inet4Address; import java.util.*; import java.lang.*; import java.util.HashMap; import java.util.PriorityQueue; public class templ implements Runnable { static class pair implements Comparable { int f...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
b15c10b5f7d1af9c9337288d27d7d3d0
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.PrintWriter; import java.util.*; /** * Created by leen on 26/12/2016. */ public class _749D { public static void main(String[] args) { Scanner scan = new Scanner(new BufferedInputStream(System.in,1024*64)); in...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
18eac5b457179e19081ac4f9bf4e3914
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class CO_749D { static int imax=Integer.MAX_VALUE,imin=Integer.MIN_VALUE; static long lmax=Long.MAX_VALUE,lmin=Long.MIN_VALUE; static long mod=(long)1e9+7; static int max[]; public static void main (String[] args) throws java.lang.Exception { In...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
e9c57ffd1e9b5f50947c46b4a1a34ad2
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.stream.IntStream; import java.util.Arrays; import java.util.HashMap; import java.io.IOException; import java.util.stream.Collectors; import java.io.InputStreamReader; import java.util.TreeSe...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
1da9c03449e5994b56d7f3937d2ac3f7
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; import java.util.HashMap; import java.util.TreeSet; import java.util.ArrayList; /** * Built using CHelper plug-in * Actual solution is at the top * * @author toshif */ public ...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
c70224e41bc15de2695fe1e1343ca4fb
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.List; import java.util.AbstractMap; import java.util.TreeMap; import java.util.Map; import java.util.Map.Entry; import java.util.Scanner; import java.util.HashMap; import java.util.ArrayList...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
dc9111608cebe34bab7469f073e61c69
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.List; import java.util.Scanner; import java.util.HashMap; import java.util.TreeSet; import java.util.ArrayList; /** * Built using CHelper plug-in * Actual solution is at the top * * @au...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
3554417f911fbab46b38430fb8f5e636
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.List; import java.util.Scanner; import java.util.HashMap; import java.util.TreeSet; import java.util.ArrayList; /** * Built using CHelper plug-in * Actual solution is at the top * * @au...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
d385529ccfef29cbacdd623177d619f1
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Set; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.StringTokenizer; import java....
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
e235b8ff432418d65148d0c034e78b37
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class q4 { //static ArrayList<Integer> g[]; static int n; static int[] mxdeal; static int[] made; static int[] price; static TreeSet<Integer> ts[]; static TreeSet<Integer> tm; public static void main(String[] ags) { InputReader in=new In...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
698883cb862543fdb24113becc1be220
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.io.*; import java.util.*; public class D { InputStream is; int __t__ = 1; int __f__ = 0; int __FILE_DEBUG_FLAG__ = __f__; String __DEBUG_FILE_NAME__ = "src/D3"; FastScanner in; PrintWriter out; int[] a, b; class Trie { int p1; // max 1st int p2; // max 2nd HashMap<Integer, Trie> childs...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
652db71e4db4564c21f92a57807449be
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.util.*; import java.io.*; public class CF749D_2{ public static int index; public static void main(String[] args)throws Exception { InputReader in = new InputReader(System.in); PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out)); int n = in.nextInt(); ArrayList<ArrayLis...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
9dd866532bd2b122d66a69d5b61e45dd
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.util.TreeSet; public class AuctionNlogN { private void solve() throws IOException { int n = readInt(); int[...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
573656e75caeb0afacd4383dec38fa16
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.io.*; import java.util.*; public class SingleTest { public static void main(String[] args){ InputReader in = new InputReader(); PrintWriter out = new PrintWriter(System.out); int test_cases = 1; Solver s = new Solver(); for (int i = 1; i <= test_cases; i++) ...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
f0613f17be9e47b5ffa4278b4fe782b7
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.io.* ; import java.util.* ; public class Codeshefcode{ public static void main(String[] args) throws IOException{ Solver Machine = new Solver() ; Machine.Solve() ; Machine.Finish() ; } } class Solver{ final long r = 1000000007 ; FasterScanner ip = new FasterScanner() ; PrintWriter op = ...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
73f31760fab47a3f0380eb38fa290240
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main { public static void main(String[] args) { ConsoleIO io = new ConsoleIO(); new Main(io).solve(); io.close(); } ConsoleIO io; Main(ConsoleIO io) { ...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
343b62f18477236df11ec9b862668717
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Bit...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
7626a8fe2a23055546a6226f487512cd
train_002.jsonl
1482165300
There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bi...
256 megabytes
import java.io.*; import java.util.*; /** * Created by WiNDWAY on 12/19/16. */ public class Codeforces_round_388_div_2_LeavingAuction { public static void main(String[] args) throws IOException { Reader input = new Reader(); out = new PrintWriter(new BufferedOutputStream(System.out), true); ...
Java
["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3"]
2 seconds
["2 100000\n1 10\n3 1000", "0 0\n1 10"]
NoteConsider the first sample: In the first question participant number 3 is absent so the sequence of bids looks as follows: 1 10 2 100 1 10 000 2 100 000 Participant number 2 wins with the bid 100 000. In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1 10 1 10 000 The...
Java 8
standard input
[ "data structures", "binary search" ]
33ec0c97192b7b9e2ebff32f8ea4681c
The first line of the input contains an integer n (1 ≀ n ≀ 200 000)Β β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi &lt; bi + 1)Β β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q ...
2,000
For each question print two integerΒ β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes.
standard output
PASSED
152e4923b53d0dcecff62d8453ac33fe
train_002.jsonl
1521905700
An atom of element X can exist in n distinct states with energies E1 &lt; E2 &lt; ... &lt; En. Arkady wants to build a laser on this element, using a three-level scheme. Here is a simplified description of the scheme. Three distinct states i, j and k are selected, where i &lt; j &lt; k. After that the following process...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class tlevelLaserTPointer { static int n, u; static int[] energies; public static void main(String[] args) throws Exception{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new Str...
Java
["4 4\n1 3 5 7", "10 8\n10 13 15 16 17 19 20 22 24 25", "3 1\n2 5 10"]
1 second
["0.5", "0.875", "-1"]
NoteIn the first example choose states 1, 2 and 3, so that the energy conversion efficiency becomes equal to .In the second example choose states 4, 5 and 9, so that the energy conversion efficiency becomes equal to .
Java 11
standard input
[ "two pointers", "binary search", "greedy" ]
74ed99af5a5ed51c73d68f7d4ff2c70e
The first line contains two integers n and U (3 ≀ n ≀ 105, 1 ≀ U ≀ 109) β€” the number of states and the maximum possible difference between Ek and Ei. The second line contains a sequence of integers E1, E2, ..., En (1 ≀ E1 &lt; E2... &lt; En ≀ 109). It is guaranteed that all Ei are given in increasing order.
1,600
If it is not possible to choose three states that satisfy all constraints, print -1. Otherwise, print one real number Ξ·Β β€” the maximum possible energy conversion efficiency. Your answer is considered correct its absolute or relative error does not exceed 10 - 9. Formally, let your answer be a, and the jury's answer be b...
standard output
PASSED
ecc73627a0dc10e8cc97090cbb28747e
train_002.jsonl
1521905700
An atom of element X can exist in n distinct states with energies E1 &lt; E2 &lt; ... &lt; En. Arkady wants to build a laser on this element, using a three-level scheme. Here is a simplified description of the scheme. Three distinct states i, j and k are selected, where i &lt; j &lt; k. After that the following process...
256 megabytes
import java.io.*; import java.util.*; public class Main { static class PairComparator implements Comparator<Pair> { @Override public int compare(Pair x, Pair y) { if (x.val < y.val) return -1; if (x.val > y.val) return 1; if (x.val == y.val) { if (x.ind < y.ind) return -1; if (x.ind...
Java
["4 4\n1 3 5 7", "10 8\n10 13 15 16 17 19 20 22 24 25", "3 1\n2 5 10"]
1 second
["0.5", "0.875", "-1"]
NoteIn the first example choose states 1, 2 and 3, so that the energy conversion efficiency becomes equal to .In the second example choose states 4, 5 and 9, so that the energy conversion efficiency becomes equal to .
Java 11
standard input
[ "two pointers", "binary search", "greedy" ]
74ed99af5a5ed51c73d68f7d4ff2c70e
The first line contains two integers n and U (3 ≀ n ≀ 105, 1 ≀ U ≀ 109) β€” the number of states and the maximum possible difference between Ek and Ei. The second line contains a sequence of integers E1, E2, ..., En (1 ≀ E1 &lt; E2... &lt; En ≀ 109). It is guaranteed that all Ei are given in increasing order.
1,600
If it is not possible to choose three states that satisfy all constraints, print -1. Otherwise, print one real number Ξ·Β β€” the maximum possible energy conversion efficiency. Your answer is considered correct its absolute or relative error does not exceed 10 - 9. Formally, let your answer be a, and the jury's answer be b...
standard output
PASSED
b22f1667024e4959629a2f0118bac7cc
train_002.jsonl
1521905700
An atom of element X can exist in n distinct states with energies E1 &lt; E2 &lt; ... &lt; En. Arkady wants to build a laser on this element, using a three-level scheme. Here is a simplified description of the scheme. Three distinct states i, j and k are selected, where i &lt; j &lt; k. After that the following process...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; public class ThreeLevelLaser942B { /* 1) keep an int[] of the max Ek selected for the particular value as Ei 1. back-to-front, while the cur. val of Ek works, continue 2. else binary search to find the max value ...
Java
["4 4\n1 3 5 7", "10 8\n10 13 15 16 17 19 20 22 24 25", "3 1\n2 5 10"]
1 second
["0.5", "0.875", "-1"]
NoteIn the first example choose states 1, 2 and 3, so that the energy conversion efficiency becomes equal to .In the second example choose states 4, 5 and 9, so that the energy conversion efficiency becomes equal to .
Java 11
standard input
[ "two pointers", "binary search", "greedy" ]
74ed99af5a5ed51c73d68f7d4ff2c70e
The first line contains two integers n and U (3 ≀ n ≀ 105, 1 ≀ U ≀ 109) β€” the number of states and the maximum possible difference between Ek and Ei. The second line contains a sequence of integers E1, E2, ..., En (1 ≀ E1 &lt; E2... &lt; En ≀ 109). It is guaranteed that all Ei are given in increasing order.
1,600
If it is not possible to choose three states that satisfy all constraints, print -1. Otherwise, print one real number Ξ·Β β€” the maximum possible energy conversion efficiency. Your answer is considered correct its absolute or relative error does not exceed 10 - 9. Formally, let your answer be a, and the jury's answer be b...
standard output
PASSED
4713c1a0150713b8cbcfbbe5868dc492
train_002.jsonl
1520696100
Alice has a string consisting of characters 'A', 'B' and 'C'. Bob can use the following transitions on any substring of our string in any order any number of times: A BC B AC C AB AAA empty string Note that a substring is one or more consecutive characters. For given queries, determine whether it is possible t...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
["AABCCBAAB\nABCB\n5\n1 3 1 2\n2 2 2 4\n7 9 1 1\n3 4 2 3\n4 5 1 3"]
2 seconds
["10011"]
NoteIn the first query we can achieve the result, for instance, by using transitions .The third query asks for changing AAB to AΒ β€” but in this case we are not able to get rid of the character 'B'.
Java 8
standard input
[ "constructive algorithms", "implementation", "strings" ]
98e3182f047a7e7b10be7f207b219267
The first line contains a string S (1 ≀ |S| ≀ 105). The second line contains a string T (1 ≀ |T| ≀ 105), each of these strings consists only of uppercase English letters 'A', 'B' and 'C'. The third line contains the number of queries Q (1 ≀ Q ≀ 105). The following Q lines describe queries. The i-th of these lines conta...
2,500
Print a string of Q characters, where the i-th character is '1' if the answer to the i-th query is positive, and '0' otherwise.
standard output
PASSED
b808e572f0a4986741e3c9f570e3aea9
train_002.jsonl
1520696100
Alice has a string consisting of characters 'A', 'B' and 'C'. Bob can use the following transitions on any substring of our string in any order any number of times: A BC B AC C AB AAA empty string Note that a substring is one or more consecutive characters. For given queries, determine whether it is possible t...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); // Start ------------------------------------- String s = sc.nextLine(),t = sc.nextLine()...
Java
["AABCCBAAB\nABCB\n5\n1 3 1 2\n2 2 2 4\n7 9 1 1\n3 4 2 3\n4 5 1 3"]
2 seconds
["10011"]
NoteIn the first query we can achieve the result, for instance, by using transitions .The third query asks for changing AAB to AΒ β€” but in this case we are not able to get rid of the character 'B'.
Java 8
standard input
[ "constructive algorithms", "implementation", "strings" ]
98e3182f047a7e7b10be7f207b219267
The first line contains a string S (1 ≀ |S| ≀ 105). The second line contains a string T (1 ≀ |T| ≀ 105), each of these strings consists only of uppercase English letters 'A', 'B' and 'C'. The third line contains the number of queries Q (1 ≀ Q ≀ 105). The following Q lines describe queries. The i-th of these lines conta...
2,500
Print a string of Q characters, where the i-th character is '1' if the answer to the i-th query is positive, and '0' otherwise.
standard output
PASSED
d2a2c50bd8585a482f5bbe69b6441cd5
train_002.jsonl
1520696100
Alice has a string consisting of characters 'A', 'B' and 'C'. Bob can use the following transitions on any substring of our string in any order any number of times: A BC B AC C AB AAA empty string Note that a substring is one or more consecutive characters. For given queries, determine whether it is possible t...
256 megabytes
import java.io.*; import java.util.*; public class Main { public Main() throws IOException { } static void solve() throws IOException { String s = input.readLine(); String t = input.readLine(); rl(); int n = ni2(); int ls = s.length(); int lt = t.length(); ...
Java
["AABCCBAAB\nABCB\n5\n1 3 1 2\n2 2 2 4\n7 9 1 1\n3 4 2 3\n4 5 1 3"]
2 seconds
["10011"]
NoteIn the first query we can achieve the result, for instance, by using transitions .The third query asks for changing AAB to AΒ β€” but in this case we are not able to get rid of the character 'B'.
Java 8
standard input
[ "constructive algorithms", "implementation", "strings" ]
98e3182f047a7e7b10be7f207b219267
The first line contains a string S (1 ≀ |S| ≀ 105). The second line contains a string T (1 ≀ |T| ≀ 105), each of these strings consists only of uppercase English letters 'A', 'B' and 'C'. The third line contains the number of queries Q (1 ≀ Q ≀ 105). The following Q lines describe queries. The i-th of these lines conta...
2,500
Print a string of Q characters, where the i-th character is '1' if the answer to the i-th query is positive, and '0' otherwise.
standard output
PASSED
b66cdbebd9425eee60855f8cc8e52631
train_002.jsonl
1520696100
Alice has a string consisting of characters 'A', 'B' and 'C'. Bob can use the following transitions on any substring of our string in any order any number of times: A BC B AC C AB AAA empty string Note that a substring is one or more consecutive characters. For given queries, determine whether it is possible t...
256 megabytes
import java.io.BufferedReader; // import java.io.FileInputStream; // import java.io.FileOutputStream; import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import java.io.PrintWriter; import java.util.*; import static java.lang.Math.min; import static java.util.Arrays.copyOf; import...
Java
["AABCCBAAB\nABCB\n5\n1 3 1 2\n2 2 2 4\n7 9 1 1\n3 4 2 3\n4 5 1 3"]
2 seconds
["10011"]
NoteIn the first query we can achieve the result, for instance, by using transitions .The third query asks for changing AAB to AΒ β€” but in this case we are not able to get rid of the character 'B'.
Java 8
standard input
[ "constructive algorithms", "implementation", "strings" ]
98e3182f047a7e7b10be7f207b219267
The first line contains a string S (1 ≀ |S| ≀ 105). The second line contains a string T (1 ≀ |T| ≀ 105), each of these strings consists only of uppercase English letters 'A', 'B' and 'C'. The third line contains the number of queries Q (1 ≀ Q ≀ 105). The following Q lines describe queries. The i-th of these lines conta...
2,500
Print a string of Q characters, where the i-th character is '1' if the answer to the i-th query is positive, and '0' otherwise.
standard output
PASSED
1c0a81132063e4757784956b443372d7
train_002.jsonl
1520696100
Alice has a string consisting of characters 'A', 'B' and 'C'. Bob can use the following transitions on any substring of our string in any order any number of times: A BC B AC C AB AAA empty string Note that a substring is one or more consecutive characters. For given queries, determine whether it is possible t...
256 megabytes
import java.io.*; import java.util.*; public class Template implements Runnable { BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer(""); void init() throws FileNotFoundException { try { in = new BufferedReader(new FileReader("input.txt")); o...
Java
["AABCCBAAB\nABCB\n5\n1 3 1 2\n2 2 2 4\n7 9 1 1\n3 4 2 3\n4 5 1 3"]
2 seconds
["10011"]
NoteIn the first query we can achieve the result, for instance, by using transitions .The third query asks for changing AAB to AΒ β€” but in this case we are not able to get rid of the character 'B'.
Java 8
standard input
[ "constructive algorithms", "implementation", "strings" ]
98e3182f047a7e7b10be7f207b219267
The first line contains a string S (1 ≀ |S| ≀ 105). The second line contains a string T (1 ≀ |T| ≀ 105), each of these strings consists only of uppercase English letters 'A', 'B' and 'C'. The third line contains the number of queries Q (1 ≀ Q ≀ 105). The following Q lines describe queries. The i-th of these lines conta...
2,500
Print a string of Q characters, where the i-th character is '1' if the answer to the i-th query is positive, and '0' otherwise.
standard output
PASSED
4a032760abb4bc77979872d670226210
train_002.jsonl
1520696100
Alice has a string consisting of characters 'A', 'B' and 'C'. Bob can use the following transitions on any substring of our string in any order any number of times: A BC B AC C AB AAA empty string Note that a substring is one or more consecutive characters. For given queries, determine whether it is possible t...
256 megabytes
import java.util.*; import java.io.*; public class D { FastScanner in; PrintWriter out; boolean systemIO = true; public static void quickSort(int[] a, int from, int to) { if (to - from <= 1) { return; } int i = from; int j = to - 1; int x = a[from + (new Random()).nextInt(to - from)]; while (i <= j...
Java
["AABCCBAAB\nABCB\n5\n1 3 1 2\n2 2 2 4\n7 9 1 1\n3 4 2 3\n4 5 1 3"]
2 seconds
["10011"]
NoteIn the first query we can achieve the result, for instance, by using transitions .The third query asks for changing AAB to AΒ β€” but in this case we are not able to get rid of the character 'B'.
Java 8
standard input
[ "constructive algorithms", "implementation", "strings" ]
98e3182f047a7e7b10be7f207b219267
The first line contains a string S (1 ≀ |S| ≀ 105). The second line contains a string T (1 ≀ |T| ≀ 105), each of these strings consists only of uppercase English letters 'A', 'B' and 'C'. The third line contains the number of queries Q (1 ≀ Q ≀ 105). The following Q lines describe queries. The i-th of these lines conta...
2,500
Print a string of Q characters, where the i-th character is '1' if the answer to the i-th query is positive, and '0' otherwise.
standard output
PASSED
7f73ceecfa15d88976444e6926735eca
train_002.jsonl
1369927800
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≀ li &lt; ri ≀ n...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import static java.lang.System.in; ...
Java
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
2 seconds
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
null
Java 8
standard input
[ "dp", "implementation" ]
b30e09449309b999473e4be6643d68cd
The first line contains string s of length n (2 ≀ n ≀ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≀ m ≀ 105) β€” the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
1,100
Print m integers β€” the answers to the queries in the order in which they are given in the input.
standard output
PASSED
e28c6481596de6b637eb6b24c9da3843
train_002.jsonl
1369927800
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≀ li &lt; ri ≀ n...
256 megabytes
import java.util.Scanner; public class IlyaandQueries_B { public static void main(String[] args) { Scanner console=new Scanner(System.in); String str=console.next(); int m=console.nextInt(); int arr[][]=new int[m][2]; int same[]=new int[str.length()]; ...
Java
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
2 seconds
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
null
Java 8
standard input
[ "dp", "implementation" ]
b30e09449309b999473e4be6643d68cd
The first line contains string s of length n (2 ≀ n ≀ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≀ m ≀ 105) β€” the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
1,100
Print m integers β€” the answers to the queries in the order in which they are given in the input.
standard output
PASSED
85df31610c17335bf0de23def2baa643
train_002.jsonl
1369927800
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≀ li &lt; ri ≀ n...
256 megabytes
import java.util.Scanner; public class ilya { public static void main(String[] args) { EingabeReader reader = new EingabeReader(); String s = reader.nextString(); int testCases = reader.readInt(); int[] dp = new int[s.length()]; int sum = 0, index =1; for(int i = 1; i < s.length();i++) { if(s.charA...
Java
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
2 seconds
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
null
Java 8
standard input
[ "dp", "implementation" ]
b30e09449309b999473e4be6643d68cd
The first line contains string s of length n (2 ≀ n ≀ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≀ m ≀ 105) β€” the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
1,100
Print m integers β€” the answers to the queries in the order in which they are given in the input.
standard output
PASSED
9c099d6044195043bf0ecc1ef92fbd47
train_002.jsonl
1369927800
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≀ li &lt; ri ≀ n...
256 megabytes
import java.util.*; public class Solution { public static void main(String[] args) throws java.lang.Exception { Scanner in = new Scanner(System.in); String ch = in.next(); int mat[] = new int[ch.length()]; mat[0] = 0; for (int j = 1; j < ch.length(); j++) { mat...
Java
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
2 seconds
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
null
Java 8
standard input
[ "dp", "implementation" ]
b30e09449309b999473e4be6643d68cd
The first line contains string s of length n (2 ≀ n ≀ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≀ m ≀ 105) β€” the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
1,100
Print m integers β€” the answers to the queries in the order in which they are given in the input.
standard output
PASSED
51f0cfd7d6547d21ff2a39e0c9d100c9
train_002.jsonl
1369927800
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≀ li &lt; ri ≀ n...
256 megabytes
import java.util.Scanner; public class Mainho { public static void main(String args[]) { Scanner scan = new Scanner(System.in); String s = scan.next(); int n = scan.nextInt(); int[] a = new int[s.length()]; for (int i = 1; i < s.length(); i++) { a[i] = a[i - 1]; if(s.charAt(i) == s.charAt(i - 1)){ ...
Java
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
2 seconds
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
null
Java 8
standard input
[ "dp", "implementation" ]
b30e09449309b999473e4be6643d68cd
The first line contains string s of length n (2 ≀ n ≀ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≀ m ≀ 105) β€” the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
1,100
Print m integers β€” the answers to the queries in the order in which they are given in the input.
standard output
PASSED
480e756c1b7f90944b2a9d1b1488e5cf
train_002.jsonl
1369927800
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≀ li &lt; ri ≀ n...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; public class Queries { public static void main(String[] args) throws IOException { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); String line=in.readLine(); int n=Integ...
Java
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
2 seconds
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
null
Java 8
standard input
[ "dp", "implementation" ]
b30e09449309b999473e4be6643d68cd
The first line contains string s of length n (2 ≀ n ≀ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≀ m ≀ 105) β€” the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
1,100
Print m integers β€” the answers to the queries in the order in which they are given in the input.
standard output
PASSED
6b7600d0c1ea9df5ea1d20d4544de0cf
train_002.jsonl
1369927800
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≀ li &lt; ri ≀ n...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; public class Queries { public static void main(String[] args) throws IOException { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); String line=in.readLine(); int n=Integ...
Java
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
2 seconds
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
null
Java 8
standard input
[ "dp", "implementation" ]
b30e09449309b999473e4be6643d68cd
The first line contains string s of length n (2 ≀ n ≀ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≀ m ≀ 105) β€” the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
1,100
Print m integers β€” the answers to the queries in the order in which they are given in the input.
standard output
PASSED
bb5cf94f0e7ef7ca60291a6c148f2fbd
train_002.jsonl
1369927800
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≀ li &lt; ri ≀ n...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Reader; import java.io.StreamTokenizer; import java.io.Writer; import java.util.Scanner; public class Tmp { private static Reader reader = new I...
Java
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
2 seconds
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
null
Java 8
standard input
[ "dp", "implementation" ]
b30e09449309b999473e4be6643d68cd
The first line contains string s of length n (2 ≀ n ≀ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≀ m ≀ 105) β€” the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
1,100
Print m integers β€” the answers to the queries in the order in which they are given in the input.
standard output
PASSED
45dc2ea8bf4c0847a71fc4bce4ad6cc3
train_002.jsonl
1369927800
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≀ li &lt; ri ≀ n...
256 megabytes
import java.util.*; public class CodeForces { public static void main(String args[]) { Scanner sc=new Scanner(System.in); String s=sc.next(); StringBuilder sb=new StringBuilder(); int arr[]=new int[s.length()-1]; for(int i=0;i<s.length()-1;i++) { if(s...
Java
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
2 seconds
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
null
Java 8
standard input
[ "dp", "implementation" ]
b30e09449309b999473e4be6643d68cd
The first line contains string s of length n (2 ≀ n ≀ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≀ m ≀ 105) β€” the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
1,100
Print m integers β€” the answers to the queries in the order in which they are given in the input.
standard output
PASSED
f96d65aa40eaf7ed332dc15c9a94bb1f
train_002.jsonl
1369927800
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≀ li &lt; ri ≀ n...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String a= in.next(); int arr[] = new int[a.length()]; arr[0]=0; for(int i=1;i<a.length();i++){ if(a.charAt(i)==a.charAt(i-1)){ arr[i]= arr[i-1]+1; } else arr[i]=arr[i-1]; } ...
Java
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
2 seconds
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
null
Java 8
standard input
[ "dp", "implementation" ]
b30e09449309b999473e4be6643d68cd
The first line contains string s of length n (2 ≀ n ≀ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≀ m ≀ 105) β€” the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
1,100
Print m integers β€” the answers to the queries in the order in which they are given in the input.
standard output
PASSED
2289abc51034b7cfa3545f269cf5e792
train_002.jsonl
1369927800
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≀ li &lt; ri ≀ n...
256 megabytes
//import javafx.util.Pair; import javax.swing.text.MaskFormatter; import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { public static void main(String[] args){ Scanner in=new Scanner(System.in); String S=in.next(); int n=S.length(); char[]s=S.to...
Java
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
2 seconds
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
null
Java 8
standard input
[ "dp", "implementation" ]
b30e09449309b999473e4be6643d68cd
The first line contains string s of length n (2 ≀ n ≀ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≀ m ≀ 105) β€” the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
1,100
Print m integers β€” the answers to the queries in the order in which they are given in the input.
standard output
PASSED
5f71cbb0d68b6874e9d1d1f621774409
train_002.jsonl
1369927800
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≀ li &lt; ri ≀ n...
256 megabytes
import java.util.*; import java.lang.*; public class Main { public static void main (String[] args) { Scanner in = new Scanner(System.in); String s = in.nextLine(); int len = s.length(); int[] arr = new int[len]; for (int i=1; i<len; i++){ if (s.charAt(i)==s.cha...
Java
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
2 seconds
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
null
Java 8
standard input
[ "dp", "implementation" ]
b30e09449309b999473e4be6643d68cd
The first line contains string s of length n (2 ≀ n ≀ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≀ m ≀ 105) β€” the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
1,100
Print m integers β€” the answers to the queries in the order in which they are given in the input.
standard output
PASSED
e21baf1f90137acbaea7a60700f19e00
train_002.jsonl
1369927800
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≀ li &lt; ri ≀ n...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Scanner; public class IlyaandQueries { public static void main(String[] args) throws IOException { Scanner scan= new Scanner(System.in); BufferedReader br = new BufferedReader(...
Java
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
2 seconds
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
null
Java 8
standard input
[ "dp", "implementation" ]
b30e09449309b999473e4be6643d68cd
The first line contains string s of length n (2 ≀ n ≀ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≀ m ≀ 105) β€” the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
1,100
Print m integers β€” the answers to the queries in the order in which they are given in the input.
standard output
PASSED
017442e34a16047e2a800c8d949170b6
train_002.jsonl
1369927800
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≀ li &lt; ri ≀ n...
256 megabytes
import java.io.BufferedReader; // 313B import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class Liya_and_Queries_dp_implementation { static final int N_INF=-99999; static int dp[]=new int[100009]; public static void main(String[] args) thr...
Java
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
2 seconds
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
null
Java 8
standard input
[ "dp", "implementation" ]
b30e09449309b999473e4be6643d68cd
The first line contains string s of length n (2 ≀ n ≀ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≀ m ≀ 105) β€” the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
1,100
Print m integers β€” the answers to the queries in the order in which they are given in the input.
standard output
PASSED
d7fce8e1cbfed923bc419afada59b111
train_002.jsonl
1369927800
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≀ li &lt; ri ≀ n...
256 megabytes
// 313B import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class Liya_and_Queries_dp_implementation { static final int N_INF=-99999; public static void main(String[] args) throws IOException { FastReader sc=...
Java
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
2 seconds
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
null
Java 8
standard input
[ "dp", "implementation" ]
b30e09449309b999473e4be6643d68cd
The first line contains string s of length n (2 ≀ n ≀ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≀ m ≀ 105) β€” the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
1,100
Print m integers β€” the answers to the queries in the order in which they are given in the input.
standard output
PASSED
cf6531d20814320d13a8d1f19932325f
train_002.jsonl
1369927800
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≀ li &lt; ri ≀ n...
256 megabytes
import java.awt.Point; import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.*; import java.util.*; public class Main { ////// static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedRe...
Java
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
2 seconds
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
null
Java 8
standard input
[ "dp", "implementation" ]
b30e09449309b999473e4be6643d68cd
The first line contains string s of length n (2 ≀ n ≀ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≀ m ≀ 105) β€” the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
1,100
Print m integers β€” the answers to the queries in the order in which they are given in the input.
standard output
PASSED
59c25eb33e0ff809625f476d6be263b1
train_002.jsonl
1330804800
Cool J has recently become a businessman Mr. Jackson, and he has to make a lot of phone calls now. Today he has n calls planned. For each call we know the moment ti (in seconds since the start of the day) when it is scheduled to start and its duration di (in seconds). All ti are different. Mr. Jackson is a very importa...
256 megabytes
//package vkqual1; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Locale; import java.util.StringTokenizer; public class Main { private void solve() throws IOException { int n = nextInt(); int k = nextInt(); if (n == 0...
Java
["3 2\n30000 15000\n40000 15000\n50000 15000", "5 1\n1 20000\n10000 10000\n20000 20000\n25000 10000\n80000 60000"]
3 seconds
["49999", "39999"]
NoteIn the first sample the most convenient way is to ignore the first two calls.In the second sample it is best to ignore the third call. In this case Mr. Jackson will have been speaking: first call: from 1-st to 20000-th second, second call: from 20001-st to 30000-th second, fourth call: from 30001-st to 40000-th ...
Java 6
standard input
[ "dp", "sortings", "*special" ]
936f883476039e9e5b698a1d45cbe61a
The first input line contains a pair of integers n, k (0 ≀ k ≀ n ≀ 4000) separated by a space. Following n lines contain the description of calls for today. The description of each call is located on the single line and consists of two space-separated integers ti and di, (1 ≀ ti, di ≀ 86400). All ti are distinct, the c...
1,900
Print a number from 0 to 86400, inclusive β€” the maximally possible number of seconds for Mr. Jackson to sleep today.
standard output
PASSED
9da7aefe98139079d71379f7938cfa3a
train_002.jsonl
1330804800
Cool J has recently become a businessman Mr. Jackson, and he has to make a lot of phone calls now. Today he has n calls planned. For each call we know the moment ti (in seconds since the start of the day) when it is scheduled to start and its duration di (in seconds). All ti are different. Mr. Jackson is a very importa...
256 megabytes
import java.awt.Point; import java.io.*; import java.math.BigInteger; import java.util.*; import static java.lang.Math.*; public class E implements Runnable{ final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; BufferedReader in; PrintWriter out; StringTokenizer tok = n...
Java
["3 2\n30000 15000\n40000 15000\n50000 15000", "5 1\n1 20000\n10000 10000\n20000 20000\n25000 10000\n80000 60000"]
3 seconds
["49999", "39999"]
NoteIn the first sample the most convenient way is to ignore the first two calls.In the second sample it is best to ignore the third call. In this case Mr. Jackson will have been speaking: first call: from 1-st to 20000-th second, second call: from 20001-st to 30000-th second, fourth call: from 30001-st to 40000-th ...
Java 6
standard input
[ "dp", "sortings", "*special" ]
936f883476039e9e5b698a1d45cbe61a
The first input line contains a pair of integers n, k (0 ≀ k ≀ n ≀ 4000) separated by a space. Following n lines contain the description of calls for today. The description of each call is located on the single line and consists of two space-separated integers ti and di, (1 ≀ ti, di ≀ 86400). All ti are distinct, the c...
1,900
Print a number from 0 to 86400, inclusive β€” the maximally possible number of seconds for Mr. Jackson to sleep today.
standard output
PASSED
bd0fbc02d7fca07d3ac55559a7b9f55a
train_002.jsonl
1330804800
Cool J has recently become a businessman Mr. Jackson, and he has to make a lot of phone calls now. Today he has n calls planned. For each call we know the moment ti (in seconds since the start of the day) when it is scheduled to start and its duration di (in seconds). All ti are different. Mr. Jackson is a very importa...
256 megabytes
import java.awt.Point; import java.io.*; import java.math.BigInteger; import java.util.*; import static java.lang.Math.*; public class E { final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE")!=null; BufferedReader in; PrintWriter out; StringTokenizer tok = new Strin...
Java
["3 2\n30000 15000\n40000 15000\n50000 15000", "5 1\n1 20000\n10000 10000\n20000 20000\n25000 10000\n80000 60000"]
3 seconds
["49999", "39999"]
NoteIn the first sample the most convenient way is to ignore the first two calls.In the second sample it is best to ignore the third call. In this case Mr. Jackson will have been speaking: first call: from 1-st to 20000-th second, second call: from 20001-st to 30000-th second, fourth call: from 30001-st to 40000-th ...
Java 6
standard input
[ "dp", "sortings", "*special" ]
936f883476039e9e5b698a1d45cbe61a
The first input line contains a pair of integers n, k (0 ≀ k ≀ n ≀ 4000) separated by a space. Following n lines contain the description of calls for today. The description of each call is located on the single line and consists of two space-separated integers ti and di, (1 ≀ ti, di ≀ 86400). All ti are distinct, the c...
1,900
Print a number from 0 to 86400, inclusive β€” the maximally possible number of seconds for Mr. Jackson to sleep today.
standard output
PASSED
c08ed093c4c226cdc24a005e47a3d37c
train_002.jsonl
1330804800
Cool J has recently become a businessman Mr. Jackson, and he has to make a lot of phone calls now. Today he has n calls planned. For each call we know the moment ti (in seconds since the start of the day) when it is scheduled to start and its duration di (in seconds). All ti are different. Mr. Jackson is a very importa...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class E { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int []t = new int [n+1], d = new int [n+1]; for (int i = 1; i <=n; i++) { ...
Java
["3 2\n30000 15000\n40000 15000\n50000 15000", "5 1\n1 20000\n10000 10000\n20000 20000\n25000 10000\n80000 60000"]
3 seconds
["49999", "39999"]
NoteIn the first sample the most convenient way is to ignore the first two calls.In the second sample it is best to ignore the third call. In this case Mr. Jackson will have been speaking: first call: from 1-st to 20000-th second, second call: from 20001-st to 30000-th second, fourth call: from 30001-st to 40000-th ...
Java 6
standard input
[ "dp", "sortings", "*special" ]
936f883476039e9e5b698a1d45cbe61a
The first input line contains a pair of integers n, k (0 ≀ k ≀ n ≀ 4000) separated by a space. Following n lines contain the description of calls for today. The description of each call is located on the single line and consists of two space-separated integers ti and di, (1 ≀ ti, di ≀ 86400). All ti are distinct, the c...
1,900
Print a number from 0 to 86400, inclusive β€” the maximally possible number of seconds for Mr. Jackson to sleep today.
standard output
PASSED
cc01a460ce506977e0118ffd1b2463cd
train_002.jsonl
1330804800
Cool J has recently become a businessman Mr. Jackson, and he has to make a lot of phone calls now. Today he has n calls planned. For each call we know the moment ti (in seconds since the start of the day) when it is scheduled to start and its duration di (in seconds). All ti are different. Mr. Jackson is a very importa...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.URI; import java.util.Arrays; import java.util.StringTokenizer; public class Main implements Runnable { /** * @param args */ public stat...
Java
["3 2\n30000 15000\n40000 15000\n50000 15000", "5 1\n1 20000\n10000 10000\n20000 20000\n25000 10000\n80000 60000"]
3 seconds
["49999", "39999"]
NoteIn the first sample the most convenient way is to ignore the first two calls.In the second sample it is best to ignore the third call. In this case Mr. Jackson will have been speaking: first call: from 1-st to 20000-th second, second call: from 20001-st to 30000-th second, fourth call: from 30001-st to 40000-th ...
Java 6
standard input
[ "dp", "sortings", "*special" ]
936f883476039e9e5b698a1d45cbe61a
The first input line contains a pair of integers n, k (0 ≀ k ≀ n ≀ 4000) separated by a space. Following n lines contain the description of calls for today. The description of each call is located on the single line and consists of two space-separated integers ti and di, (1 ≀ ti, di ≀ 86400). All ti are distinct, the c...
1,900
Print a number from 0 to 86400, inclusive β€” the maximally possible number of seconds for Mr. Jackson to sleep today.
standard output
PASSED
f7bc31c3b3be3fd84ed1c0171142deb4
train_002.jsonl
1330804800
Cool J has recently become a businessman Mr. Jackson, and he has to make a lot of phone calls now. Today he has n calls planned. For each call we know the moment ti (in seconds since the start of the day) when it is scheduled to start and its duration di (in seconds). All ti are different. Mr. Jackson is a very importa...
256 megabytes
import java.io.*; /** * User: Igor Kirov * Date: 04.03.12 */ public class E { private StreamTokenizer in; private PrintWriter out; private void run() throws IOException { init(); int n = nextInt(); int k = nextInt(); int[] min = new int[k+10]; for (int i = 1; i<...
Java
["3 2\n30000 15000\n40000 15000\n50000 15000", "5 1\n1 20000\n10000 10000\n20000 20000\n25000 10000\n80000 60000"]
3 seconds
["49999", "39999"]
NoteIn the first sample the most convenient way is to ignore the first two calls.In the second sample it is best to ignore the third call. In this case Mr. Jackson will have been speaking: first call: from 1-st to 20000-th second, second call: from 20001-st to 30000-th second, fourth call: from 30001-st to 40000-th ...
Java 6
standard input
[ "dp", "sortings", "*special" ]
936f883476039e9e5b698a1d45cbe61a
The first input line contains a pair of integers n, k (0 ≀ k ≀ n ≀ 4000) separated by a space. Following n lines contain the description of calls for today. The description of each call is located on the single line and consists of two space-separated integers ti and di, (1 ≀ ti, di ≀ 86400). All ti are distinct, the c...
1,900
Print a number from 0 to 86400, inclusive β€” the maximally possible number of seconds for Mr. Jackson to sleep today.
standard output
PASSED
a6e85ec01c926bd4f0111e84c5cea41b
train_002.jsonl
1330804800
Cool J has recently become a businessman Mr. Jackson, and he has to make a lot of phone calls now. Today he has n calls planned. For each call we know the moment ti (in seconds since the start of the day) when it is scheduled to start and its duration di (in seconds). All ti are different. Mr. Jackson is a very importa...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class Solution { static int[] t; static int[] d; static int n; static int k; static final int secAfterDayEnd = 86401; static int[][] M; ...
Java
["3 2\n30000 15000\n40000 15000\n50000 15000", "5 1\n1 20000\n10000 10000\n20000 20000\n25000 10000\n80000 60000"]
3 seconds
["49999", "39999"]
NoteIn the first sample the most convenient way is to ignore the first two calls.In the second sample it is best to ignore the third call. In this case Mr. Jackson will have been speaking: first call: from 1-st to 20000-th second, second call: from 20001-st to 30000-th second, fourth call: from 30001-st to 40000-th ...
Java 6
standard input
[ "dp", "sortings", "*special" ]
936f883476039e9e5b698a1d45cbe61a
The first input line contains a pair of integers n, k (0 ≀ k ≀ n ≀ 4000) separated by a space. Following n lines contain the description of calls for today. The description of each call is located on the single line and consists of two space-separated integers ti and di, (1 ≀ ti, di ≀ 86400). All ti are distinct, the c...
1,900
Print a number from 0 to 86400, inclusive β€” the maximally possible number of seconds for Mr. Jackson to sleep today.
standard output
PASSED
dc3916aeef4668fca70b8bf187a766ed
train_002.jsonl
1330804800
Cool J has recently become a businessman Mr. Jackson, and he has to make a lot of phone calls now. Today he has n calls planned. For each call we know the moment ti (in seconds since the start of the day) when it is scheduled to start and its duration di (in seconds). All ti are different. Mr. Jackson is a very importa...
256 megabytes
import java.lang.*; import java.io.*; import java.util.*; import java.math.*; public class E implements Runnable{ public void run() { int n = nextInt(); int k = nextInt(); int[][] dp = new int[n+1][k+1]; int[] tt = new int[n]; int[] dd = new int[n]; ...
Java
["3 2\n30000 15000\n40000 15000\n50000 15000", "5 1\n1 20000\n10000 10000\n20000 20000\n25000 10000\n80000 60000"]
3 seconds
["49999", "39999"]
NoteIn the first sample the most convenient way is to ignore the first two calls.In the second sample it is best to ignore the third call. In this case Mr. Jackson will have been speaking: first call: from 1-st to 20000-th second, second call: from 20001-st to 30000-th second, fourth call: from 30001-st to 40000-th ...
Java 6
standard input
[ "dp", "sortings", "*special" ]
936f883476039e9e5b698a1d45cbe61a
The first input line contains a pair of integers n, k (0 ≀ k ≀ n ≀ 4000) separated by a space. Following n lines contain the description of calls for today. The description of each call is located on the single line and consists of two space-separated integers ti and di, (1 ≀ ti, di ≀ 86400). All ti are distinct, the c...
1,900
Print a number from 0 to 86400, inclusive β€” the maximally possible number of seconds for Mr. Jackson to sleep today.
standard output
PASSED
83e29d21474c93d8dd9033255193fb19
train_002.jsonl
1330804800
Cool J has recently become a businessman Mr. Jackson, and he has to make a lot of phone calls now. Today he has n calls planned. For each call we know the moment ti (in seconds since the start of the day) when it is scheduled to start and its duration di (in seconds). All ti are different. Mr. Jackson is a very importa...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.fill; import static java.util.Arrays.binarySearch; import static java.util.Arrays.sort; public class Main { public static void main(String[] args) throws IOException { new Thread(null, new Runnable() { public voi...
Java
["3 2\n30000 15000\n40000 15000\n50000 15000", "5 1\n1 20000\n10000 10000\n20000 20000\n25000 10000\n80000 60000"]
3 seconds
["49999", "39999"]
NoteIn the first sample the most convenient way is to ignore the first two calls.In the second sample it is best to ignore the third call. In this case Mr. Jackson will have been speaking: first call: from 1-st to 20000-th second, second call: from 20001-st to 30000-th second, fourth call: from 30001-st to 40000-th ...
Java 6
standard input
[ "dp", "sortings", "*special" ]
936f883476039e9e5b698a1d45cbe61a
The first input line contains a pair of integers n, k (0 ≀ k ≀ n ≀ 4000) separated by a space. Following n lines contain the description of calls for today. The description of each call is located on the single line and consists of two space-separated integers ti and di, (1 ≀ ti, di ≀ 86400). All ti are distinct, the c...
1,900
Print a number from 0 to 86400, inclusive β€” the maximally possible number of seconds for Mr. Jackson to sleep today.
standard output
PASSED
01c348fa4d9f942f2a05e2fb10278e28
train_002.jsonl
1330804800
Cool J has recently become a businessman Mr. Jackson, and he has to make a lot of phone calls now. Today he has n calls planned. For each call we know the moment ti (in seconds since the start of the day) when it is scheduled to start and its duration di (in seconds). All ti are different. Mr. Jackson is a very importa...
256 megabytes
import java.util.Scanner; public class E { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int n = sc.nextInt(), k = sc.nextInt(); int[] t = new int[n + 1], d = new int[n + 1]; for (int i = 1; i <= n; ++i) { t[i] = sc.nextInt(); d[i] = sc.nextInt(); ...
Java
["3 2\n30000 15000\n40000 15000\n50000 15000", "5 1\n1 20000\n10000 10000\n20000 20000\n25000 10000\n80000 60000"]
3 seconds
["49999", "39999"]
NoteIn the first sample the most convenient way is to ignore the first two calls.In the second sample it is best to ignore the third call. In this case Mr. Jackson will have been speaking: first call: from 1-st to 20000-th second, second call: from 20001-st to 30000-th second, fourth call: from 30001-st to 40000-th ...
Java 6
standard input
[ "dp", "sortings", "*special" ]
936f883476039e9e5b698a1d45cbe61a
The first input line contains a pair of integers n, k (0 ≀ k ≀ n ≀ 4000) separated by a space. Following n lines contain the description of calls for today. The description of each call is located on the single line and consists of two space-separated integers ti and di, (1 ≀ ti, di ≀ 86400). All ti are distinct, the c...
1,900
Print a number from 0 to 86400, inclusive β€” the maximally possible number of seconds for Mr. Jackson to sleep today.
standard output
PASSED
0614a8ec9ae66c579baf945b4e10636a
train_002.jsonl
1330804800
Cool J has recently become a businessman Mr. Jackson, and he has to make a lot of phone calls now. Today he has n calls planned. For each call we know the moment ti (in seconds since the start of the day) when it is scheduled to start and its duration di (in seconds). All ti are different. Mr. Jackson is a very importa...
256 megabytes
import java.awt.Point; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.InputMismatchException; public class E_2012 { static p[] st; static int[][] DP; public static int call(int index, int k) { if (index == -1 && k == 0) return 1; ...
Java
["3 2\n30000 15000\n40000 15000\n50000 15000", "5 1\n1 20000\n10000 10000\n20000 20000\n25000 10000\n80000 60000"]
3 seconds
["49999", "39999"]
NoteIn the first sample the most convenient way is to ignore the first two calls.In the second sample it is best to ignore the third call. In this case Mr. Jackson will have been speaking: first call: from 1-st to 20000-th second, second call: from 20001-st to 30000-th second, fourth call: from 30001-st to 40000-th ...
Java 6
standard input
[ "dp", "sortings", "*special" ]
936f883476039e9e5b698a1d45cbe61a
The first input line contains a pair of integers n, k (0 ≀ k ≀ n ≀ 4000) separated by a space. Following n lines contain the description of calls for today. The description of each call is located on the single line and consists of two space-separated integers ti and di, (1 ≀ ti, di ≀ 86400). All ti are distinct, the c...
1,900
Print a number from 0 to 86400, inclusive β€” the maximally possible number of seconds for Mr. Jackson to sleep today.
standard output
PASSED
e841f9bed6c7bcd6965b7375b36395a4
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.*; import java.util.*; public class A1008 { public static void main(String [] args) throws Exception { InputStream inputReader = System.in; OutputStream outputReader = System.out; InputReader in = new InputReader(new FileInputStream(new File("input.txt")));//new InputReader(i...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 8
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≀ n ≀ 1000 and 1 ≀ k ≀ n) β€” the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number β€” the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
a9121ddef2ea4cb2d139806ba901b0dc
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
//package com.company; import java.util.*; import java.io.*; import java.util.Scanner; public class A { public static void main(String[] args) throws Exception{ // write your code here Scanner sc = new Scanner(new File("input.txt")); PrintWriter out = new PrintWriter(new File("output.txt")); ...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 8
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≀ n ≀ 1000 and 1 ≀ k ≀ n) β€” the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number β€” the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
325c9879e6067ce9fef7277a5b60643d
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.FileReader; import java.io.FileWriter; //import java.lang.StringBuilder; import java.util.StringTokenizer; //import java.lang.Comparable; //import java....
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 8
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≀ n ≀ 1000 and 1 ≀ k ≀ n) β€” the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number β€” the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
cf61e1ed4e552744163a4b668104831e
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.Properties; import java.util.Scanner; import java.util.StringTokenizer; /** * Created by sanan on 4/12/15. */ public class Main { static int c; static String S; static String [] SS1; static int n,k; public static void main(Strin...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 8
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≀ n ≀ 1000 and 1 ≀ k ≀ n) β€” the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number β€” the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
00700ba4372b6a402d35247675b0e44c
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.*; import java.util.*; public class kuchBhi{ public static void main(String[] args) throws Throwable{ // BufferedReader br = new BufferedReader(new FileReader("input.txt")); // String in = br.nextLine(); Scanner sc = new Scanner(new File("input.txt")); BufferedWriter br1 = new BufferedWriter(new...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 8
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≀ n ≀ 1000 and 1 ≀ k ≀ n) β€” the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number β€” the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
84642511f543d2233ea6da0fc0901398
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.*; import java.util.*; public final class code // public class Main // class code // public class Solution { static void solve()throws IOException { int n=nextInt(); int k=nextInt(); int a[]=new int[n+1]; for(int i=1;i<=n;i++) { a[i]=nextInt(); ...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 8
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≀ n ≀ 1000 and 1 ≀ k ≀ n) β€” the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number β€” the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
9f2deafa2d067f00e7cd4b798f40fb72
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.io.IOException; import java.util.InputMismatchException; import java.io.FileOutputStream; import java.io.FileInputStream; import java.util.NoSuchElementException;...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 8
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≀ n ≀ 1000 and 1 ≀ k ≀ n) β€” the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number β€” the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
18d02a9ac16b2a9658c5f216abbd4da3
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.*; import java.util.*; public class kuchBhi{ public static void main(String[] args) throws Throwable{ // BufferedReader br = new BufferedReader(new FileReader("input.txt")); // String in = br.nextLine(); Scanner sc = new Scanner(new File("input.txt")); BufferedWri...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 8
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≀ n ≀ 1000 and 1 ≀ k ≀ n) β€” the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number β€” the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
8691b63a323a50c7cd0972826fe0bad1
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
//package codeforces; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.Closeable; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; im...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 8
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≀ n ≀ 1000 and 1 ≀ k ≀ n) β€” the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number β€” the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
d21667d0dff2e1d1e92e7d524ddaafac
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.Scanner; public class B120 { public static void main(String[] args) throws IOException { Scanner in = new Scanner(new File("input.txt")); PrintWriter out = new PrintWriter(new File("output.txt")); ...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 8
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≀ n ≀ 1000 and 1 ≀ k ≀ n) β€” the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number β€” the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
69add6e7ce3db22e3d9ce8e90b91ff9b
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.*; import java.util.StringTokenizer; /** * 120B * ΞΈ(n) time * ΞΈ(n) space * * @author artyom */ public class _120B implements Runnable { private BufferedReader in; private StringTokenizer tok; private Object solve() throws IOException { int n = nextInt(), k = nextInt(); ...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 8
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≀ n ≀ 1000 and 1 ≀ k ≀ n) β€” the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number β€” the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
fe893854c0a0412f3b65bc65a17c15e5
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
//package que_a; import java.io.*; import java.util.*; import java.math.*; public class utkarsh { InputStream is; PrintWriter out; long mod = (long) (1e9 + 7), inf = (long) (3e18); void solve() { int n = ni(), k = ni()-1; int a[] = na(n); while(a[k] == 0) { ...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 8
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≀ n ≀ 1000 and 1 ≀ k ≀ n) β€” the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number β€” the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
3017c47f03ff574db7216f0d5605bcaa
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.util.StringTokenizer; public class B { private void Problem() throws IOException { int n = nextInt(), k = nextInt(), a[] = new int[n+1]; ...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≀ n ≀ 1000 and 1 ≀ k ≀ n) β€” the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number β€” the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
218e3881c8ceea25cd8f09d8b5981744
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.*; import java.util.*; public class CodeForces implements Runnable { void solve() throws IOException { int n = nextInt(); int p = nextInt(); int []a= new int[n]; for(int i=0;i<n;i++) a[i]=nextInt(); if(a[p-1]==1) ...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≀ n ≀ 1000 and 1 ≀ k ≀ n) β€” the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number β€” the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
49715cf2364e949f433e2d5a7b882462
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; import com.sun.org.apache.bcel.internal.generic.ARRAYLENGTH; public class CodeForces { public void solve() throws IOException { int n=nextInt(); int k=nextInt()-1; int arr[]=new int[n]; for(int i=0;i<n;i++){ arr[i]=nextInt(); } while(...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≀ n ≀ 1000 and 1 ≀ k ≀ n) β€” the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number β€” the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
e3e6094eb74361561e1559d94612debe
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { public BufferedReader input; public PrintWriter output; public StringTokenizer in = new StringTokenizer(""); public ...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≀ n ≀ 1000 and 1 ≀ k ≀ n) β€” the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number β€” the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
fffe41584aa0dd6f1a22130f2a096b81
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.BufferedWriter; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { Scanner in = new Scanner(new FileReader("input.txt")); BufferedWriter out = new BufferedWriter...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≀ n ≀ 1000 and 1 ≀ k ≀ n) β€” the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number β€” the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
023ae5ddce1be0f6e404cfa815a86f14
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.*; import java.util.*; public class TaskB { BufferedReader br; PrintWriter out; StringTokenizer stok; String nextToken() throws IOException { while (stok == null || !stok.hasMoreTokens()) { String s = br.readLine(); if (s == null) { return "-1"; } stok = new StringTokenizer(s); ...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≀ n ≀ 1000 and 1 ≀ k ≀ n) β€” the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number β€” the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
3906fe4dfa0442c1cbaa3cf8da6370df
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.util.StringTokenizer; public class solution { void solve() throws IOException { int n = nextInt(), k = nextInt() - 1; int[] z = new int[1010]; for (int i = 0; i < n; ++i) { z[i] = nex...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≀ n ≀ 1000 and 1 ≀ k ≀ n) β€” the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number β€” the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt