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 | 1e7422c562f66ce201b05278747afb5b | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes |
//@author->.....future_me......//
//..............Learning.........//
/*Compete against yourself*/
import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.BigInteger;
public class C {
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Code Starts <<<<<<<<<<<<<<<<<<<<<<<<<<<<< //
static... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 3e84dd4897e2ce5e7fc8e854a4d8108b | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.Writer;
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | b80952d1eb47fbac8b2abcc1ba04333a | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class GuessTheGreatest {
BufferedReader input;
BufferedWriter output;
StringTokenizer st;
int getElem(int start, int end) throws IOException {
output.write("? "+start+" "+end+"\n");
output.flush();
return Integer.... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 7bce4c11301a816ff1c0a853ee3f9126 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class GuessTheGreatest {
BufferedReader input;
BufferedWriter output;
StringTokenizer st;
int getElem(int start, int end) throws IOException {
output.write("? "+start+" "+end+"\n");
output.flush();
return Integer.... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 8ba304a5a52617c3919a16eeb6c1128f | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | /*input
5
3
4
*/
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
static PrintWriter out;
static int MOD = 1000000007;
static FastReader scan;
/*-------- I/O using short named function ---------*/
public static String ns(){return scan.next();}
public static int... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 58fe4feb91a4f75e6b6a5512daa4b838 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | /*input
5
3
4
*/
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
static PrintWriter out;
static int MOD = 1000000007;
static FastReader scan;
/*-------- I/O using short named function ---------*/
public static String ns(){return scan.next();}
public static int... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | ec56b7a08b823d88278aa757164d69e5 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class Solution{
public static void main(String[] args) {
TaskA solver = new TaskA();
// int t = in.nextInt();
// for (int i = 1; i <= t ; i++) {
// solver.solve(i, in, out);
// }
solver.solve... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | fb515ec9cfe58323bf31268989b5385f | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class Solution{
public static void main(String[] args) {
TaskA solver = new TaskA();
// int t = in.nextInt();
// for (int i = 1; i <= t ; i++) {
// solver.solve(i, in, out);
// }
solver.solve... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 5134e3ceef40eefdbad9a761c608ed10 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes |
import java.util.*;
import java.io.*;
public class Main {
static BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));
static BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(System.out));
static StringTokenizer tok;
public static void main(String[] args) throws Exception {
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 4c56b1974639a4d5450d24df748b88c7 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.util.*;
import java.io.*;
public class cf {
static Reader sc = new Reader();
// static Scanner sc = new Scanner(System.in);
static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) {
int n = sc.nextInt();
int ans = -1;
int index = query(1, n);
if... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 429cf79523e50fd099acfe7bb4771dec | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.util.*;
import java.io.*;
public class cf {
static Reader sc = new Reader();
// static Scanner sc = new Scanner(System.in);
static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) {
int n = sc.nextInt();
int ans = -1;
int index = query(1, n);
if... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 21865ac43cd3362032c5c86d51b123ac | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.*;
import java.util.*;
public class Solution
{
public static void main(String args[]) throws Exception
{
BufferedReader Rb = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.valueOf(Rb.readLine());
int l = 1;
int r = n;
while(true)
{
Sy... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 8da0ccec0e71f495dc335ee3bbce7dc5 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.InputMis... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | f439d0274e7d68a05a16c143afe41ae6 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.*;
public class Main {
static StringBuilder sb;
static dsu dsu;
static long fact[];
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 526d7d7a2c7c8a1a6bd17650b8d67c10 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | /*
Rating: 1461
Date: 11-04-2022
Time: 12-38-28
Author: Kartik Papney
Linkedin: https://www.linkedin.com/in/kartik-papney-4951161a6/
Leetcode: https://leetcode.com/kartikpapney/
Codechef: https://www.codechef.com/users/kartikpapney
*/
import java.util.*;
import java.io.BufferedRe... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 5d99a07d84653e735e08286412ab24d4 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes |
import java.util.*;
import java.lang.*;
import java.io.*;
public class feb20 {
// *** ++
// +=-==+ +++=-
// +-:---==+ *+=----=
// +-:---... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | c9fbffc3d82c157c7d964f381f604f95 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.util.*;
import java.util.Map.Entry;
import java.math.*;
public class Simple{
public static class Pair{
int x;
long y;
public Pair(int x,long y){
this.x = x;
this.y = y;
}
}
static int power(int x, int ... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 71a1e6d6729084134edced59f5916ca6 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.*;
import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;
public class Main {
static long mod = (long) 1e9 + 7;
static long mod1 = 998244353;
public static void main(String[] args) {
InputStream inputStream = Sy... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 877486f50e9a763200354e03ab982d46 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.util.*;
import java.io.*;
public class C {
InputStream is;
PrintWriter out;
String INPUT = "";
boolean bool= true;
void solve() throws IOException {
int start= 1, last= ni();
find(start, last, -1);
}
private void find(int start, int last, int pa... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 836ca605ab506b43453756e6ffc0990c | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.util.*;
import java.io.*;
public class C {
InputStream is;
PrintWriter out;
String INPUT = "";
boolean bool= true;
void solve() throws IOException {
int start= 1, last= ni();
find(start, last, -1);
}
private void find(int start, int last, int pa... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | d18a116a529777545476d718c02e1fc8 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.util.*;
import java.io.*;
public class C {
InputStream is;
PrintWriter out;
String INPUT = "";
boolean bool= true;
void solve() throws IOException {
int start= 1, last= ni();
find(start, last, -1);
}
private void find(int start, int last, int pa... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 7c4ab4c9c6361411c6d6c177ba0a9382 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.sql.Array;
import java.sql.ResultSet;
import java.util.Map.Entry;
import java.util.*;
public class d{
static long mod = 1000000007L;
public static void main(String[] args) throws Exception {
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 54ab3e7aab737d7636a8797c4739e28d | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 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.*;
//update this bad boi too
public class Main{
static int mod = (int) (Math.pow(10, 9)+7);
static final int dx... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 3e1856facabb28b40252d6851212c0d5 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.util.*;
import java.io.*;
public class D{
private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
private static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
public static void main (String[] args) throws IOException{
int ... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 1354d93c8dafc4966aca86e883a2da4e | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 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 Template {
public static void main(String[] args) throws Exception{
BufferedReader infile = new BufferedReader(new InputStreamReade... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 31af4d3a9c8baa22bcde938a9dbf7134 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 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 Template {
public static void main(String[] args) throws Exception{
BufferedReader infile = new BufferedReader(new InputStreamReade... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 10efcaab03ac836e6fb8f5c09e4e9229 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{static class FastReader
{
BufferedReader br;
StringTokenizer st;
p... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 158bef7a0353aae1ea0a2ae376ddba0f | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class GuessingTheGreatest {
static class FastScanner
{
BufferedReader br;
StringTokenizer st;
public FastScanner()
{
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | eabfbd7963ca084a020f970cec38316f | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.util.*;
import java.io.*;
public class a2oj {
static FastReader sc;
static PrintWriter out;
static int mod = 1000000007;
public static void main(String[] args) throws IOException {
if (System.getProperty("ONLINE_JUDGE") == null) {
File f1 = new File("input.t... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | cea18cb4f9b5073a3efcaf96d2afbb6f | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Solution {
static Reader input;
public static void main(String[] args) throws IOException {
input = new Reader();
int n = input.nextInt();
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 977243cfb9cbc0f340e1b1ce9f753706 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes |
import java.util.*;
import java.util.concurrent.CompletableFuture;
import javax.swing.text.Segment;
import java.io.*;
import java.math.*;
import java.sql.Array;
public class Main {
static class Reader{
BufferedReader br;
StringTokenizer st;
public Reader() {
br = new Buffe... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | c5ea1d1ffd6aff748fab8b3bfe516ed5 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes |
import java.util.*;
import java.io.*;
public class three {
public static void main(String[] args) throws IOException, FileNotFoundException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
//BufferedReader in = new BufferedReader(new FileReader("three"));
int n = Integer.... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | d657410fc1b2be5057f2804e1d651647 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.*;
import java.util.*;
@SuppressWarnings("unchecked")
public class GuessingtheGreatest implements Runnable {
void solve() throws IOException {
int l = 1, h = read.intNext();
while (h - l > 1) {
int mid = (h + l) / 2;
int curr = ask(l, h);
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | f1e08dc5b9dd8cff1f239372a58c5902 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.*;
import java.util.*;
@SuppressWarnings("unchecked")
public class GuessingtheGreatest implements Runnable {
void solve() throws IOException {
int l = 0, h = read.intNext();
while (h - l > 1) {
int mid = (h + l) / 2;
int curr = ask(l, h - 1);
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 0bcbb9a351353af00eb8c5b5c486afec | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.*;
import java.util.*;
public class Solution{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int l = 1;
int r = n;
boolean done = false;
while(!... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 257b36778e8ac509102eda7b34d2815c | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.*;
import java.util.*;
public class guessingTheGreatest {
static MyScanner sc = new MyScanner();
public static void main(String[] args) {
int n = sc.nextInt();
int l = 1;
int r = n;
int res = -1;
while(l<r) {
int mid = l + (r-l)/2;
int x = ask(l,r);
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 58b1019cdb8e383b86a3a33bfe3b7b45 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | //package com.company;
//Some of the methods are copied from GeeksforGeeks Website
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
//static Scanner sc=new Scanner(System.in)
static Reader sc=new Reader();
// static FastReader sc=new FastReader(System.in);
stati... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | f5a449544a0ad74c3800baa427958489 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class CodeForces {
public static void main(String[] args) {
// TODO Auto-generated method stub
FastScanner fs=new FastScanner();
int n=fs.nextInt();
int pos=solve(0,n);
Sy... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 123279d12cf12c72f1d3672263bf63a7 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class GuessingTheGreatest {
public static void main(String[] args) {
FastScanner fs = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
in... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 83465bf876487b0b58d89929862273b4 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes |
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class C {
static Scanner sc;
public static void main(String[] args) throws Exception{
sc = new Scanner(Syste... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 58cb42e8f3fbf17ac6fb01073f753d0a | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | // c1
import java.util.*;
// import java.lang.*;
import java.io.*;
// THIS TEMPLATE MADE BY AKSH BANSAL.
public class Solution {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStrea... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | e3a42d3fa6b6bbeed09cc7052eddcd6a | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main2 {
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
InputStreamReader(System.in));
}
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 8f9e043570946d44b4dc250c004e69b1 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class cf {
static final int SCAN_LINE_LENGTH = 100002;
private static final boolean thread = fal... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 0a01858506634f19e7b4cfab0e8ece23 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | // package com.company;
import java.util.*;
import java.io.*;
import java.lang.*;
public class Main{
/*
** || ॐ श्री गणेशाय नमः ||
** @𝙖𝙪𝙩𝙝𝙤𝙧 𝙅𝙞𝙜𝙖𝙧_𝙉𝙖𝙞𝙣𝙪𝙟𝙞
** 𝙎𝙑𝙉𝙄𝙏-𝙎𝙐𝙍𝘼𝙏
*/
public static void main(String args[]){
InputReader in=new InputReader... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 68e2f34001e5f4ef6dc16787bad89bac | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.Arrays;
import java.util.Random;
import java.io.FileWriter;
import java.io.PrintWriter;
/*
Solution Created: 17:48:47 18/02/2021
C... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 51a9bf7ac9a3da0e74ef3f228c0a7e46 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
public class C7003 {
static BufferedReader br;
static long mod = 1000000000 + 7;
static HashSet<Integer> p = new HashSet<>();
public static void main(String[] args) throws Exception {
br = new Buff... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 490153050b4a0fcf5497658c6fa965a4 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes |
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.*;
public class weird_algrithm {
static BufferedWriter output = new BufferedWriter(
new OutputStreamWriter(Sy... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 6261f11d5937c51a9020ac5608b1a11e | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.*;
import java.util.*;
public class Interactive_2 {
public static void main(String[] args) {
FastReader sc = new FastReader();
StringBuilder sb = new StringBuilder();
int t = 1;
out:while(t-- >0) {
int n = sc.nextInt();
int l = 1;
int r = n;
System.out.prin... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 2704a32f83f0d0d3ac2dce47d59198b5 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.*;
public class Main {
public static int[] a = new int[]{0, 4, 3, 2, 1, 5};
public static void main(String[] args) throws Exception{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int testCase = Integer.parseInt(in.readLine().trim());
int l = 1;
int r... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | cd18a627b2b6054b671690f1f82fbd0b | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
static class DisjointUnionSets {
int[] rank, parent;
int n;
// Constructor
public DisjointUnionSets(int n)
{
ran... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 36574ef3b5614f4ebf609382b24aa7ca | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes |
import java.io.*;
import java.util.Arrays;
public class codeforces {
static int ask(int l,int r)throws IOException {
if(l==r) {
return -1;
}
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int out1;
System.out.println("? "+l+" "+r);
System.out... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 6322dbe0be783fe777930e789b34a294 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigInteger;
public class Main
{
static class FastReader{
BufferedReader br;
StringTokenizer st;
public FastReader(){
br = new BufferedReader(new InputStreamReader(System.in));
}
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | b5382150606ff3bffbcd4ab3e2bc8aee | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | //package credit;
import java.io.*;
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main{
static boolean v[];
static int ans[];
int size[];
static int count=0;
static int... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | a74e6155d8b2672e50346dedd632db04 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 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.HashMap;
import java.util.StringTokenizer;
public class problemC {
static class Solution {
HashMap<Point, Integer> m... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 970748862630f55b3c83e31d56da1479 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 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.HashMap;
import java.util.StringTokenizer;
public class problemC {
static class Solution {
HashMap<Integer, Integer>... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | e7100cca39f876b8a3e446dc41443b4a | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.util.*;
import java.io.*;
public class File {
public static class FastScanner {
BufferedReader br;
StringTokenizer st;
public FastScanner() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 1cf35e5e9960d351ea1166faef99681e | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.PriorityQueue;
import java.util.Scanner;
public class B {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int tt = 1;
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 319841f4e975b48d4296837aaac4be91 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class CP {
static int MAX = Integer.MAX_VALUE,MIN = Integer.MIN_VALUE,MOD = (int)1e9+7;
static long MAXL = (long)1e18,MINL = -(long)1e18;
static void solve() {
// 0 0 1
// x
// l x
// x ... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 5044422ad3746d63117fd029638bb4f5 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | // have faith in yourself!!!!!
/*
Naive mistakes in java :
--> Arrays.sort(primitive) is O(n^2)
--> Never use '=' to compare to Integer data types, instead use 'equals()'
--> -4 % 3 = -1, actually it should be 2, so add '+n' to modulo result
*/
import java.io.*;
import java.util.*;
public class CodeF... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 8e9c556f9e053f3d0ecbf997e86615bc | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
Scanner scn = new Scanner(System.in);
// Always print a trailing "\n" and close the OutputWriter as shown at the end of your output
// exampl... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 7764bba2707b30fecbf8112af53b6a14 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | //https://vjudge.net/contest/438472#problem/D
//D - Guess easy version
import java.util.*;
import java.io.*;
public class PBH_401_D{
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
static int ask(in... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 46d53bb8dce07d9d5cd0303ed012b403 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | //https://vjudge.net/contest/438472#problem/D
//D - Guess easy version
import java.util.*;
import java.io.*;
public class PBH_401_D{
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
static int ask(in... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 5b3869b4a0984240ea81be27e17dd3eb | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.*;
public class cf719 {
public static int query(int l,int r) throws Exception{
if(l>=r)return -1;
InputStreamReader ip=new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(ip);
Syst... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 4ad90bee19c239b36821c06aa0b2f755 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.*;
public class cf719 {
public static void solve1() throws Exception{
InputStreamReader ip=new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(ip);
// int t = Integer.parseInt(br.readLine());
StringBuilder ... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 7f6335a79fb9fab06982598e08a3c8d6 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes |
import java.io.*;
import java.util.Arrays;
public class codeforces {
static int ask(int l,int r)throws IOException {
if(l==r) {
return -1;
}
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int out1;
System.out.println("? "+l+" "+r);
System.out... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 890342832c629e5562d5f90637afad19 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes |
// import java.util.Vector;
import java.util.*;
import java.lang.Math;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import javax.management.Query;
import java.io.*;
import java.math.BigInteger;
public class Main {
static int mod = 1000000007;
static class Edge {
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 457f24a91094c0fc9aeb0b4bf8fc907d | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes |
// import java.util.Vector;
import java.util.*;
import java.lang.Math;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import javax.management.Query;
import java.io.*;
import java.math.BigInteger;
public class Main {
static int mod = 1000000007;
static class Edge {
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | f19b754dd0e105fb2706f697642760fe | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes |
// import java.util.Vector;
import java.util.*;
import java.lang.Math;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import javax.management.Query;
import java.io.*;
import java.math.BigInteger;
public class Main {
static int mod = 1000000007;
static class Edge {
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 3d4ae3776103111c5ddb68fb8b5adfcd | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
import java.awt.*;
public class Main
{
static Scanner scn = new Scanner(System.in) ;
public static int query(int l , int r)
{
System.out.println("? " + l +" " + r ) ;
int q = scn.nextInt() ;
return q ;... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 543d9aedfeef533138d31aa5e940d736 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
private static final boolean N_CASE = false;
private int query(int l, int r) {
out.println(String.format("? %d %d", l, r));
out.flush();
return sc.nextInt();
}
private void answer(int value) {
out... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 0a438db99b2463c5704c21f58219ac52 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.util.*;
public class Cf {
public static void main(String [] args){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();int a=1;int b=n;
System.out.println("? "+a+" "+b );
System.out.flush();
int t=sc.nextInt();
int q=0;
if(t==1){}
else{
System.out... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 4af7808947c1128d921c81cd683bf114 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class C {
void solve() throws IOException {
int n = nextInt();
int begin = 1;
int end = n;
/*
5 1 3 4 2
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | b026d3e59aaa11d66d0a6bec26c71694 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class C {
void solve() throws IOException {
int n = nextInt();
int begin = 1;
int end = n;
/*
5 1 3 4 2
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 0df2ed14973adf60fd32104c227913f6 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class C {
void solve() throws IOException {
int n = nextInt();
int begin = 1;
int end = n;
/*
5 1 3 4 2
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | f071225b287d7ddccfa7bdf206de4d90 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class C {
void solve() throws IOException {
int n = nextInt();
int begin = 1;
int end = n;
/*
5 1 3 4 2
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 4bf95191da8f8fddf42f2b0a388c698b | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | //Implemented By Aman Kotiyal Date:-19-Feb-2021 Time:-1:07:15 am
import java.io.*;
import java.util.*;
public class ques1
{
public static void main(String[] args)throws Exception{ new ques1().run();}
long mod=1000000000+7;
void solve() throws Exception
{
int n=ni();
int l=1,r=n;
out.println(... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | a67e31603595d4420ba7e8d96c884e24 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | /**
* Created by Himanshu
**/
import java.util.*;
import java.io.*;
import java.math.*;
public class C1486 {
static Reader s = new Reader();
public static void main(String[] args) throws IOException {
int n = s.i();
if (n == 1) {
System.out.println("! "+1);
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 10eb22f5347214256f5fee203f7431e3 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.*;
import java.util.*;
public class TEST
{
static class Reader
{
final private int BUFFER_SIZE = 1 << 16;
Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
private DataInputStream din;
private byte[] buffer;
private... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | fcc1c6d13ff236fcf2eb0522c83554d6 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.*;
import java.lang.Math;
import java.util.*;
import javax.management.ValueExp;
public final class Codechef {
static BufferedReader br = new BufferedReader(
new InputStreamReader(System.in)
);
static BufferedWriter bw = new BufferedWriter(
new OutputStreamWriter(System.out)
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 6bd552f59353f620afd8f3ac9d1aaeda | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.*;
import java.util.*;
public class GuessingTheGreatest {
static FastScanner fs;
static FastWriter fw;
static boolean checkOnlineJudge = System.getProperty("ONLINE_JUDGE") == null;
private static final int iMax = (int) (1e9), iMin = (int) (-1e9);
private static final long... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 5c4d9ddb4bb0aca696d2d1bfc0e408ed | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import static java.lang.System.in;
import static java.lang.System.out;
public class Main {
public static void main(String[] args){
FastReader fr=new FastReader();
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 7c013589617b3754a45bc31b942911c0 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.*;
import java.util.*;
public class tank {
//static StringBuilder IO = new StringBuilder();
//static final Scanner scan = new Scanner(System.in);
static final FastScanner fs = new FastScanner();
public static void main(String[] args) {
// int t = fs.nextInt();
// ... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 6e65de34611d6ddbd96fa0d07dd0842e | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int l = 1, r = n;
System.out.flush();
while (l < r) {
int m = (l + r) / 2;
System.out.println("... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 66fbc3e220dc86f602eba576b0997b95 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Buil... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | d1281fa97679ec49a7a1ce53c457d150 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
static void bs(int start,int end,int ind) {
if((end-start)==1) {
if(start==ind) {
System.out.println("! "+(end+1));
}
else {
System.out.println("! "+(start+1));
}
return;
}
FastScanner f = new ... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 4e3250dcc0b2bd8e565d66347c29bbf5 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
import static java.lang.System.out;
public class C1_GuessingTheGreatest_EasyVersion {
private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
private static StringTokenizer st;
private static int readInt() throws I... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 2cd9c3ffe664765faeae3f7bf761d8d9 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
import static java.lang.System.getSecurityManager;
import static java.lang.System.out;
public class C1_ {
private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
private static StringTokenizer st;
private static in... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 81f6bbef5cc365f10db114db13cc5ae7 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.util.*;
import java.io.*;
/**
* Created on: Feb 18, 2021
* Questions: https://codeforces.com/contest/1486/problem/C1#
*/
public class GuessingTheGreatest {
public static void main(String[] args) {
Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 2511f865eb4873ada3db6ef1515cb3c1 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.*;
public class C {
public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
static long MOD = (long) (1e9 + 7);
//static int MOD = 998244353;
static long MOD2 = MOD * MOD;
static FastReader sc = new FastReader();
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | acf99f9385d2befceb338deaad1f6b54 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
import java.awt.geom.*;
import static java.lang.Math.*;
public class Solution implements Runnable {
long mod1 = (long) 1e9 + 7;
int mod2 = 998244353;
public void solve() throws Exception {
int n=sc.nextInt();
int start=1;
int end... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | a8c033b227dfe5e46a26cb5346b28f9f | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | af094ef0e30373ed7419a9940cabd4e3 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(System.in);
// BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int t=1;
/// t=sc.nextInt();
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 9a9db21379c0a1dee69a93af7ccdc87a | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.util.*;
import java.io.*;
public class C1
{
public static class FastIO
{
BufferedReader br;
BufferedWriter bw, be;
StringTokenizer st;
public FastIO()
{
br = new BufferedReader(new InputStreamReader(System.in));
bw = new BufferedWriter(new OutputStreamWriter(System.out));
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | ca5041c3c98361cb166798c609001ab4 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class Solution{
public static void main(String[] args) {
TaskA solver = new TaskA();
// int t = in.nextInt();
// for (int i = 1; i <= t ; i++) {
// solver.solve(i, in, out);
// }
solver.solve... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 8a8cd461b2ac8b70932ffac7cac5b41f | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
void solve() {
int n = in.nextInt();
int low = 1;
int high = n;
int secondLast = query(1, n);
if (secondLast == 1) {
low = 2;
} else if (secondLast == n) {
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 87c7461aa6ece7a15c38465d84cfc30b | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | /*
_oo0oo_
o8888888o
88" . "88
(| -_- |)
0\ = /0
___/`---'\___
.' \\| |// '.
/ \\||| : |||// \
/ _||||| -:- |||||- \
... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | 1c12dbc9aa1273f43355b716ec58b7e8 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes |
import java.util.*;
import java.util.Map.Entry;
import java.lang.*;
import java.io.*;
import java.math.BigInteger;
public class CF {
private static FS sc = new FS();
private static class FS {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new Strin... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | e661a48ab6f27949a3f2e16aab3f3af2 | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.StringTokenizer;
public class Hello1 {
static FastReader s = new FastReader()... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | bdb29715a04c7f3c5f3bfcfc2abf405d | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | import java.io.DataInputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Map;
import java.util.TreeMap;
public class Main {
private static void run() throws IOException {
int n = in.nextInt();
// TreeMap<Do... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output | |
PASSED | d3c677a5d14d1a7f442e035b0fce868c | train_109.jsonl | 1613658900 | The only difference between the easy and the hard version is the limit to the number of queries.This is an interactive problem.There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum eleme... | 256 megabytes | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
import static java.lang.Math.*;
/* Name of the class has to be "Main" only if the class is public. */
// class Codechef
public class C1GuessingtheGreatest
{
static InputReader in = new InputRe... | Java | ["5\n\n3\n\n4"] | 1 second | ["? 1 5\n\n? 4 5\n\n! 1"] | NoteIn the sample suppose $$$a$$$ is $$$[5, 1, 4, 2, 3]$$$. So after asking the $$$[1..5]$$$ subsegment $$$4$$$ is second to max value, and it's position is $$$3$$$. After asking the $$$[4..5]$$$ subsegment $$$2$$$ is second to max value and it's position in the whole array is $$$4$$$.Note that there are other arrays $... | Java 11 | standard input | [
"binary search",
"interactive"
] | b3e8fe76706ba17cb285c75459508334 | The first line contains a single integer $$$n$$$ $$$(2 \leq n \leq 10^5)$$$ — the number of elements in the array. | 1,600 | null | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.