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
421dea4d2765aa39167528ce530de417
train_110.jsonl
1662993300
Given the string $$$s$$$ of decimal digits (0-9) of length $$$n$$$.A substring is a sequence of consecutive characters of a string. The substring of this string is defined by a pair of indexes — with its left and right ends. So, each pair of indexes ($$$l, r$$$), where $$$1 \le l \le r \le n$$$, corresponds to a substr...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is...
Java
["5\n\n1003004\n\n4 1\n\n1 2 1\n\n179572007\n\n4 2\n\n2 7 3\n\n2 7 4\n\n111\n\n2 1\n\n2 2 6\n\n0000\n\n1 2\n\n1 4 0\n\n1 4 1\n\n484\n\n1 5\n\n2 2 0\n\n2 3 7\n\n1 2 5\n\n3 3 8\n\n2 2 6"]
3 seconds
["2 4\n1 5\n1 2\n-1 -1\n1 2\n-1 -1\n1 3\n1 3\n-1 -1\n-1 -1\n-1 -1"]
NoteConsider the first test case of example inputs. In this test case $$$n=7$$$, $$$s=$$$"1003004", $$$w=4$$$ and one query $$$l_1=1$$$, $$$r_1=2$$$, $$$k_1=1$$$. Note that $$$v(1,2)=10$$$. We need to find a pair of substrings of length $$$4$$$ such that $$$v(L_1, L_1+3)\cdot10+v(L_2,L_2+3)$$$ has a remainder of $$$k_1...
Java 8
standard input
[ "hashing", "math" ]
b67870dcffa7bad682ef980dacd1f3db
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — number of input test cases. The first line of each test case contains a string $$$s$$$, which contains only the characters 0-9 and has a length $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$). The second line contains two integers $$$w, m$$$ ($$$1 \le...
1,900
For each request, print in a separate line: left borders of the required substrings: $$$L_1$$$ and $$$L_2$$$; -1 -1 otherwise, if there is no solution. If there are several solutions, minimize $$$L_1$$$ first, and minimize $$$L_2$$$ second.
standard output
PASSED
b49c38bf2342dc789e0938e9e676c11d
train_110.jsonl
1662993300
Given the string $$$s$$$ of decimal digits (0-9) of length $$$n$$$.A substring is a sequence of consecutive characters of a string. The substring of this string is defined by a pair of indexes — with its left and right ends. So, each pair of indexes ($$$l, r$$$), where $$$1 \le l \le r \le n$$$, corresponds to a substr...
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.Random; import java.util.StringTokenizer; /* 1 1003004 4 1 1 2 1 */ public class F ...
Java
["5\n\n1003004\n\n4 1\n\n1 2 1\n\n179572007\n\n4 2\n\n2 7 3\n\n2 7 4\n\n111\n\n2 1\n\n2 2 6\n\n0000\n\n1 2\n\n1 4 0\n\n1 4 1\n\n484\n\n1 5\n\n2 2 0\n\n2 3 7\n\n1 2 5\n\n3 3 8\n\n2 2 6"]
3 seconds
["2 4\n1 5\n1 2\n-1 -1\n1 2\n-1 -1\n1 3\n1 3\n-1 -1\n-1 -1\n-1 -1"]
NoteConsider the first test case of example inputs. In this test case $$$n=7$$$, $$$s=$$$"1003004", $$$w=4$$$ and one query $$$l_1=1$$$, $$$r_1=2$$$, $$$k_1=1$$$. Note that $$$v(1,2)=10$$$. We need to find a pair of substrings of length $$$4$$$ such that $$$v(L_1, L_1+3)\cdot10+v(L_2,L_2+3)$$$ has a remainder of $$$k_1...
Java 8
standard input
[ "hashing", "math" ]
b67870dcffa7bad682ef980dacd1f3db
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — number of input test cases. The first line of each test case contains a string $$$s$$$, which contains only the characters 0-9 and has a length $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$). The second line contains two integers $$$w, m$$$ ($$$1 \le...
1,900
For each request, print in a separate line: left borders of the required substrings: $$$L_1$$$ and $$$L_2$$$; -1 -1 otherwise, if there is no solution. If there are several solutions, minimize $$$L_1$$$ first, and minimize $$$L_2$$$ second.
standard output
PASSED
b93cf8b219d8bd01c6d3c98635f878d9
train_110.jsonl
1662993300
Given the string $$$s$$$ of decimal digits (0-9) of length $$$n$$$.A substring is a sequence of consecutive characters of a string. The substring of this string is defined by a pair of indexes — with its left and right ends. So, each pair of indexes ($$$l, r$$$), where $$$1 \le l \le r \le n$$$, corresponds to a substr...
256 megabytes
//package kg.my_algorithms.Codeforces; /* If you can't Calculate, then Stimulate */ import java.util.*; import java.io.*; public class Solution { public static void main(String[] args) throws IOException { FastReader fr = new FastReader(); BufferedWriter output = new BufferedWrit...
Java
["5\n\n1003004\n\n4 1\n\n1 2 1\n\n179572007\n\n4 2\n\n2 7 3\n\n2 7 4\n\n111\n\n2 1\n\n2 2 6\n\n0000\n\n1 2\n\n1 4 0\n\n1 4 1\n\n484\n\n1 5\n\n2 2 0\n\n2 3 7\n\n1 2 5\n\n3 3 8\n\n2 2 6"]
3 seconds
["2 4\n1 5\n1 2\n-1 -1\n1 2\n-1 -1\n1 3\n1 3\n-1 -1\n-1 -1\n-1 -1"]
NoteConsider the first test case of example inputs. In this test case $$$n=7$$$, $$$s=$$$"1003004", $$$w=4$$$ and one query $$$l_1=1$$$, $$$r_1=2$$$, $$$k_1=1$$$. Note that $$$v(1,2)=10$$$. We need to find a pair of substrings of length $$$4$$$ such that $$$v(L_1, L_1+3)\cdot10+v(L_2,L_2+3)$$$ has a remainder of $$$k_1...
Java 8
standard input
[ "hashing", "math" ]
b67870dcffa7bad682ef980dacd1f3db
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — number of input test cases. The first line of each test case contains a string $$$s$$$, which contains only the characters 0-9 and has a length $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$). The second line contains two integers $$$w, m$$$ ($$$1 \le...
1,900
For each request, print in a separate line: left borders of the required substrings: $$$L_1$$$ and $$$L_2$$$; -1 -1 otherwise, if there is no solution. If there are several solutions, minimize $$$L_1$$$ first, and minimize $$$L_2$$$ second.
standard output
PASSED
6d9fa60837cb34e5d55e6e0b769decad
train_110.jsonl
1662993300
Given the string $$$s$$$ of decimal digits (0-9) of length $$$n$$$.A substring is a sequence of consecutive characters of a string. The substring of this string is defined by a pair of indexes — with its left and right ends. So, each pair of indexes ($$$l, r$$$), where $$$1 \le l \le r \le n$$$, corresponds to a substr...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; public class Main { static Main2 admin = new Main2(); public static void main(String[] args) { admin.start(); } } class Main2 { //---------------------------------INPUT READER-----------------------------------...
Java
["5\n\n1003004\n\n4 1\n\n1 2 1\n\n179572007\n\n4 2\n\n2 7 3\n\n2 7 4\n\n111\n\n2 1\n\n2 2 6\n\n0000\n\n1 2\n\n1 4 0\n\n1 4 1\n\n484\n\n1 5\n\n2 2 0\n\n2 3 7\n\n1 2 5\n\n3 3 8\n\n2 2 6"]
3 seconds
["2 4\n1 5\n1 2\n-1 -1\n1 2\n-1 -1\n1 3\n1 3\n-1 -1\n-1 -1\n-1 -1"]
NoteConsider the first test case of example inputs. In this test case $$$n=7$$$, $$$s=$$$"1003004", $$$w=4$$$ and one query $$$l_1=1$$$, $$$r_1=2$$$, $$$k_1=1$$$. Note that $$$v(1,2)=10$$$. We need to find a pair of substrings of length $$$4$$$ such that $$$v(L_1, L_1+3)\cdot10+v(L_2,L_2+3)$$$ has a remainder of $$$k_1...
Java 8
standard input
[ "hashing", "math" ]
b67870dcffa7bad682ef980dacd1f3db
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — number of input test cases. The first line of each test case contains a string $$$s$$$, which contains only the characters 0-9 and has a length $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$). The second line contains two integers $$$w, m$$$ ($$$1 \le...
1,900
For each request, print in a separate line: left borders of the required substrings: $$$L_1$$$ and $$$L_2$$$; -1 -1 otherwise, if there is no solution. If there are several solutions, minimize $$$L_1$$$ first, and minimize $$$L_2$$$ second.
standard output
PASSED
d35dde59e4afe5acad56818d08b3d20f
train_110.jsonl
1662993300
Given the string $$$s$$$ of decimal digits (0-9) of length $$$n$$$.A substring is a sequence of consecutive characters of a string. The substring of this string is defined by a pair of indexes — with its left and right ends. So, each pair of indexes ($$$l, r$$$), where $$$1 \le l \le r \le n$$$, corresponds to a substr...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.StringTok...
Java
["5\n\n1003004\n\n4 1\n\n1 2 1\n\n179572007\n\n4 2\n\n2 7 3\n\n2 7 4\n\n111\n\n2 1\n\n2 2 6\n\n0000\n\n1 2\n\n1 4 0\n\n1 4 1\n\n484\n\n1 5\n\n2 2 0\n\n2 3 7\n\n1 2 5\n\n3 3 8\n\n2 2 6"]
3 seconds
["2 4\n1 5\n1 2\n-1 -1\n1 2\n-1 -1\n1 3\n1 3\n-1 -1\n-1 -1\n-1 -1"]
NoteConsider the first test case of example inputs. In this test case $$$n=7$$$, $$$s=$$$"1003004", $$$w=4$$$ and one query $$$l_1=1$$$, $$$r_1=2$$$, $$$k_1=1$$$. Note that $$$v(1,2)=10$$$. We need to find a pair of substrings of length $$$4$$$ such that $$$v(L_1, L_1+3)\cdot10+v(L_2,L_2+3)$$$ has a remainder of $$$k_1...
Java 8
standard input
[ "hashing", "math" ]
b67870dcffa7bad682ef980dacd1f3db
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — number of input test cases. The first line of each test case contains a string $$$s$$$, which contains only the characters 0-9 and has a length $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$). The second line contains two integers $$$w, m$$$ ($$$1 \le...
1,900
For each request, print in a separate line: left borders of the required substrings: $$$L_1$$$ and $$$L_2$$$; -1 -1 otherwise, if there is no solution. If there are several solutions, minimize $$$L_1$$$ first, and minimize $$$L_2$$$ second.
standard output
PASSED
0817e738b6d05e88e9166757f9bd9b44
train_110.jsonl
1662993300
Given the string $$$s$$$ of decimal digits (0-9) of length $$$n$$$.A substring is a sequence of consecutive characters of a string. The substring of this string is defined by a pair of indexes — with its left and right ends. So, each pair of indexes ($$$l, r$$$), where $$$1 \le l \le r \le n$$$, corresponds to a substr...
256 megabytes
import java.io.*; import java.util.HashMap; import java.util.LinkedList; import java.util.TreeSet; public class Main { static InputReader in; static OutputWriter out; public static void main(String[] args) throws Exception { in=new InputReader(System.in); out=new OutputWriter(...
Java
["5\n\n1003004\n\n4 1\n\n1 2 1\n\n179572007\n\n4 2\n\n2 7 3\n\n2 7 4\n\n111\n\n2 1\n\n2 2 6\n\n0000\n\n1 2\n\n1 4 0\n\n1 4 1\n\n484\n\n1 5\n\n2 2 0\n\n2 3 7\n\n1 2 5\n\n3 3 8\n\n2 2 6"]
3 seconds
["2 4\n1 5\n1 2\n-1 -1\n1 2\n-1 -1\n1 3\n1 3\n-1 -1\n-1 -1\n-1 -1"]
NoteConsider the first test case of example inputs. In this test case $$$n=7$$$, $$$s=$$$"1003004", $$$w=4$$$ and one query $$$l_1=1$$$, $$$r_1=2$$$, $$$k_1=1$$$. Note that $$$v(1,2)=10$$$. We need to find a pair of substrings of length $$$4$$$ such that $$$v(L_1, L_1+3)\cdot10+v(L_2,L_2+3)$$$ has a remainder of $$$k_1...
Java 8
standard input
[ "hashing", "math" ]
b67870dcffa7bad682ef980dacd1f3db
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — number of input test cases. The first line of each test case contains a string $$$s$$$, which contains only the characters 0-9 and has a length $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$). The second line contains two integers $$$w, m$$$ ($$$1 \le...
1,900
For each request, print in a separate line: left borders of the required substrings: $$$L_1$$$ and $$$L_2$$$; -1 -1 otherwise, if there is no solution. If there are several solutions, minimize $$$L_1$$$ first, and minimize $$$L_2$$$ second.
standard output
PASSED
c61c61e465bec8be35dfd16f11cec8d6
train_110.jsonl
1662993300
Given the string $$$s$$$ of decimal digits (0-9) of length $$$n$$$.A substring is a sequence of consecutive characters of a string. The substring of this string is defined by a pair of indexes — with its left and right ends. So, each pair of indexes ($$$l, r$$$), where $$$1 \le l \le r \le n$$$, corresponds to a substr...
256 megabytes
//package codeforces.round820div3; import java.io.*; import java.util.*; import static java.lang.Math.*; public class F { static InputReader in; static PrintWriter out; public static void main(String[] args) { //initReaderPrinter(true); initReaderPrinter(false); sol...
Java
["5\n\n1003004\n\n4 1\n\n1 2 1\n\n179572007\n\n4 2\n\n2 7 3\n\n2 7 4\n\n111\n\n2 1\n\n2 2 6\n\n0000\n\n1 2\n\n1 4 0\n\n1 4 1\n\n484\n\n1 5\n\n2 2 0\n\n2 3 7\n\n1 2 5\n\n3 3 8\n\n2 2 6"]
3 seconds
["2 4\n1 5\n1 2\n-1 -1\n1 2\n-1 -1\n1 3\n1 3\n-1 -1\n-1 -1\n-1 -1"]
NoteConsider the first test case of example inputs. In this test case $$$n=7$$$, $$$s=$$$"1003004", $$$w=4$$$ and one query $$$l_1=1$$$, $$$r_1=2$$$, $$$k_1=1$$$. Note that $$$v(1,2)=10$$$. We need to find a pair of substrings of length $$$4$$$ such that $$$v(L_1, L_1+3)\cdot10+v(L_2,L_2+3)$$$ has a remainder of $$$k_1...
Java 8
standard input
[ "hashing", "math" ]
b67870dcffa7bad682ef980dacd1f3db
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — number of input test cases. The first line of each test case contains a string $$$s$$$, which contains only the characters 0-9 and has a length $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$). The second line contains two integers $$$w, m$$$ ($$$1 \le...
1,900
For each request, print in a separate line: left borders of the required substrings: $$$L_1$$$ and $$$L_2$$$; -1 -1 otherwise, if there is no solution. If there are several solutions, minimize $$$L_1$$$ first, and minimize $$$L_2$$$ second.
standard output
PASSED
172cedf5485693208e3c001d8004f00c
train_110.jsonl
1662993300
Given the string $$$s$$$ of decimal digits (0-9) of length $$$n$$$.A substring is a sequence of consecutive characters of a string. The substring of this string is defined by a pair of indexes — with its left and right ends. So, each pair of indexes ($$$l, r$$$), where $$$1 \le l \le r \le n$$$, corresponds to a substr...
256 megabytes
import java.io.*; import java.util.*; public class F { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { ...
Java
["5\n\n1003004\n\n4 1\n\n1 2 1\n\n179572007\n\n4 2\n\n2 7 3\n\n2 7 4\n\n111\n\n2 1\n\n2 2 6\n\n0000\n\n1 2\n\n1 4 0\n\n1 4 1\n\n484\n\n1 5\n\n2 2 0\n\n2 3 7\n\n1 2 5\n\n3 3 8\n\n2 2 6"]
3 seconds
["2 4\n1 5\n1 2\n-1 -1\n1 2\n-1 -1\n1 3\n1 3\n-1 -1\n-1 -1\n-1 -1"]
NoteConsider the first test case of example inputs. In this test case $$$n=7$$$, $$$s=$$$"1003004", $$$w=4$$$ and one query $$$l_1=1$$$, $$$r_1=2$$$, $$$k_1=1$$$. Note that $$$v(1,2)=10$$$. We need to find a pair of substrings of length $$$4$$$ such that $$$v(L_1, L_1+3)\cdot10+v(L_2,L_2+3)$$$ has a remainder of $$$k_1...
Java 8
standard input
[ "hashing", "math" ]
b67870dcffa7bad682ef980dacd1f3db
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — number of input test cases. The first line of each test case contains a string $$$s$$$, which contains only the characters 0-9 and has a length $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$). The second line contains two integers $$$w, m$$$ ($$$1 \le...
1,900
For each request, print in a separate line: left borders of the required substrings: $$$L_1$$$ and $$$L_2$$$; -1 -1 otherwise, if there is no solution. If there are several solutions, minimize $$$L_1$$$ first, and minimize $$$L_2$$$ second.
standard output
PASSED
05c7f3790329e039c995ce77bef89535
train_110.jsonl
1662993300
Given the string $$$s$$$ of decimal digits (0-9) of length $$$n$$$.A substring is a sequence of consecutive characters of a string. The substring of this string is defined by a pair of indexes — with its left and right ends. So, each pair of indexes ($$$l, r$$$), where $$$1 \le l \le r \le n$$$, corresponds to a substr...
256 megabytes
import java.io.*; import java.util.HashMap; import java.util.TreeSet; public class Main { static InputReader sc; public static void main(String[] args) throws Exception { sc=new InputReader(System.in); int T=sc.nextInt(); while(T-->0) { char[] str=(" "+sc.nex...
Java
["5\n\n1003004\n\n4 1\n\n1 2 1\n\n179572007\n\n4 2\n\n2 7 3\n\n2 7 4\n\n111\n\n2 1\n\n2 2 6\n\n0000\n\n1 2\n\n1 4 0\n\n1 4 1\n\n484\n\n1 5\n\n2 2 0\n\n2 3 7\n\n1 2 5\n\n3 3 8\n\n2 2 6"]
3 seconds
["2 4\n1 5\n1 2\n-1 -1\n1 2\n-1 -1\n1 3\n1 3\n-1 -1\n-1 -1\n-1 -1"]
NoteConsider the first test case of example inputs. In this test case $$$n=7$$$, $$$s=$$$"1003004", $$$w=4$$$ and one query $$$l_1=1$$$, $$$r_1=2$$$, $$$k_1=1$$$. Note that $$$v(1,2)=10$$$. We need to find a pair of substrings of length $$$4$$$ such that $$$v(L_1, L_1+3)\cdot10+v(L_2,L_2+3)$$$ has a remainder of $$$k_1...
Java 8
standard input
[ "hashing", "math" ]
b67870dcffa7bad682ef980dacd1f3db
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — number of input test cases. The first line of each test case contains a string $$$s$$$, which contains only the characters 0-9 and has a length $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$). The second line contains two integers $$$w, m$$$ ($$$1 \le...
1,900
For each request, print in a separate line: left borders of the required substrings: $$$L_1$$$ and $$$L_2$$$; -1 -1 otherwise, if there is no solution. If there are several solutions, minimize $$$L_1$$$ first, and minimize $$$L_2$$$ second.
standard output
PASSED
244e7e1cea25f787ac7b7f0cf5eab767
train_110.jsonl
1662993300
Given the string $$$s$$$ of decimal digits (0-9) of length $$$n$$$.A substring is a sequence of consecutive characters of a string. The substring of this string is defined by a pair of indexes — with its left and right ends. So, each pair of indexes ($$$l, r$$$), where $$$1 \le l \le r \le n$$$, corresponds to a substr...
256 megabytes
import java.util.*; import java.io.*; public class Main { static Scanner sc; static PrintWriter pw; static long Pow(long a, long e, long mod) // O(log e) { a %= mod; long res = 1l; while (e > 0) { if ((e & 1) == 1) res = (res * a) % mod; a = (a * a) % mod; e >>= 1l; } retur...
Java
["5\n\n1003004\n\n4 1\n\n1 2 1\n\n179572007\n\n4 2\n\n2 7 3\n\n2 7 4\n\n111\n\n2 1\n\n2 2 6\n\n0000\n\n1 2\n\n1 4 0\n\n1 4 1\n\n484\n\n1 5\n\n2 2 0\n\n2 3 7\n\n1 2 5\n\n3 3 8\n\n2 2 6"]
3 seconds
["2 4\n1 5\n1 2\n-1 -1\n1 2\n-1 -1\n1 3\n1 3\n-1 -1\n-1 -1\n-1 -1"]
NoteConsider the first test case of example inputs. In this test case $$$n=7$$$, $$$s=$$$"1003004", $$$w=4$$$ and one query $$$l_1=1$$$, $$$r_1=2$$$, $$$k_1=1$$$. Note that $$$v(1,2)=10$$$. We need to find a pair of substrings of length $$$4$$$ such that $$$v(L_1, L_1+3)\cdot10+v(L_2,L_2+3)$$$ has a remainder of $$$k_1...
Java 8
standard input
[ "hashing", "math" ]
b67870dcffa7bad682ef980dacd1f3db
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — number of input test cases. The first line of each test case contains a string $$$s$$$, which contains only the characters 0-9 and has a length $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$). The second line contains two integers $$$w, m$$$ ($$$1 \le...
1,900
For each request, print in a separate line: left borders of the required substrings: $$$L_1$$$ and $$$L_2$$$; -1 -1 otherwise, if there is no solution. If there are several solutions, minimize $$$L_1$$$ first, and minimize $$$L_2$$$ second.
standard output
PASSED
a375d70ee0579a148806c46aef054d17
train_110.jsonl
1662993300
Given the string $$$s$$$ of decimal digits (0-9) of length $$$n$$$.A substring is a sequence of consecutive characters of a string. The substring of this string is defined by a pair of indexes — with its left and right ends. So, each pair of indexes ($$$l, r$$$), where $$$1 \le l \le r \le n$$$, corresponds to a substr...
256 megabytes
import java.io.*; import java.util.*; public class Solution { public static boolean useInFile = false; public static boolean useOutFile = false; public static void main(String args[]) throws IOException { InOut inout = new InOut(); Resolver resolver = new Resolver(inout); // ...
Java
["5\n\n1003004\n\n4 1\n\n1 2 1\n\n179572007\n\n4 2\n\n2 7 3\n\n2 7 4\n\n111\n\n2 1\n\n2 2 6\n\n0000\n\n1 2\n\n1 4 0\n\n1 4 1\n\n484\n\n1 5\n\n2 2 0\n\n2 3 7\n\n1 2 5\n\n3 3 8\n\n2 2 6"]
3 seconds
["2 4\n1 5\n1 2\n-1 -1\n1 2\n-1 -1\n1 3\n1 3\n-1 -1\n-1 -1\n-1 -1"]
NoteConsider the first test case of example inputs. In this test case $$$n=7$$$, $$$s=$$$"1003004", $$$w=4$$$ and one query $$$l_1=1$$$, $$$r_1=2$$$, $$$k_1=1$$$. Note that $$$v(1,2)=10$$$. We need to find a pair of substrings of length $$$4$$$ such that $$$v(L_1, L_1+3)\cdot10+v(L_2,L_2+3)$$$ has a remainder of $$$k_1...
Java 8
standard input
[ "hashing", "math" ]
b67870dcffa7bad682ef980dacd1f3db
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — number of input test cases. The first line of each test case contains a string $$$s$$$, which contains only the characters 0-9 and has a length $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$). The second line contains two integers $$$w, m$$$ ($$$1 \le...
1,900
For each request, print in a separate line: left borders of the required substrings: $$$L_1$$$ and $$$L_2$$$; -1 -1 otherwise, if there is no solution. If there are several solutions, minimize $$$L_1$$$ first, and minimize $$$L_2$$$ second.
standard output
PASSED
1664d203befd1d02872642d312a36141
train_110.jsonl
1662993300
Given the string $$$s$$$ of decimal digits (0-9) of length $$$n$$$.A substring is a sequence of consecutive characters of a string. The substring of this string is defined by a pair of indexes — with its left and right ends. So, each pair of indexes ($$$l, r$$$), where $$$1 \le l \le r \le n$$$, corresponds to a substr...
256 megabytes
import javax.xml.stream.FactoryConfigurationError; import java.io.*; import java.util.*; public class Main { static FastScanner sc=new FastScanner(); static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); static int []fac; static final int N=200100; public static voi...
Java
["5\n\n1003004\n\n4 1\n\n1 2 1\n\n179572007\n\n4 2\n\n2 7 3\n\n2 7 4\n\n111\n\n2 1\n\n2 2 6\n\n0000\n\n1 2\n\n1 4 0\n\n1 4 1\n\n484\n\n1 5\n\n2 2 0\n\n2 3 7\n\n1 2 5\n\n3 3 8\n\n2 2 6"]
3 seconds
["2 4\n1 5\n1 2\n-1 -1\n1 2\n-1 -1\n1 3\n1 3\n-1 -1\n-1 -1\n-1 -1"]
NoteConsider the first test case of example inputs. In this test case $$$n=7$$$, $$$s=$$$"1003004", $$$w=4$$$ and one query $$$l_1=1$$$, $$$r_1=2$$$, $$$k_1=1$$$. Note that $$$v(1,2)=10$$$. We need to find a pair of substrings of length $$$4$$$ such that $$$v(L_1, L_1+3)\cdot10+v(L_2,L_2+3)$$$ has a remainder of $$$k_1...
Java 17
standard input
[ "hashing", "math" ]
b67870dcffa7bad682ef980dacd1f3db
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — number of input test cases. The first line of each test case contains a string $$$s$$$, which contains only the characters 0-9 and has a length $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$). The second line contains two integers $$$w, m$$$ ($$$1 \le...
1,900
For each request, print in a separate line: left borders of the required substrings: $$$L_1$$$ and $$$L_2$$$; -1 -1 otherwise, if there is no solution. If there are several solutions, minimize $$$L_1$$$ first, and minimize $$$L_2$$$ second.
standard output
PASSED
90bef12451f06ca48cc6f213ff361da6
train_110.jsonl
1662993300
Given the string $$$s$$$ of decimal digits (0-9) of length $$$n$$$.A substring is a sequence of consecutive characters of a string. The substring of this string is defined by a pair of indexes — with its left and right ends. So, each pair of indexes ($$$l, r$$$), where $$$1 \le l \le r \le n$$$, corresponds to a substr...
256 megabytes
import java.io.*; import java.util.*; public class Main { static FastScanner sc; static int []fac; static final int N=200100; public static void main(String[] args) { fac=new int[N]; fac[0]=1; for( int i=1;i<N;i++){ fac[i]=fac[i-1]*10%9; } ...
Java
["5\n\n1003004\n\n4 1\n\n1 2 1\n\n179572007\n\n4 2\n\n2 7 3\n\n2 7 4\n\n111\n\n2 1\n\n2 2 6\n\n0000\n\n1 2\n\n1 4 0\n\n1 4 1\n\n484\n\n1 5\n\n2 2 0\n\n2 3 7\n\n1 2 5\n\n3 3 8\n\n2 2 6"]
3 seconds
["2 4\n1 5\n1 2\n-1 -1\n1 2\n-1 -1\n1 3\n1 3\n-1 -1\n-1 -1\n-1 -1"]
NoteConsider the first test case of example inputs. In this test case $$$n=7$$$, $$$s=$$$"1003004", $$$w=4$$$ and one query $$$l_1=1$$$, $$$r_1=2$$$, $$$k_1=1$$$. Note that $$$v(1,2)=10$$$. We need to find a pair of substrings of length $$$4$$$ such that $$$v(L_1, L_1+3)\cdot10+v(L_2,L_2+3)$$$ has a remainder of $$$k_1...
Java 17
standard input
[ "hashing", "math" ]
b67870dcffa7bad682ef980dacd1f3db
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — number of input test cases. The first line of each test case contains a string $$$s$$$, which contains only the characters 0-9 and has a length $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$). The second line contains two integers $$$w, m$$$ ($$$1 \le...
1,900
For each request, print in a separate line: left borders of the required substrings: $$$L_1$$$ and $$$L_2$$$; -1 -1 otherwise, if there is no solution. If there are several solutions, minimize $$$L_1$$$ first, and minimize $$$L_2$$$ second.
standard output
PASSED
8bcfedc0fcf5532571363afeac0a8192
train_110.jsonl
1662993300
Given the string $$$s$$$ of decimal digits (0-9) of length $$$n$$$.A substring is a sequence of consecutive characters of a string. The substring of this string is defined by a pair of indexes — with its left and right ends. So, each pair of indexes ($$$l, r$$$), where $$$1 \le l \le r \le n$$$, corresponds to a substr...
256 megabytes
import java.util.*; import java.io.*; public class F { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int tc = Integer.parseInt(br.readLine()); StringBuilder sb = new StringBuilder(); ...
Java
["5\n\n1003004\n\n4 1\n\n1 2 1\n\n179572007\n\n4 2\n\n2 7 3\n\n2 7 4\n\n111\n\n2 1\n\n2 2 6\n\n0000\n\n1 2\n\n1 4 0\n\n1 4 1\n\n484\n\n1 5\n\n2 2 0\n\n2 3 7\n\n1 2 5\n\n3 3 8\n\n2 2 6"]
3 seconds
["2 4\n1 5\n1 2\n-1 -1\n1 2\n-1 -1\n1 3\n1 3\n-1 -1\n-1 -1\n-1 -1"]
NoteConsider the first test case of example inputs. In this test case $$$n=7$$$, $$$s=$$$"1003004", $$$w=4$$$ and one query $$$l_1=1$$$, $$$r_1=2$$$, $$$k_1=1$$$. Note that $$$v(1,2)=10$$$. We need to find a pair of substrings of length $$$4$$$ such that $$$v(L_1, L_1+3)\cdot10+v(L_2,L_2+3)$$$ has a remainder of $$$k_1...
Java 17
standard input
[ "hashing", "math" ]
b67870dcffa7bad682ef980dacd1f3db
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — number of input test cases. The first line of each test case contains a string $$$s$$$, which contains only the characters 0-9 and has a length $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$). The second line contains two integers $$$w, m$$$ ($$$1 \le...
1,900
For each request, print in a separate line: left borders of the required substrings: $$$L_1$$$ and $$$L_2$$$; -1 -1 otherwise, if there is no solution. If there are several solutions, minimize $$$L_1$$$ first, and minimize $$$L_2$$$ second.
standard output
PASSED
f0d8194a43c3f685b43818844b6ca402
train_110.jsonl
1662993300
Given the string $$$s$$$ of decimal digits (0-9) of length $$$n$$$.A substring is a sequence of consecutive characters of a string. The substring of this string is defined by a pair of indexes — with its left and right ends. So, each pair of indexes ($$$l, r$$$), where $$$1 \le l \le r \le n$$$, corresponds to a substr...
256 megabytes
import java.util.*; import java.io.*; public class F { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); int tc = sc.nextInt(); StringBuilder sb = new StringBuilder(); while (tc-->0){ String s = sc.next();...
Java
["5\n\n1003004\n\n4 1\n\n1 2 1\n\n179572007\n\n4 2\n\n2 7 3\n\n2 7 4\n\n111\n\n2 1\n\n2 2 6\n\n0000\n\n1 2\n\n1 4 0\n\n1 4 1\n\n484\n\n1 5\n\n2 2 0\n\n2 3 7\n\n1 2 5\n\n3 3 8\n\n2 2 6"]
3 seconds
["2 4\n1 5\n1 2\n-1 -1\n1 2\n-1 -1\n1 3\n1 3\n-1 -1\n-1 -1\n-1 -1"]
NoteConsider the first test case of example inputs. In this test case $$$n=7$$$, $$$s=$$$"1003004", $$$w=4$$$ and one query $$$l_1=1$$$, $$$r_1=2$$$, $$$k_1=1$$$. Note that $$$v(1,2)=10$$$. We need to find a pair of substrings of length $$$4$$$ such that $$$v(L_1, L_1+3)\cdot10+v(L_2,L_2+3)$$$ has a remainder of $$$k_1...
Java 17
standard input
[ "hashing", "math" ]
b67870dcffa7bad682ef980dacd1f3db
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — number of input test cases. The first line of each test case contains a string $$$s$$$, which contains only the characters 0-9 and has a length $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$). The second line contains two integers $$$w, m$$$ ($$$1 \le...
1,900
For each request, print in a separate line: left borders of the required substrings: $$$L_1$$$ and $$$L_2$$$; -1 -1 otherwise, if there is no solution. If there are several solutions, minimize $$$L_1$$$ first, and minimize $$$L_2$$$ second.
standard output
PASSED
7972b98c181471022347326632061927
train_110.jsonl
1662993300
Given the string $$$s$$$ of decimal digits (0-9) of length $$$n$$$.A substring is a sequence of consecutive characters of a string. The substring of this string is defined by a pair of indexes — with its left and right ends. So, each pair of indexes ($$$l, r$$$), where $$$1 \le l \le r \le n$$$, corresponds to a substr...
256 megabytes
import java.io.*; import java.util.*; public class Main { static InputReader sc; static PrintWriter out; private static final int maxn = (int)(1e5 + 7); public static void solve() throws Exception { char[] str = sc.next().toCharArray(); int w = sc.nextInt(), q = sc.nextInt();...
Java
["5\n\n1003004\n\n4 1\n\n1 2 1\n\n179572007\n\n4 2\n\n2 7 3\n\n2 7 4\n\n111\n\n2 1\n\n2 2 6\n\n0000\n\n1 2\n\n1 4 0\n\n1 4 1\n\n484\n\n1 5\n\n2 2 0\n\n2 3 7\n\n1 2 5\n\n3 3 8\n\n2 2 6"]
3 seconds
["2 4\n1 5\n1 2\n-1 -1\n1 2\n-1 -1\n1 3\n1 3\n-1 -1\n-1 -1\n-1 -1"]
NoteConsider the first test case of example inputs. In this test case $$$n=7$$$, $$$s=$$$"1003004", $$$w=4$$$ and one query $$$l_1=1$$$, $$$r_1=2$$$, $$$k_1=1$$$. Note that $$$v(1,2)=10$$$. We need to find a pair of substrings of length $$$4$$$ such that $$$v(L_1, L_1+3)\cdot10+v(L_2,L_2+3)$$$ has a remainder of $$$k_1...
Java 17
standard input
[ "hashing", "math" ]
b67870dcffa7bad682ef980dacd1f3db
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — number of input test cases. The first line of each test case contains a string $$$s$$$, which contains only the characters 0-9 and has a length $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$). The second line contains two integers $$$w, m$$$ ($$$1 \le...
1,900
For each request, print in a separate line: left borders of the required substrings: $$$L_1$$$ and $$$L_2$$$; -1 -1 otherwise, if there is no solution. If there are several solutions, minimize $$$L_1$$$ first, and minimize $$$L_2$$$ second.
standard output
PASSED
96be338191461ab09f8d93a1b1b3baf1
train_110.jsonl
1662993300
Given the string $$$s$$$ of decimal digits (0-9) of length $$$n$$$.A substring is a sequence of consecutive characters of a string. The substring of this string is defined by a pair of indexes — with its left and right ends. So, each pair of indexes ($$$l, r$$$), where $$$1 \le l \le r \le n$$$, corresponds to a substr...
256 megabytes
import java.io.*; import java.util.*; public class Main { static InputReader sc; public static void solve() throws Exception { char[] str = sc.next().toCharArray(); int w = sc.nextInt(), q = sc.nextInt(); int[] v = new int[str.length + 1]; for(int i = 0; i < str.lengt...
Java
["5\n\n1003004\n\n4 1\n\n1 2 1\n\n179572007\n\n4 2\n\n2 7 3\n\n2 7 4\n\n111\n\n2 1\n\n2 2 6\n\n0000\n\n1 2\n\n1 4 0\n\n1 4 1\n\n484\n\n1 5\n\n2 2 0\n\n2 3 7\n\n1 2 5\n\n3 3 8\n\n2 2 6"]
3 seconds
["2 4\n1 5\n1 2\n-1 -1\n1 2\n-1 -1\n1 3\n1 3\n-1 -1\n-1 -1\n-1 -1"]
NoteConsider the first test case of example inputs. In this test case $$$n=7$$$, $$$s=$$$"1003004", $$$w=4$$$ and one query $$$l_1=1$$$, $$$r_1=2$$$, $$$k_1=1$$$. Note that $$$v(1,2)=10$$$. We need to find a pair of substrings of length $$$4$$$ such that $$$v(L_1, L_1+3)\cdot10+v(L_2,L_2+3)$$$ has a remainder of $$$k_1...
Java 17
standard input
[ "hashing", "math" ]
b67870dcffa7bad682ef980dacd1f3db
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — number of input test cases. The first line of each test case contains a string $$$s$$$, which contains only the characters 0-9 and has a length $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$). The second line contains two integers $$$w, m$$$ ($$$1 \le...
1,900
For each request, print in a separate line: left borders of the required substrings: $$$L_1$$$ and $$$L_2$$$; -1 -1 otherwise, if there is no solution. If there are several solutions, minimize $$$L_1$$$ first, and minimize $$$L_2$$$ second.
standard output
PASSED
f7a61cbc5e0422c899db8f34210ad7ec
train_110.jsonl
1662993300
Given the string $$$s$$$ of decimal digits (0-9) of length $$$n$$$.A substring is a sequence of consecutive characters of a string. The substring of this string is defined by a pair of indexes — with its left and right ends. So, each pair of indexes ($$$l, r$$$), where $$$1 \le l \le r \le n$$$, corresponds to a substr...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; public class TaskF { public static void main(String[] args) { FastReader reader = new FastReader(); int tt = reader.nextInt(); // int tt ...
Java
["5\n\n1003004\n\n4 1\n\n1 2 1\n\n179572007\n\n4 2\n\n2 7 3\n\n2 7 4\n\n111\n\n2 1\n\n2 2 6\n\n0000\n\n1 2\n\n1 4 0\n\n1 4 1\n\n484\n\n1 5\n\n2 2 0\n\n2 3 7\n\n1 2 5\n\n3 3 8\n\n2 2 6"]
3 seconds
["2 4\n1 5\n1 2\n-1 -1\n1 2\n-1 -1\n1 3\n1 3\n-1 -1\n-1 -1\n-1 -1"]
NoteConsider the first test case of example inputs. In this test case $$$n=7$$$, $$$s=$$$"1003004", $$$w=4$$$ and one query $$$l_1=1$$$, $$$r_1=2$$$, $$$k_1=1$$$. Note that $$$v(1,2)=10$$$. We need to find a pair of substrings of length $$$4$$$ such that $$$v(L_1, L_1+3)\cdot10+v(L_2,L_2+3)$$$ has a remainder of $$$k_1...
Java 17
standard input
[ "hashing", "math" ]
b67870dcffa7bad682ef980dacd1f3db
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — number of input test cases. The first line of each test case contains a string $$$s$$$, which contains only the characters 0-9 and has a length $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$). The second line contains two integers $$$w, m$$$ ($$$1 \le...
1,900
For each request, print in a separate line: left borders of the required substrings: $$$L_1$$$ and $$$L_2$$$; -1 -1 otherwise, if there is no solution. If there are several solutions, minimize $$$L_1$$$ first, and minimize $$$L_2$$$ second.
standard output
PASSED
ea51ba4864d27510c7e7085ed4fea223
train_110.jsonl
1662993300
Given the string $$$s$$$ of decimal digits (0-9) of length $$$n$$$.A substring is a sequence of consecutive characters of a string. The substring of this string is defined by a pair of indexes — with its left and right ends. So, each pair of indexes ($$$l, r$$$), where $$$1 \le l \le r \le n$$$, corresponds to a substr...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; public class codeforces_820_F { private static void solve(FastIOAdapter in, PrintWriter out) { char[] s = in.next().toCharArray(); int n = s.length; int w = in.nextInt(); int m = in.nextInt(); ...
Java
["5\n\n1003004\n\n4 1\n\n1 2 1\n\n179572007\n\n4 2\n\n2 7 3\n\n2 7 4\n\n111\n\n2 1\n\n2 2 6\n\n0000\n\n1 2\n\n1 4 0\n\n1 4 1\n\n484\n\n1 5\n\n2 2 0\n\n2 3 7\n\n1 2 5\n\n3 3 8\n\n2 2 6"]
3 seconds
["2 4\n1 5\n1 2\n-1 -1\n1 2\n-1 -1\n1 3\n1 3\n-1 -1\n-1 -1\n-1 -1"]
NoteConsider the first test case of example inputs. In this test case $$$n=7$$$, $$$s=$$$"1003004", $$$w=4$$$ and one query $$$l_1=1$$$, $$$r_1=2$$$, $$$k_1=1$$$. Note that $$$v(1,2)=10$$$. We need to find a pair of substrings of length $$$4$$$ such that $$$v(L_1, L_1+3)\cdot10+v(L_2,L_2+3)$$$ has a remainder of $$$k_1...
Java 17
standard input
[ "hashing", "math" ]
b67870dcffa7bad682ef980dacd1f3db
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — number of input test cases. The first line of each test case contains a string $$$s$$$, which contains only the characters 0-9 and has a length $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$). The second line contains two integers $$$w, m$$$ ($$$1 \le...
1,900
For each request, print in a separate line: left borders of the required substrings: $$$L_1$$$ and $$$L_2$$$; -1 -1 otherwise, if there is no solution. If there are several solutions, minimize $$$L_1$$$ first, and minimize $$$L_2$$$ second.
standard output
PASSED
ecc7b375dcd5dca2cde0b0f48156d48f
train_110.jsonl
1662993300
Given the string $$$s$$$ of decimal digits (0-9) of length $$$n$$$.A substring is a sequence of consecutive characters of a string. The substring of this string is defined by a pair of indexes — with its left and right ends. So, each pair of indexes ($$$l, r$$$), where $$$1 \le l \le r \le n$$$, corresponds to a substr...
256 megabytes
// Input : Pratik import java.io.*; import java.util.*; public class JavaDeveoper { final static boolean multipleTests = true; Input in; PrintWriter out; public JavaDeveoper() { in = new Input(System.in); out = new PrintWriter(System.out); } public static void main(String[] args) { try...
Java
["5\n\n1003004\n\n4 1\n\n1 2 1\n\n179572007\n\n4 2\n\n2 7 3\n\n2 7 4\n\n111\n\n2 1\n\n2 2 6\n\n0000\n\n1 2\n\n1 4 0\n\n1 4 1\n\n484\n\n1 5\n\n2 2 0\n\n2 3 7\n\n1 2 5\n\n3 3 8\n\n2 2 6"]
3 seconds
["2 4\n1 5\n1 2\n-1 -1\n1 2\n-1 -1\n1 3\n1 3\n-1 -1\n-1 -1\n-1 -1"]
NoteConsider the first test case of example inputs. In this test case $$$n=7$$$, $$$s=$$$"1003004", $$$w=4$$$ and one query $$$l_1=1$$$, $$$r_1=2$$$, $$$k_1=1$$$. Note that $$$v(1,2)=10$$$. We need to find a pair of substrings of length $$$4$$$ such that $$$v(L_1, L_1+3)\cdot10+v(L_2,L_2+3)$$$ has a remainder of $$$k_1...
Java 17
standard input
[ "hashing", "math" ]
b67870dcffa7bad682ef980dacd1f3db
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — number of input test cases. The first line of each test case contains a string $$$s$$$, which contains only the characters 0-9 and has a length $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$). The second line contains two integers $$$w, m$$$ ($$$1 \le...
1,900
For each request, print in a separate line: left borders of the required substrings: $$$L_1$$$ and $$$L_2$$$; -1 -1 otherwise, if there is no solution. If there are several solutions, minimize $$$L_1$$$ first, and minimize $$$L_2$$$ second.
standard output
PASSED
e3fa42b8a579adcda021328772251d5a
train_110.jsonl
1662993300
Given the string $$$s$$$ of decimal digits (0-9) of length $$$n$$$.A substring is a sequence of consecutive characters of a string. The substring of this string is defined by a pair of indexes — with its left and right ends. So, each pair of indexes ($$$l, r$$$), where $$$1 \le l \le r \le n$$$, corresponds to a substr...
256 megabytes
import java.sql.Array; import java.util.*; import java.io.*; import java.math.BigInteger; import java.util.stream.IntStream; import java.util.stream.LongStream; public class Main { public static FastReader cin; public static PrintWriter out; public static void main(String[] args) throws E...
Java
["5\n\n1003004\n\n4 1\n\n1 2 1\n\n179572007\n\n4 2\n\n2 7 3\n\n2 7 4\n\n111\n\n2 1\n\n2 2 6\n\n0000\n\n1 2\n\n1 4 0\n\n1 4 1\n\n484\n\n1 5\n\n2 2 0\n\n2 3 7\n\n1 2 5\n\n3 3 8\n\n2 2 6"]
3 seconds
["2 4\n1 5\n1 2\n-1 -1\n1 2\n-1 -1\n1 3\n1 3\n-1 -1\n-1 -1\n-1 -1"]
NoteConsider the first test case of example inputs. In this test case $$$n=7$$$, $$$s=$$$"1003004", $$$w=4$$$ and one query $$$l_1=1$$$, $$$r_1=2$$$, $$$k_1=1$$$. Note that $$$v(1,2)=10$$$. We need to find a pair of substrings of length $$$4$$$ such that $$$v(L_1, L_1+3)\cdot10+v(L_2,L_2+3)$$$ has a remainder of $$$k_1...
Java 17
standard input
[ "hashing", "math" ]
b67870dcffa7bad682ef980dacd1f3db
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — number of input test cases. The first line of each test case contains a string $$$s$$$, which contains only the characters 0-9 and has a length $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$). The second line contains two integers $$$w, m$$$ ($$$1 \le...
1,900
For each request, print in a separate line: left borders of the required substrings: $$$L_1$$$ and $$$L_2$$$; -1 -1 otherwise, if there is no solution. If there are several solutions, minimize $$$L_1$$$ first, and minimize $$$L_2$$$ second.
standard output
PASSED
1b71b050da21cc830ae1e8b40030f923
train_110.jsonl
1662993300
Given the string $$$s$$$ of decimal digits (0-9) of length $$$n$$$.A substring is a sequence of consecutive characters of a string. The substring of this string is defined by a pair of indexes — with its left and right ends. So, each pair of indexes ($$$l, r$$$), where $$$1 \le l \le r \le n$$$, corresponds to a substr...
256 megabytes
import java.io.*; import java.util.*; public class F { final static boolean multipleTests = true; Input in; PrintWriter out; public F() { in = new Input(System.in); out = new PrintWriter(System.out); } public static void main(String[] args) { F solution =...
Java
["5\n\n1003004\n\n4 1\n\n1 2 1\n\n179572007\n\n4 2\n\n2 7 3\n\n2 7 4\n\n111\n\n2 1\n\n2 2 6\n\n0000\n\n1 2\n\n1 4 0\n\n1 4 1\n\n484\n\n1 5\n\n2 2 0\n\n2 3 7\n\n1 2 5\n\n3 3 8\n\n2 2 6"]
3 seconds
["2 4\n1 5\n1 2\n-1 -1\n1 2\n-1 -1\n1 3\n1 3\n-1 -1\n-1 -1\n-1 -1"]
NoteConsider the first test case of example inputs. In this test case $$$n=7$$$, $$$s=$$$"1003004", $$$w=4$$$ and one query $$$l_1=1$$$, $$$r_1=2$$$, $$$k_1=1$$$. Note that $$$v(1,2)=10$$$. We need to find a pair of substrings of length $$$4$$$ such that $$$v(L_1, L_1+3)\cdot10+v(L_2,L_2+3)$$$ has a remainder of $$$k_1...
Java 17
standard input
[ "hashing", "math" ]
b67870dcffa7bad682ef980dacd1f3db
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — number of input test cases. The first line of each test case contains a string $$$s$$$, which contains only the characters 0-9 and has a length $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$). The second line contains two integers $$$w, m$$$ ($$$1 \le...
1,900
For each request, print in a separate line: left borders of the required substrings: $$$L_1$$$ and $$$L_2$$$; -1 -1 otherwise, if there is no solution. If there are several solutions, minimize $$$L_1$$$ first, and minimize $$$L_2$$$ second.
standard output
PASSED
b14383b1d70f4172dff11b5e360a5336
train_110.jsonl
1662993300
Given the string $$$s$$$ of decimal digits (0-9) of length $$$n$$$.A substring is a sequence of consecutive characters of a string. The substring of this string is defined by a pair of indexes — with its left and right ends. So, each pair of indexes ($$$l, r$$$), where $$$1 \le l \le r \le n$$$, corresponds to a substr...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class Template { FastScanner in; PrintWriter out; public void solve() throws IOException { int t = in.nextInt(); for (int cs = 0; cs < t; cs++) { String s = in.next(); // System.out.println("LENGTH: " + s.len...
Java
["5\n\n1003004\n\n4 1\n\n1 2 1\n\n179572007\n\n4 2\n\n2 7 3\n\n2 7 4\n\n111\n\n2 1\n\n2 2 6\n\n0000\n\n1 2\n\n1 4 0\n\n1 4 1\n\n484\n\n1 5\n\n2 2 0\n\n2 3 7\n\n1 2 5\n\n3 3 8\n\n2 2 6"]
3 seconds
["2 4\n1 5\n1 2\n-1 -1\n1 2\n-1 -1\n1 3\n1 3\n-1 -1\n-1 -1\n-1 -1"]
NoteConsider the first test case of example inputs. In this test case $$$n=7$$$, $$$s=$$$"1003004", $$$w=4$$$ and one query $$$l_1=1$$$, $$$r_1=2$$$, $$$k_1=1$$$. Note that $$$v(1,2)=10$$$. We need to find a pair of substrings of length $$$4$$$ such that $$$v(L_1, L_1+3)\cdot10+v(L_2,L_2+3)$$$ has a remainder of $$$k_1...
Java 17
standard input
[ "hashing", "math" ]
b67870dcffa7bad682ef980dacd1f3db
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — number of input test cases. The first line of each test case contains a string $$$s$$$, which contains only the characters 0-9 and has a length $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$). The second line contains two integers $$$w, m$$$ ($$$1 \le...
1,900
For each request, print in a separate line: left borders of the required substrings: $$$L_1$$$ and $$$L_2$$$; -1 -1 otherwise, if there is no solution. If there are several solutions, minimize $$$L_1$$$ first, and minimize $$$L_2$$$ second.
standard output
PASSED
fa4b048caded922004edea3e245718fb
train_110.jsonl
1662993300
Given the string $$$s$$$ of decimal digits (0-9) of length $$$n$$$.A substring is a sequence of consecutive characters of a string. The substring of this string is defined by a pair of indexes — with its left and right ends. So, each pair of indexes ($$$l, r$$$), where $$$1 \le l \le r \le n$$$, corresponds to a substr...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; import java.text.*; public class Main{ public static void main(String args[]) throws IOException{ Read sc=new Read(); int t=sc.nextInt(); for(int i=0;i<t;i++){ String s=sc.next(); int w=sc.nextInt();/...
Java
["5\n\n1003004\n\n4 1\n\n1 2 1\n\n179572007\n\n4 2\n\n2 7 3\n\n2 7 4\n\n111\n\n2 1\n\n2 2 6\n\n0000\n\n1 2\n\n1 4 0\n\n1 4 1\n\n484\n\n1 5\n\n2 2 0\n\n2 3 7\n\n1 2 5\n\n3 3 8\n\n2 2 6"]
3 seconds
["2 4\n1 5\n1 2\n-1 -1\n1 2\n-1 -1\n1 3\n1 3\n-1 -1\n-1 -1\n-1 -1"]
NoteConsider the first test case of example inputs. In this test case $$$n=7$$$, $$$s=$$$"1003004", $$$w=4$$$ and one query $$$l_1=1$$$, $$$r_1=2$$$, $$$k_1=1$$$. Note that $$$v(1,2)=10$$$. We need to find a pair of substrings of length $$$4$$$ such that $$$v(L_1, L_1+3)\cdot10+v(L_2,L_2+3)$$$ has a remainder of $$$k_1...
Java 17
standard input
[ "hashing", "math" ]
b67870dcffa7bad682ef980dacd1f3db
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — number of input test cases. The first line of each test case contains a string $$$s$$$, which contains only the characters 0-9 and has a length $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$). The second line contains two integers $$$w, m$$$ ($$$1 \le...
1,900
For each request, print in a separate line: left borders of the required substrings: $$$L_1$$$ and $$$L_2$$$; -1 -1 otherwise, if there is no solution. If there are several solutions, minimize $$$L_1$$$ first, and minimize $$$L_2$$$ second.
standard output
PASSED
b8a594861be2763e19976988f9758056
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.*; public class Guess_the_Cycle_Size { static FastScanner fs; static FastWriter fw; static boolean checkOnlineJudge = System.getProperty("ONLINE_JUDGE") == null; private static final int[][] kdir = new int[][]{{-1, 2}, {-2, 1}, {-2, -1}, {-1, -2}, {1, -2}, ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
7372b78b8902c87dc48a94937cc491d3
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
// import java.io.*; // import java.util.*; // public class Q5{ // public static void main(String[] args) throws IOException { // BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); // long a = 1, b = 2; // long ans = 0; // int cnt = 24; // while (cnt-- > 0) { // System.out.print...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
859407ebd0be1b6bbdebbc2f7e0a4da4
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.*; public class b implements Runnable{ static ContestScanner in = new ContestScanner(); static ContestPrinter out = new ContestPrinter(); public static void main(String[] args) { new Thread(null, new b(), "main", 1<<28).start(); } public void run() { // ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
549bf991b6d2e50658434e88a2d25244
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import java.util.*; import java.io.*; import java.math.*; public class E_Guess_the_Cycle_Size { static long mod = Long.MAX_VALUE; public static void main(String[] args) { OutputStream o...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
6106c37bc95061d6e775d9c5ae4e2a0b
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.*; import java.util.StringTokenizer; public class copy { static int log=30; static int[][] ancestor; static int[] depth; static void sieveOfEratosthenes(int n, ArrayList<Integer> arr) { boolean prime[] = new boolean...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
775b223db7ed1b9fc3f29522ccf8e68c
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.*; public class new1{ static int mod = 998244353; static FastReader s = new FastReader(); public static long ask(int a, int b) { System.out.println("? " + a + " " + b); System.out.flush(); long aa = s.nextLong(); return aa; } public static void main(String[...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
43dd7d42fe109df4634620cb16cb1356
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
/* In_The_Name_Of_Allah_The_Merciful */ import java.util.*; import java.io.*; public class Cp { PrintWriter out; FastReader sc; long[] m1= {(long)(1e9+7),998244353}; long mod=m1[1]; long maxlong=Long.MAX_VALUE; long minlong=Long...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
eeba8be1e8de521dd411b2c14168f7ad
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.*; public class E2 { static IOHandler sc = new IOHandler(); public static void main(String[] args) { // TODO Auto-generated method stub solve(0); } private static void solve(int t) { long min = 1; long a = 2; long b = 3; long result = ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
41c4150865035e783bad64d6af3525de
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Test { final static private FastReader fr = new FastReader(); final static private PrintWriter out = new PrintWriter(System.out) ; final static private int mod = (int)1e9 + 7; private static void solve() { ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
530fd6da329b173e6289291b86a9d054
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.*; public class E2 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); long a = 1, b = 2; long ans = 0; int cnt = 24; while (cnt-- > 0) { System.out.println("? "+a+" "+b); ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
f710e10042ebaa69b9ea8250fdbb5501
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.*; import java.io.*; public class E1729{ static FastScanner fs = null; public static void main(String[] args) { fs = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int t = 1; while(t-->0){ long ans = (long)0; for(int i=2;i<=26;i++){ System.out.println(...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
e37bcfb73b2fb04e0118b77a1b6e0e1d
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
/** * Created by Himanshu **/ import java.util.*; import java.io.*; public class E1729 { static final int ALPHABET_SIZE = 26; static Reader s = new Reader(); public static void main(String[] args) throws IOException { long start = 1L , end = (long) (1e17) * 5L; // while (true)...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
22c7a33608bd437764ea9b7a206c3fc1
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.*; public class Main { static FastScanner fs; public static void main(String[] args) { fs=new FastScanner(); PrintWriter out = new PrintWriter(System.out); /****** CODE STARTS HERE *****/ //---------------------------------------------------------------------...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
21042cfa74cd1e278c98b11bf7f8cfaf
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.Comparator; import java.util.PriorityQueue; public class Main { static class Pair{ long n1, n2; long dist; Pair(long n1, long n2, long d) { this.n1= Math.min(n1, n2); this.n2 = Math.max(n1, n2); dist = d; ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
a91219dc3baff497380fef5a6b0c9536
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws IOException { BufferedReader f=new BufferedReader(new InputStreamReader(...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
6f79bcf5dfdfef28b7cb826b0dc26110
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
//codeforces //package someAlgorithms; import java.util.*; import java.io.*; import java.lang.*; import java.io.File; public class Main { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
05f69df5cc7886ffbda66c32461f870e
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; public final class Solution{ static StringTokenizer st; static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); static int pi(String s) { re...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
c0b5c2f29b80191d16c930afeddc694c
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
/* "Everything in the universe is balanced. Every disappointment you face in life will be balanced by something good for you! Keep going, never give up." Just have Patience + 1... */ import java.util.*; import java.lang...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
af43548943d75ae1f563390e33f0a3bc
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; // @author : Dinosparton public class test { static class Pair{ long x; long y; Pair(long x,long y){ this.x = x; this.y = y; } } static class Compare { ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
8f9b4d6a42ff0a15e5cfd4fe69ff5e03
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.PrintWriter; import java.util.Scanner; public class E { public static void main(String[] args) { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int first = 1; int second = 2; for (int i = 0; i < 25; i++) { ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
4720f64c833de41c50d619dbac5eff5f
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
//package com.rajan.codeforces.contests.contest820; import java.io.*; public class ProblemE { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
8578953f6833905dd291b85b23842907
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static Scanner obj = new Scanner(System.in); public static PrintWriter out = new PrintWriter(System.out); public static void solve() { for(int i=1;;i++) { for(int j=1;j<i;j++) { System.out.println("? "+i+" "+j); ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
55521dc024372ea1b1cb0ec208b4413a
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import j...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
b29c1a7c689d93aa504e5e5770f4ac91
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.*; public class Main { public static void main(String[] args) { new MainClass().execute(); } } class MainClass extends PrintWriter { MainClass() { super(System.out, true); } boolean cases = false; // Solution void...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
bfda9e6b1963c92e3173e416125d5e64
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
//package com.company; import java.io.*; import java.util.*; public class Main{ static final Random random = new Random(); static boolean[] primecheck; static ArrayList<Integer>[] adj; static int[] vis; static int[] parent; static int[] rank; static int[] fact; static in...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
5312d2c7cb315f5976679b359aeedb9b
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
//Some of the methods are copied from GeeksforGeeks Website import java.util.*; import java.lang.*; import java.io.*; @SuppressWarnings("unchecked") public class E_Guess_the_Cycle_Size { //static Scanner sc=new Scanner(System.in); //static Reader sc=new Reader(); static FastReader sc=new FastReader(...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
e6f4e71c362556966ce0715052b98d56
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.*; public class C820P5 { public static void main(String[] args) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); long min = -1; long count = 0; boolean tf = true; for (int i = 2; i < 50; i++) { if (tf) { ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
f47f365ccc3131fac652aa70df994d5a
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
//package com.example.practice.codeforces; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; public class Solution { public sta...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
2bcaf1d1ab2f71e1e7d7ffd3af6da70d
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
//package com.example.practice.codeforces; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; public class Solution { public sta...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
fbde656591cd602a3a7fb5283084e5cf
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.*; public class e { public static void main(String[] args) { Scanner in = new Scanner(System.in); long ans = 3; for (int i = 2; i <= 25; i++) { System.out.printf("? 1 %d\n", i); System.out.flush(); long a = in.nextLong(); System.out.printf("? %d 1\n", i)...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
98dcb31d74f86beba0a06de1cf4eabaa
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.*; public class ProblemB { static int n; public static void main(String[] args) throws Exception { Scanner in = new Scanner(); long ans = 0; for(int i =2;i<=27;i++){ System.out.println("? "+1+" "+i); System.out.flush(); long x = in.readLong();...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
55a4bf27596d758dc680219d7de15639
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.Scanner; public class guess_cycle { public static void main(String[] args) { solve(); } public static void solve(){ Scanner sc = new Scanner(System.in); for(int i=2; i<27; i++){ System.out.println("? " + 1 + " " + i);...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
a586187803359bb94eabe71844069e63
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.*; import java.util.Map.Entry; import static java.lang.Math.*; /** * * * @author adnan **/ @SuppressWarnings("unchecked") public class CodeForces { final static String no = "NO"; final static String yes = "YES"; final static int maxV = Integer.MAX_VALUE; fin...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
32cd888361ff69d4799e2712f6e23fc3
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.Scanner; public class E { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // long lef = 1, right = (long) 1e18; // long ans = 0; // while(lef<=right){ // long mid = lef+right>>1; // String que = "? "+1 + ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
40a4d38df3d47c8a3ffe9f486c3523b9
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
//Utilities import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { long x, y; boolean found = false; for (int i = 1; i <= 25; i++) { System.out.println("? " + 1 + " " + (i+1)); System.out.flush(); x = in.lscan(); System...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
3585f3d7c16e65ada97c72635cf421dd
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.*; import java.io.*; public class Main { private static final void solve() throws IOException { ou.println("? 1 2").flush(); long x = nl(); ou.println("? 2 1").flush(); long xx = nl(); if (x != xx) { ou.print("! ").println(x + xx).flush(); ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
7a659894f011fdcd4749d3742890a03c
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.math.BigDecimal; import java.math.BigInteger; import java.text.DecimalFormat; import java.util.*; public class Main { static final long MOD1=1000000007; static final long MOD=998244353; static final in...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
1f97caa6bb77d2550116adb8f8c448d4
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.*; /** * @author atulanand */ public class Solution { static class Result { BufferedReader br; public Result(BufferedReader br) throws IOException { this.br = br; long res = solve(); System.out.printf("! %d\n", res); } pub...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
03fc4dcc16b081800b5649b27ac7e69d
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.*; public class Codeforces{ public static void main(String[] args) { Scanner cs = new Scanner(System.in); long result = 3; for(int i=1;i<=25;i++) { System.out.println("? "+i+" "+(i+1)); long val=cs.nextLong(); Syste...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
84f02f8cf7220b9c467258c66fb5a010
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
// LARGEST SQUARE // package com.company /* * @author :: Yuvraj Singh * CS UNDERGRAD AT IT GGV BILASPUR */ import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; import static java.lang.Math.*; import static java.lang.System.out; public class Main { // Solution h...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
d0da11a75e163491bfacf2d85f893fd8
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.*; public class E{ public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st; PrintWriter pw = new PrintWriter(System.out); for(int i = 2; i ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
b17065c02faaf53de27890e033d9fb12
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.PrintWriter; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int first = 1; int second = 2; for (int i = 0; i < 25; i++) { ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
c34f9ab1e507e8a033fc7cede6c8ea9b
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.*; import java.io.*; public class E1729 { static final int ALPHABET_SIZE = 26; static Reader s = new Reader(); public static void main(String[] args) throws IOException { long start = 1L , end = (long) (1e17) * 5L; long ans = 0L; for (int i=0;i<50;i+=2) { ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
a1f878441872d60edfd33fcedb529574
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Random; import java.util.Scanner; import java.util.StringTokenizer; import java.util.TreeSet; /* 12 23 31 ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
e7c1a502bf1b7366b536d0e833508ebb
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.*; public class gh{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); long result=3; for(int i=1;i<=25;i++) { System.out.println("? "+i+" "+(i+1)); long val=sc.nextLong(); System.out.println(...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
e636ae0d2d487b4bc226ae599d8e3f60
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static int INF = 0x3f3f3f3f, mod = 1000000007, mod9 = 998244353; public static void main(String args[]){ try { PrintWriter o = new PrintWriter(System.out); boolean multiTest = false; // init ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
ff9899a7c86f540aedd7faea8568508c
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.*; public class Main { public static void ask(int a, int b) { System.out.print('?'); System.out.print(' '); System.out.print(a); System.out.print(' '); System.out.println(b); System.out.flush(); } public static Boolean check(long n...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
40f846539cded39613350a7b0742d556
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.*; public class E { public static void main(String[] args) throws IOException{ FastScanner fs = new FastScanner(); int tt = 1; while(tt-- > 0) { long a, b; for (int i = 1; i <= 7; ++i) { for (int j = i + 1; j <= 7; ++j) { System.out.p...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
d8be4f91777fa84759a6cd1fad64c37b
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
// package c1729; // // Codeforces Round #820 (Div. 3) 2022-09-12 07:35 // E. Guess the Cycle Size // https://codeforces.com/contest/1729/problem/E // time limit per test 1 second; memory limit per test 256 megabytes // public class Pseudo for 'Source should satisfy regex [^{}]*public\s+(final)?\s*class\s+(\w+).*' // ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
3054cffd14b44ac322327b8edf9378bf
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
// No sorcery shall prevail. // import java.util.*; import java.io.*; public class _InVoker_ { //Variables static long mod = 1000000007; static long mod2 = 998244353; static FastReader inp= new FastReader(); static PrintWriter out= new PrintWriter(System.out); public static void main(String ar...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
b25cf6e90a19d95eaf08913b0fb42498
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
//some updates in import stuff import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import java.util.*; import java.io.*; import java.math.*; //key points learned //max space ever that could be alloted in a program to pass in cf //int[][] prefixSum = new int[...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 11
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
21ed757cf6c5a72d0c41789b9469b59a
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; public class Main { static PrintWriter w = new PrintWriter(new BufferedOutputStream(System.out)); public static void main(String[] args) throws IOException { FastScanner f = new FastScanner();...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
ca98b221cbe3a19e87b32f0b84d2c624
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; public class Main { static PrintWriter w = new PrintWriter(new BufferedOutputStream(System.out)); public static void main(String[] args) throws IOException { FastScanner f = new FastScanner();...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
31b27ac188fc2455d903b557754ec545
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.BufferedOutputStream; import java.io.DataInputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayDeque; public class dd { public static void main(String[] args) throws IOException { FastScanner scan = new FastScanner(); PrintWriter out = ne...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
2bfb78991396fb36979fd52cbd779cb8
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
//some updates in import stuff import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import java.util.*; import java.io.*; import java.math.*; //key points learned //max space ever that could be alloted in a program to pass in cf //int[][] prefixSum = new ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
83caa6d9d3e289be664509a707d37d04
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
/* Goal: Become better in CP! Key: Consistency and Discipline Desire: SDE @ Google USA Motto: Do what i Love <=> Love what i do If you don't use your brain 100%, it deteriorates gradually */ import java.util.*; import java.io.*; import java.math.*; public class Coder { static StringBuffer s...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
279700b4d713f4909dedfea002247af7
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
/* Goal: Become better in CP! Key: Consistency and Discipline Desire: SDE @ Google USA Motto: Do what i Love <=> Love what i do If you don't use your brain 100%, it deteriorates gradually */ import java.util.*; import java.io.*; import java.math.*; public class Coder { static StringBuffer s...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
4fdc64f9c5f0689e89a7056d8e58bcc0
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Set; import java.util.TreeSet; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Set<Long> ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
45a73843429bc83c4058643f86fda67d
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.*; public class Main { static Main2 admin = new Main2(); public static void main(String[] args) { admin.start(); } } class Main2 { //---------------------------------INPUT READER-----------------------------------------// public BufferedRead...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
d1d108844e542c5a1a6ed9df3b6e8c5d
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.*; public class GuessTheCycleSize { public static void solve(FastIO io) { for (int guess = 2; ; ++guess) { long ab = query(io, 1, guess); if (ab < 0) { answer(io, guess - 1); return; } long ba = query(io, guess, 1); if (ab != ba) { answer(io...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
71f10dd9564b14d395d56c2e612a77ea
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.*; public class GuessTheCycleSize { public static void solve(FastIO io) { for (int guess = 2; ; ++guess) { long ab = query(io, 1, guess); if (ab < 0) { answer(io, guess - 1); return; } long ba = query(io, guess, 1); if (ab != ba) { answer(io...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
bb90044e80859f5e1ab93234b304edae
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class GuessTheCycleSize { private static final int GUESSES = 30; private static final int MAX_QUERIES = 50; private static final long N_MAX = 1_000_000_000_000_000_000L; private static final Random RNG = new Random(); public static vo...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
6ea375c38ee7784bf9518c19525e217f
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class GuessTheCycleSize { private static final int GUESSES = 30; private static final int MAX_QUERIES = 50; private static final long N_MAX = 1_000_000_000_000_000_000L; private static final Random RNG = new Random(); public static vo...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
7205807f6998fb361b3620866956cf3a
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
//package kg.my_algorithms.Codeforces; /* If you can't Calculate, then Stimulate */ import java.util.*; import java.io.*; public class Solution { public static void main(String[] args) throws IOException { FastReader fr = new FastReader(); // BufferedWriter output = new BufferedWr...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
92fccd2f418670dacedeb9c48bae0142
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
/*========================================================================== * AUTHOR: RonWonWon * CREATED: 12.09.2022 19:59:11 /*==========================================================================*/ import java.io.*; import java.util.*; public class E { public static void main(St...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
773db135a9cb248b76127eecd0dd1965
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args) { FastScanner input = new FastScanner(); for (int i = 2; true; i++) { System.out.println("? 1 " ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
7178ebc70740f49329f462a00d7cfe7f
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args) { FastScanner input = new FastScanner(); for (int i=2; true; i++) { System.o...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
4e9753fd12d87a32b7abb75513d9effb
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.security.cert.X509CRL; import java.util.*; import java.lang.*; import java.util.stream.Collector; import java.util.stream.Collectors; @SuppressWarnings("unused") public class Main { static InputStream is; static PrintWriter out; //static String INPUT = "in.txt"; static Str...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
635c92c5d5ddd666e416215985386839
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Random; public class TaskE { public static Random random = new Random(); public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStre...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
f55c927b93eb894874f3649c02b7957c
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.File; import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { BigInteger curNode = new BigInteger("2"); BigInteger val1 = new BigInteger("-1"); BigInteger val2 = new BigInteger("-1"); Scanner scanner = new Scanner(S...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
ae074ba49acd43a1ebbb581b3d0e6732
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.util.*; public class Main{ static Scanner sc = new Scanner(System.in); public static void main(String[] args) { for(int i = 4; i <= 28; ++i){ System.out.println("? 1 " + i); System.out.flush(); long v1 = sc.nextLong(); System.out.pr...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
e5b4054a66d0b245a78ddbcc14a0d6ad
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.math.BigInteger; import java.util.*; import java.io.*; public class Vaibhav { static long bit[]; static boolean prime[]; static class Pair implements Comparable<Pair> { long x; int y; Pair(long x, int y) { this.x = x; this.y ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
8b423757255bc7d5f32f4c876d61c01d
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.*; import java.util.*; public class Solution { public static boolean useInFile = false; public static boolean useOutFile = false; public static void main(String args[]) throws IOException { InOut inout = new InOut(); Resolver resolver = new Resolver(inout); // ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
38f9b9c382b7b91320a9ea9fd8a65619
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Random; import java.util.Scanner; import java.util.StringTokenizer; import java.util.TreeSet; /* 12 23 31 ...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
21bd5dd1b10c29f834c67a2ebbef26d8
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
//package kg.my_algorithms.Codeforces; /* If you can't Calculate, then Stimulate */ import java.util.*; import java.io.*; public class Solution { public static void main(String[] args) throws IOException { FastReader fr = new FastReader(); // BufferedWriter output = new BufferedWr...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output
PASSED
28cd8e66c1e37a1920cdc55adcf03120
train_110.jsonl
1662993300
This is an interactive problem.I want to play a game with you...We hid from you a cyclic graph of $$$n$$$ vertices ($$$3 \le n \le 10^{18}$$$). A cyclic graph is an undirected graph of $$$n$$$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class C { public static void main(String[] args) { FastScanner sc = new FastScanner(); long ans = 3; for (int i = 2; i < 26; i++) {...
Java
["1\n\n2\n\n-1"]
1 second
["? 1 2\n\n? 1 3\n\n? 1 4\n\n! 3"]
NoteIn the first example, the graph could look like this The lengths of the simple paths between all pairs of vertices in this case are $$$1$$$ or $$$2$$$. The first query finds out that one of the simple paths from vertex $$$1$$$ to vertex $$$2$$$ has a length of $$$1$$$. With the second query, we find out that on...
Java 8
standard input
[ "interactive", "probabilities" ]
8590f40e7509614694486165ee824587
null
1,800
null
standard output