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
c5e80ffd096e37b81f302971d251dccd
train_001.jsonl
1594479900
Danny, the local Math Maniac, is fascinated by circles, Omkar's most recent creation. Help him solve this circle problem!You are given $$$n$$$ nonnegative integers $$$a_1, a_2, \dots, a_n$$$ arranged in a circle, where $$$n$$$ must be odd (ie. $$$n-1$$$ is divisible by $$$2$$$). Formally, for all $$$i$$$ such that $$$2...
256 megabytes
import java.util.*; import java.io.*; public class D { public static void main(String[] args) throws IOException { FastScanner input = new FastScanner(System.in); // Scanner input = new Scanner(new File("input.txt")); PrintWriter output = new PrintWriter(System.out); int n = input...
Java
["3\n7 10 2", "1\n4"]
2 seconds
["17", "4"]
NoteFor the first test case, here's how a circular value of $$$17$$$ is obtained:Pick the number at index $$$3$$$. The sum of adjacent elements equals $$$17$$$. Delete $$$7$$$ and $$$10$$$ from the circle and replace $$$2$$$ with $$$17$$$.Note that the answer may not fit in a $$$32$$$-bit integer.
Java 8
standard input
[ "dp", "greedy", "games", "brute force" ]
a9473e6ec81c10c4f88973ac2d60ad04
The first line contains one odd integer $$$n$$$ ($$$1 \leq n < 2 \cdot 10^5$$$, $$$n$$$ is odd)  — the initial size of the circle. The second line contains $$$n$$$ integers $$$a_{1},a_{2},\dots,a_{n}$$$ ($$$0 \leq a_{i} \leq 10^9$$$)  — the initial numbers in the circle.
2,100
Output the maximum possible circular value after applying some sequence of operations to the given circle.
standard output
PASSED
156927b2438d2c512b0aa275d4027e1b
train_001.jsonl
1594479900
Danny, the local Math Maniac, is fascinated by circles, Omkar's most recent creation. Help him solve this circle problem!You are given $$$n$$$ nonnegative integers $$$a_1, a_2, \dots, a_n$$$ arranged in a circle, where $$$n$$$ must be odd (ie. $$$n-1$$$ is divisible by $$$2$$$). Formally, for all $$$i$$$ such that $$$2...
256 megabytes
/** * @author Finn Lidbetter */ import java.util.*; import java.io.*; import java.awt.geom.*; public class TaskD { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int n = I...
Java
["3\n7 10 2", "1\n4"]
2 seconds
["17", "4"]
NoteFor the first test case, here's how a circular value of $$$17$$$ is obtained:Pick the number at index $$$3$$$. The sum of adjacent elements equals $$$17$$$. Delete $$$7$$$ and $$$10$$$ from the circle and replace $$$2$$$ with $$$17$$$.Note that the answer may not fit in a $$$32$$$-bit integer.
Java 8
standard input
[ "dp", "greedy", "games", "brute force" ]
a9473e6ec81c10c4f88973ac2d60ad04
The first line contains one odd integer $$$n$$$ ($$$1 \leq n < 2 \cdot 10^5$$$, $$$n$$$ is odd)  — the initial size of the circle. The second line contains $$$n$$$ integers $$$a_{1},a_{2},\dots,a_{n}$$$ ($$$0 \leq a_{i} \leq 10^9$$$)  — the initial numbers in the circle.
2,100
Output the maximum possible circular value after applying some sequence of operations to the given circle.
standard output
PASSED
f993173ac9d5bc182bd81ec381de4333
train_001.jsonl
1594479900
Danny, the local Math Maniac, is fascinated by circles, Omkar's most recent creation. Help him solve this circle problem!You are given $$$n$$$ nonnegative integers $$$a_1, a_2, \dots, a_n$$$ arranged in a circle, where $$$n$$$ must be odd (ie. $$$n-1$$$ is divisible by $$$2$$$). Formally, for all $$$i$$$ such that $$$2...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; /** * Built using CHelper plug-in * Actual solution is at the top */ public class OmkarAndCircle { public static void main(String[] args) throws IOException { InputStream inputStream = System.in; OutputStream outputStream = Sy...
Java
["3\n7 10 2", "1\n4"]
2 seconds
["17", "4"]
NoteFor the first test case, here's how a circular value of $$$17$$$ is obtained:Pick the number at index $$$3$$$. The sum of adjacent elements equals $$$17$$$. Delete $$$7$$$ and $$$10$$$ from the circle and replace $$$2$$$ with $$$17$$$.Note that the answer may not fit in a $$$32$$$-bit integer.
Java 8
standard input
[ "dp", "greedy", "games", "brute force" ]
a9473e6ec81c10c4f88973ac2d60ad04
The first line contains one odd integer $$$n$$$ ($$$1 \leq n < 2 \cdot 10^5$$$, $$$n$$$ is odd)  — the initial size of the circle. The second line contains $$$n$$$ integers $$$a_{1},a_{2},\dots,a_{n}$$$ ($$$0 \leq a_{i} \leq 10^9$$$)  — the initial numbers in the circle.
2,100
Output the maximum possible circular value after applying some sequence of operations to the given circle.
standard output
PASSED
45e7c572b8e68b65707f3425c446be45
train_001.jsonl
1594479900
Danny, the local Math Maniac, is fascinated by circles, Omkar's most recent creation. Help him solve this circle problem!You are given $$$n$$$ nonnegative integers $$$a_1, a_2, \dots, a_n$$$ arranged in a circle, where $$$n$$$ must be odd (ie. $$$n-1$$$ is divisible by $$$2$$$). Formally, for all $$$i$$$ such that $$$2...
256 megabytes
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 ProblemD { public static void main (String[] args) throws java.lang.Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String[] cmd=br.re...
Java
["3\n7 10 2", "1\n4"]
2 seconds
["17", "4"]
NoteFor the first test case, here's how a circular value of $$$17$$$ is obtained:Pick the number at index $$$3$$$. The sum of adjacent elements equals $$$17$$$. Delete $$$7$$$ and $$$10$$$ from the circle and replace $$$2$$$ with $$$17$$$.Note that the answer may not fit in a $$$32$$$-bit integer.
Java 8
standard input
[ "dp", "greedy", "games", "brute force" ]
a9473e6ec81c10c4f88973ac2d60ad04
The first line contains one odd integer $$$n$$$ ($$$1 \leq n < 2 \cdot 10^5$$$, $$$n$$$ is odd)  — the initial size of the circle. The second line contains $$$n$$$ integers $$$a_{1},a_{2},\dots,a_{n}$$$ ($$$0 \leq a_{i} \leq 10^9$$$)  — the initial numbers in the circle.
2,100
Output the maximum possible circular value after applying some sequence of operations to the given circle.
standard output
PASSED
d48ff920d47eec2e70ab63f6867197ba
train_001.jsonl
1594479900
Danny, the local Math Maniac, is fascinated by circles, Omkar's most recent creation. Help him solve this circle problem!You are given $$$n$$$ nonnegative integers $$$a_1, a_2, \dots, a_n$$$ arranged in a circle, where $$$n$$$ must be odd (ie. $$$n-1$$$ is divisible by $$$2$$$). Formally, for all $$$i$$$ such that $$$2...
256 megabytes
import java.util.Scanner; public class R655Dbest { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); long[] arr =new long[n*2]; long[] pre = new long[n*2]; for(int i =0 ;i<n;i++) { arr[i] = scan.nextLong(); } for(int i = n;i<n*2;i++) { arr[i] ...
Java
["3\n7 10 2", "1\n4"]
2 seconds
["17", "4"]
NoteFor the first test case, here's how a circular value of $$$17$$$ is obtained:Pick the number at index $$$3$$$. The sum of adjacent elements equals $$$17$$$. Delete $$$7$$$ and $$$10$$$ from the circle and replace $$$2$$$ with $$$17$$$.Note that the answer may not fit in a $$$32$$$-bit integer.
Java 8
standard input
[ "dp", "greedy", "games", "brute force" ]
a9473e6ec81c10c4f88973ac2d60ad04
The first line contains one odd integer $$$n$$$ ($$$1 \leq n &lt; 2 \cdot 10^5$$$, $$$n$$$ is odd)  — the initial size of the circle. The second line contains $$$n$$$ integers $$$a_{1},a_{2},\dots,a_{n}$$$ ($$$0 \leq a_{i} \leq 10^9$$$)  — the initial numbers in the circle.
2,100
Output the maximum possible circular value after applying some sequence of operations to the given circle.
standard output
PASSED
fd3694a561a31db153786f82acd8b4d7
train_001.jsonl
1594479900
Danny, the local Math Maniac, is fascinated by circles, Omkar's most recent creation. Help him solve this circle problem!You are given $$$n$$$ nonnegative integers $$$a_1, a_2, \dots, a_n$$$ arranged in a circle, where $$$n$$$ must be odd (ie. $$$n-1$$$ is divisible by $$$2$$$). Formally, for all $$$i$$$ such that $$$2...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
["3\n7 10 2", "1\n4"]
2 seconds
["17", "4"]
NoteFor the first test case, here's how a circular value of $$$17$$$ is obtained:Pick the number at index $$$3$$$. The sum of adjacent elements equals $$$17$$$. Delete $$$7$$$ and $$$10$$$ from the circle and replace $$$2$$$ with $$$17$$$.Note that the answer may not fit in a $$$32$$$-bit integer.
Java 8
standard input
[ "dp", "greedy", "games", "brute force" ]
a9473e6ec81c10c4f88973ac2d60ad04
The first line contains one odd integer $$$n$$$ ($$$1 \leq n &lt; 2 \cdot 10^5$$$, $$$n$$$ is odd)  — the initial size of the circle. The second line contains $$$n$$$ integers $$$a_{1},a_{2},\dots,a_{n}$$$ ($$$0 \leq a_{i} \leq 10^9$$$)  — the initial numbers in the circle.
2,100
Output the maximum possible circular value after applying some sequence of operations to the given circle.
standard output
PASSED
1739daccb54a43e9aeaaefa308034ac5
train_001.jsonl
1594479900
Danny, the local Math Maniac, is fascinated by circles, Omkar's most recent creation. Help him solve this circle problem!You are given $$$n$$$ nonnegative integers $$$a_1, a_2, \dots, a_n$$$ arranged in a circle, where $$$n$$$ must be odd (ie. $$$n-1$$$ is divisible by $$$2$$$). Formally, for all $$$i$$$ such that $$$2...
256 megabytes
import java.util.*; import java.io.*; public class d { static final FS sc = new FS(); static final PrintWriter pw = new PrintWriter(System.out); static final long max = Long.MAX_VALUE / 8; static int n; static long[] arr; static long sum; static long[][] dp; public static void main(String[] args) { n = sc...
Java
["3\n7 10 2", "1\n4"]
2 seconds
["17", "4"]
NoteFor the first test case, here's how a circular value of $$$17$$$ is obtained:Pick the number at index $$$3$$$. The sum of adjacent elements equals $$$17$$$. Delete $$$7$$$ and $$$10$$$ from the circle and replace $$$2$$$ with $$$17$$$.Note that the answer may not fit in a $$$32$$$-bit integer.
Java 8
standard input
[ "dp", "greedy", "games", "brute force" ]
a9473e6ec81c10c4f88973ac2d60ad04
The first line contains one odd integer $$$n$$$ ($$$1 \leq n &lt; 2 \cdot 10^5$$$, $$$n$$$ is odd)  — the initial size of the circle. The second line contains $$$n$$$ integers $$$a_{1},a_{2},\dots,a_{n}$$$ ($$$0 \leq a_{i} \leq 10^9$$$)  — the initial numbers in the circle.
2,100
Output the maximum possible circular value after applying some sequence of operations to the given circle.
standard output
PASSED
ad3b2a1cfd702a305fe1f50b240bd469
train_001.jsonl
1594479900
Danny, the local Math Maniac, is fascinated by circles, Omkar's most recent creation. Help him solve this circle problem!You are given $$$n$$$ nonnegative integers $$$a_1, a_2, \dots, a_n$$$ arranged in a circle, where $$$n$$$ must be odd (ie. $$$n-1$$$ is divisible by $$$2$$$). Formally, for all $$$i$$$ such that $$$2...
256 megabytes
import java.io.*; import java.util.*; public class d { static class InputReader{ BufferedReader reader; StringTokenizer tokenizer; public InputReader(InputStream stream) { reader = new BufferedReader (new InputStreamReader(stream), 32768); tokenizer = null; } String next() { while(tokenizer =...
Java
["3\n7 10 2", "1\n4"]
2 seconds
["17", "4"]
NoteFor the first test case, here's how a circular value of $$$17$$$ is obtained:Pick the number at index $$$3$$$. The sum of adjacent elements equals $$$17$$$. Delete $$$7$$$ and $$$10$$$ from the circle and replace $$$2$$$ with $$$17$$$.Note that the answer may not fit in a $$$32$$$-bit integer.
Java 8
standard input
[ "dp", "greedy", "games", "brute force" ]
a9473e6ec81c10c4f88973ac2d60ad04
The first line contains one odd integer $$$n$$$ ($$$1 \leq n &lt; 2 \cdot 10^5$$$, $$$n$$$ is odd)  — the initial size of the circle. The second line contains $$$n$$$ integers $$$a_{1},a_{2},\dots,a_{n}$$$ ($$$0 \leq a_{i} \leq 10^9$$$)  — the initial numbers in the circle.
2,100
Output the maximum possible circular value after applying some sequence of operations to the given circle.
standard output
PASSED
deb864439227777b1a8ef137b2b5c8ff
train_001.jsonl
1594479900
Danny, the local Math Maniac, is fascinated by circles, Omkar's most recent creation. Help him solve this circle problem!You are given $$$n$$$ nonnegative integers $$$a_1, a_2, \dots, a_n$$$ arranged in a circle, where $$$n$$$ must be odd (ie. $$$n-1$$$ is divisible by $$$2$$$). Formally, for all $$$i$$$ such that $$$2...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class r655d { public static void main(String[] args) { FastScanner scan=new FastScanner(); PrintWriter out=new PrintWriter(Syst...
Java
["3\n7 10 2", "1\n4"]
2 seconds
["17", "4"]
NoteFor the first test case, here's how a circular value of $$$17$$$ is obtained:Pick the number at index $$$3$$$. The sum of adjacent elements equals $$$17$$$. Delete $$$7$$$ and $$$10$$$ from the circle and replace $$$2$$$ with $$$17$$$.Note that the answer may not fit in a $$$32$$$-bit integer.
Java 8
standard input
[ "dp", "greedy", "games", "brute force" ]
a9473e6ec81c10c4f88973ac2d60ad04
The first line contains one odd integer $$$n$$$ ($$$1 \leq n &lt; 2 \cdot 10^5$$$, $$$n$$$ is odd)  — the initial size of the circle. The second line contains $$$n$$$ integers $$$a_{1},a_{2},\dots,a_{n}$$$ ($$$0 \leq a_{i} \leq 10^9$$$)  — the initial numbers in the circle.
2,100
Output the maximum possible circular value after applying some sequence of operations to the given circle.
standard output
PASSED
a26e50d571aa678ae0ae1b9a0d7d11f2
train_001.jsonl
1594479900
Danny, the local Math Maniac, is fascinated by circles, Omkar's most recent creation. Help him solve this circle problem!You are given $$$n$$$ nonnegative integers $$$a_1, a_2, \dots, a_n$$$ arranged in a circle, where $$$n$$$ must be odd (ie. $$$n-1$$$ is divisible by $$$2$$$). Formally, for all $$$i$$$ such that $$$2...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.StringTokenizer; public class D { public static void main(String[] args) { FastScanner fs=new FastScanner(); int n=fs.ne...
Java
["3\n7 10 2", "1\n4"]
2 seconds
["17", "4"]
NoteFor the first test case, here's how a circular value of $$$17$$$ is obtained:Pick the number at index $$$3$$$. The sum of adjacent elements equals $$$17$$$. Delete $$$7$$$ and $$$10$$$ from the circle and replace $$$2$$$ with $$$17$$$.Note that the answer may not fit in a $$$32$$$-bit integer.
Java 8
standard input
[ "dp", "greedy", "games", "brute force" ]
a9473e6ec81c10c4f88973ac2d60ad04
The first line contains one odd integer $$$n$$$ ($$$1 \leq n &lt; 2 \cdot 10^5$$$, $$$n$$$ is odd)  — the initial size of the circle. The second line contains $$$n$$$ integers $$$a_{1},a_{2},\dots,a_{n}$$$ ($$$0 \leq a_{i} \leq 10^9$$$)  — the initial numbers in the circle.
2,100
Output the maximum possible circular value after applying some sequence of operations to the given circle.
standard output
PASSED
32afeec7ff4f5988ef0273035ad22038
train_001.jsonl
1594479900
Danny, the local Math Maniac, is fascinated by circles, Omkar's most recent creation. Help him solve this circle problem!You are given $$$n$$$ nonnegative integers $$$a_1, a_2, \dots, a_n$$$ arranged in a circle, where $$$n$$$ must be odd (ie. $$$n-1$$$ is divisible by $$$2$$$). Formally, for all $$$i$$$ such that $$$2...
256 megabytes
import java.util.*; import java.io.*; public class EdD { public static void main(String[] args) throws Exception{ int num = 998244353; // TODO Auto-generated method stub BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); int n = Integer...
Java
["3\n7 10 2", "1\n4"]
2 seconds
["17", "4"]
NoteFor the first test case, here's how a circular value of $$$17$$$ is obtained:Pick the number at index $$$3$$$. The sum of adjacent elements equals $$$17$$$. Delete $$$7$$$ and $$$10$$$ from the circle and replace $$$2$$$ with $$$17$$$.Note that the answer may not fit in a $$$32$$$-bit integer.
Java 8
standard input
[ "dp", "greedy", "games", "brute force" ]
a9473e6ec81c10c4f88973ac2d60ad04
The first line contains one odd integer $$$n$$$ ($$$1 \leq n &lt; 2 \cdot 10^5$$$, $$$n$$$ is odd)  — the initial size of the circle. The second line contains $$$n$$$ integers $$$a_{1},a_{2},\dots,a_{n}$$$ ($$$0 \leq a_{i} \leq 10^9$$$)  — the initial numbers in the circle.
2,100
Output the maximum possible circular value after applying some sequence of operations to the given circle.
standard output
PASSED
3fc29d55c85d73baeeca860c519f468e
train_001.jsonl
1594479900
Danny, the local Math Maniac, is fascinated by circles, Omkar's most recent creation. Help him solve this circle problem!You are given $$$n$$$ nonnegative integers $$$a_1, a_2, \dots, a_n$$$ arranged in a circle, where $$$n$$$ must be odd (ie. $$$n-1$$$ is divisible by $$$2$$$). Formally, for all $$$i$$$ such that $$$2...
256 megabytes
import java.util.*; import java.io.*; public class EdD { public static void main(String[] args) throws Exception{ int num = 998244353; // TODO Auto-generated method stub BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); int n = Integer...
Java
["3\n7 10 2", "1\n4"]
2 seconds
["17", "4"]
NoteFor the first test case, here's how a circular value of $$$17$$$ is obtained:Pick the number at index $$$3$$$. The sum of adjacent elements equals $$$17$$$. Delete $$$7$$$ and $$$10$$$ from the circle and replace $$$2$$$ with $$$17$$$.Note that the answer may not fit in a $$$32$$$-bit integer.
Java 8
standard input
[ "dp", "greedy", "games", "brute force" ]
a9473e6ec81c10c4f88973ac2d60ad04
The first line contains one odd integer $$$n$$$ ($$$1 \leq n &lt; 2 \cdot 10^5$$$, $$$n$$$ is odd)  — the initial size of the circle. The second line contains $$$n$$$ integers $$$a_{1},a_{2},\dots,a_{n}$$$ ($$$0 \leq a_{i} \leq 10^9$$$)  — the initial numbers in the circle.
2,100
Output the maximum possible circular value after applying some sequence of operations to the given circle.
standard output
PASSED
d4abf0f30aa8e2db1cf1a1b5fa60e13e
train_001.jsonl
1594479900
Danny, the local Math Maniac, is fascinated by circles, Omkar's most recent creation. Help him solve this circle problem!You are given $$$n$$$ nonnegative integers $$$a_1, a_2, \dots, a_n$$$ arranged in a circle, where $$$n$$$ must be odd (ie. $$$n-1$$$ is divisible by $$$2$$$). Formally, for all $$$i$$$ such that $$$2...
256 megabytes
import java.util.*; import java.io.*; public class EdD { public static void main(String[] args) throws Exception{ int num = 998244353; // TODO Auto-generated method stub BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); int n = Integer...
Java
["3\n7 10 2", "1\n4"]
2 seconds
["17", "4"]
NoteFor the first test case, here's how a circular value of $$$17$$$ is obtained:Pick the number at index $$$3$$$. The sum of adjacent elements equals $$$17$$$. Delete $$$7$$$ and $$$10$$$ from the circle and replace $$$2$$$ with $$$17$$$.Note that the answer may not fit in a $$$32$$$-bit integer.
Java 8
standard input
[ "dp", "greedy", "games", "brute force" ]
a9473e6ec81c10c4f88973ac2d60ad04
The first line contains one odd integer $$$n$$$ ($$$1 \leq n &lt; 2 \cdot 10^5$$$, $$$n$$$ is odd)  — the initial size of the circle. The second line contains $$$n$$$ integers $$$a_{1},a_{2},\dots,a_{n}$$$ ($$$0 \leq a_{i} \leq 10^9$$$)  — the initial numbers in the circle.
2,100
Output the maximum possible circular value after applying some sequence of operations to the given circle.
standard output
PASSED
06bf838495079b07ecdc8a20336eba89
train_001.jsonl
1594479900
Danny, the local Math Maniac, is fascinated by circles, Omkar's most recent creation. Help him solve this circle problem!You are given $$$n$$$ nonnegative integers $$$a_1, a_2, \dots, a_n$$$ arranged in a circle, where $$$n$$$ must be odd (ie. $$$n-1$$$ is divisible by $$$2$$$). Formally, for all $$$i$$$ such that $$$2...
256 megabytes
import java.text.DecimalFormat; import java.util.*; import java.io.*; import java.math.*; public class Main { private static FastReader fr = new FastReader(); private static Helper hp = new Helper(); private static StringBuilder result = new StringBuilder(); public static void main(String[] args) { ...
Java
["3\n7 10 2", "1\n4"]
2 seconds
["17", "4"]
NoteFor the first test case, here's how a circular value of $$$17$$$ is obtained:Pick the number at index $$$3$$$. The sum of adjacent elements equals $$$17$$$. Delete $$$7$$$ and $$$10$$$ from the circle and replace $$$2$$$ with $$$17$$$.Note that the answer may not fit in a $$$32$$$-bit integer.
Java 8
standard input
[ "dp", "greedy", "games", "brute force" ]
a9473e6ec81c10c4f88973ac2d60ad04
The first line contains one odd integer $$$n$$$ ($$$1 \leq n &lt; 2 \cdot 10^5$$$, $$$n$$$ is odd)  — the initial size of the circle. The second line contains $$$n$$$ integers $$$a_{1},a_{2},\dots,a_{n}$$$ ($$$0 \leq a_{i} \leq 10^9$$$)  — the initial numbers in the circle.
2,100
Output the maximum possible circular value after applying some sequence of operations to the given circle.
standard output
PASSED
ec2868dbedf81930ccc03202c0424fee
train_001.jsonl
1594479900
Danny, the local Math Maniac, is fascinated by circles, Omkar's most recent creation. Help him solve this circle problem!You are given $$$n$$$ nonnegative integers $$$a_1, a_2, \dots, a_n$$$ arranged in a circle, where $$$n$$$ must be odd (ie. $$$n-1$$$ is divisible by $$$2$$$). Formally, for all $$$i$$$ such that $$$2...
256 megabytes
//created by Whiplash99 import java.io.*; import java.util.*; public class A { public static void main(String[] args) throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int i,N; N=Integer.parseInt(br.readLine().trim()); String[] s=br.read...
Java
["3\n7 10 2", "1\n4"]
2 seconds
["17", "4"]
NoteFor the first test case, here's how a circular value of $$$17$$$ is obtained:Pick the number at index $$$3$$$. The sum of adjacent elements equals $$$17$$$. Delete $$$7$$$ and $$$10$$$ from the circle and replace $$$2$$$ with $$$17$$$.Note that the answer may not fit in a $$$32$$$-bit integer.
Java 8
standard input
[ "dp", "greedy", "games", "brute force" ]
a9473e6ec81c10c4f88973ac2d60ad04
The first line contains one odd integer $$$n$$$ ($$$1 \leq n &lt; 2 \cdot 10^5$$$, $$$n$$$ is odd)  — the initial size of the circle. The second line contains $$$n$$$ integers $$$a_{1},a_{2},\dots,a_{n}$$$ ($$$0 \leq a_{i} \leq 10^9$$$)  — the initial numbers in the circle.
2,100
Output the maximum possible circular value after applying some sequence of operations to the given circle.
standard output
PASSED
84aa3e04232a0ad6b93fbe6dd7952c0b
train_001.jsonl
1594479900
Danny, the local Math Maniac, is fascinated by circles, Omkar's most recent creation. Help him solve this circle problem!You are given $$$n$$$ nonnegative integers $$$a_1, a_2, \dots, a_n$$$ arranged in a circle, where $$$n$$$ must be odd (ie. $$$n-1$$$ is divisible by $$$2$$$). Formally, for all $$$i$$$ such that $$$2...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
["3\n7 10 2", "1\n4"]
2 seconds
["17", "4"]
NoteFor the first test case, here's how a circular value of $$$17$$$ is obtained:Pick the number at index $$$3$$$. The sum of adjacent elements equals $$$17$$$. Delete $$$7$$$ and $$$10$$$ from the circle and replace $$$2$$$ with $$$17$$$.Note that the answer may not fit in a $$$32$$$-bit integer.
Java 8
standard input
[ "dp", "greedy", "games", "brute force" ]
a9473e6ec81c10c4f88973ac2d60ad04
The first line contains one odd integer $$$n$$$ ($$$1 \leq n &lt; 2 \cdot 10^5$$$, $$$n$$$ is odd)  — the initial size of the circle. The second line contains $$$n$$$ integers $$$a_{1},a_{2},\dots,a_{n}$$$ ($$$0 \leq a_{i} \leq 10^9$$$)  — the initial numbers in the circle.
2,100
Output the maximum possible circular value after applying some sequence of operations to the given circle.
standard output
PASSED
0746b37d2e7ef0f298face22d0f6b5b0
train_001.jsonl
1594479900
Danny, the local Math Maniac, is fascinated by circles, Omkar's most recent creation. Help him solve this circle problem!You are given $$$n$$$ nonnegative integers $$$a_1, a_2, \dots, a_n$$$ arranged in a circle, where $$$n$$$ must be odd (ie. $$$n-1$$$ is divisible by $$$2$$$). Formally, for all $$$i$$$ such that $$$2...
256 megabytes
import java.util.*; import java.io.*; public class MainClass { public static void main(String[] args) throws IOException { Reader in = new Reader(); int n = in.nextInt(); long[] A = new long[n]; for (int i=0;i<n;i++) A[i] = in.nextLong(); if (n == 1) { ...
Java
["3\n7 10 2", "1\n4"]
2 seconds
["17", "4"]
NoteFor the first test case, here's how a circular value of $$$17$$$ is obtained:Pick the number at index $$$3$$$. The sum of adjacent elements equals $$$17$$$. Delete $$$7$$$ and $$$10$$$ from the circle and replace $$$2$$$ with $$$17$$$.Note that the answer may not fit in a $$$32$$$-bit integer.
Java 8
standard input
[ "dp", "greedy", "games", "brute force" ]
a9473e6ec81c10c4f88973ac2d60ad04
The first line contains one odd integer $$$n$$$ ($$$1 \leq n &lt; 2 \cdot 10^5$$$, $$$n$$$ is odd)  — the initial size of the circle. The second line contains $$$n$$$ integers $$$a_{1},a_{2},\dots,a_{n}$$$ ($$$0 \leq a_{i} \leq 10^9$$$)  — the initial numbers in the circle.
2,100
Output the maximum possible circular value after applying some sequence of operations to the given circle.
standard output
PASSED
efe2d403714d5b03ef4afeb9dff8410a
train_001.jsonl
1594479900
Danny, the local Math Maniac, is fascinated by circles, Omkar's most recent creation. Help him solve this circle problem!You are given $$$n$$$ nonnegative integers $$$a_1, a_2, \dots, a_n$$$ arranged in a circle, where $$$n$$$ must be odd (ie. $$$n-1$$$ is divisible by $$$2$$$). Formally, for all $$$i$$$ such that $$$2...
256 megabytes
import java.io.*; import java.util.*; public class check4 { public static void main(String[] args) throws IOException{ Reader sc=new Reader(); PrintWriter out = new PrintWriter(System.out); //int t=sc.nextInt(); // while(t-->0) // { int n=sc.nextInt(); ...
Java
["3\n7 10 2", "1\n4"]
2 seconds
["17", "4"]
NoteFor the first test case, here's how a circular value of $$$17$$$ is obtained:Pick the number at index $$$3$$$. The sum of adjacent elements equals $$$17$$$. Delete $$$7$$$ and $$$10$$$ from the circle and replace $$$2$$$ with $$$17$$$.Note that the answer may not fit in a $$$32$$$-bit integer.
Java 8
standard input
[ "dp", "greedy", "games", "brute force" ]
a9473e6ec81c10c4f88973ac2d60ad04
The first line contains one odd integer $$$n$$$ ($$$1 \leq n &lt; 2 \cdot 10^5$$$, $$$n$$$ is odd)  — the initial size of the circle. The second line contains $$$n$$$ integers $$$a_{1},a_{2},\dots,a_{n}$$$ ($$$0 \leq a_{i} \leq 10^9$$$)  — the initial numbers in the circle.
2,100
Output the maximum possible circular value after applying some sequence of operations to the given circle.
standard output
PASSED
cbd02695bf9a06260a19baee236bc7b0
train_001.jsonl
1594479900
Danny, the local Math Maniac, is fascinated by circles, Omkar's most recent creation. Help him solve this circle problem!You are given $$$n$$$ nonnegative integers $$$a_1, a_2, \dots, a_n$$$ arranged in a circle, where $$$n$$$ must be odd (ie. $$$n-1$$$ is divisible by $$$2$$$). Formally, for all $$$i$$$ such that $$$2...
256 megabytes
import java.io.*; import java.util.*; public class check4 { public static void main(String[] args) throws IOException{ Reader sc=new Reader(); PrintWriter out = new PrintWriter(System.out); //int t=sc.nextInt(); // while(t-->0) // { int n=sc.nextInt(); long ...
Java
["3\n7 10 2", "1\n4"]
2 seconds
["17", "4"]
NoteFor the first test case, here's how a circular value of $$$17$$$ is obtained:Pick the number at index $$$3$$$. The sum of adjacent elements equals $$$17$$$. Delete $$$7$$$ and $$$10$$$ from the circle and replace $$$2$$$ with $$$17$$$.Note that the answer may not fit in a $$$32$$$-bit integer.
Java 8
standard input
[ "dp", "greedy", "games", "brute force" ]
a9473e6ec81c10c4f88973ac2d60ad04
The first line contains one odd integer $$$n$$$ ($$$1 \leq n &lt; 2 \cdot 10^5$$$, $$$n$$$ is odd)  — the initial size of the circle. The second line contains $$$n$$$ integers $$$a_{1},a_{2},\dots,a_{n}$$$ ($$$0 \leq a_{i} \leq 10^9$$$)  — the initial numbers in the circle.
2,100
Output the maximum possible circular value after applying some sequence of operations to the given circle.
standard output
PASSED
e7c660d9872890676dbf9f5a9b3acab7
train_001.jsonl
1594479900
Danny, the local Math Maniac, is fascinated by circles, Omkar's most recent creation. Help him solve this circle problem!You are given $$$n$$$ nonnegative integers $$$a_1, a_2, \dots, a_n$$$ arranged in a circle, where $$$n$$$ must be odd (ie. $$$n-1$$$ is divisible by $$$2$$$). Formally, for all $$$i$$$ such that $$$2...
256 megabytes
import java.util.*; import java.lang.*; // StringBuilder uses java.lang public class mC { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long[] inp = new long[n]; long[] ok = new long[n]; long start = 0; fo...
Java
["3\n7 10 2", "1\n4"]
2 seconds
["17", "4"]
NoteFor the first test case, here's how a circular value of $$$17$$$ is obtained:Pick the number at index $$$3$$$. The sum of adjacent elements equals $$$17$$$. Delete $$$7$$$ and $$$10$$$ from the circle and replace $$$2$$$ with $$$17$$$.Note that the answer may not fit in a $$$32$$$-bit integer.
Java 8
standard input
[ "dp", "greedy", "games", "brute force" ]
a9473e6ec81c10c4f88973ac2d60ad04
The first line contains one odd integer $$$n$$$ ($$$1 \leq n &lt; 2 \cdot 10^5$$$, $$$n$$$ is odd)  — the initial size of the circle. The second line contains $$$n$$$ integers $$$a_{1},a_{2},\dots,a_{n}$$$ ($$$0 \leq a_{i} \leq 10^9$$$)  — the initial numbers in the circle.
2,100
Output the maximum possible circular value after applying some sequence of operations to the given circle.
standard output
PASSED
16db7bfcf73c6c0cc1837f4ca9bd5b0c
train_001.jsonl
1594479900
Danny, the local Math Maniac, is fascinated by circles, Omkar's most recent creation. Help him solve this circle problem!You are given $$$n$$$ nonnegative integers $$$a_1, a_2, \dots, a_n$$$ arranged in a circle, where $$$n$$$ must be odd (ie. $$$n-1$$$ is divisible by $$$2$$$). Formally, for all $$$i$$$ such that $$$2...
256 megabytes
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 stone { public static void main(String args[]) throws IOException { FastReader sc = new FastReader(); BufferedWriter w = new BufferedWriter(new PrintWriter(Sys...
Java
["3\n7 10 2", "1\n4"]
2 seconds
["17", "4"]
NoteFor the first test case, here's how a circular value of $$$17$$$ is obtained:Pick the number at index $$$3$$$. The sum of adjacent elements equals $$$17$$$. Delete $$$7$$$ and $$$10$$$ from the circle and replace $$$2$$$ with $$$17$$$.Note that the answer may not fit in a $$$32$$$-bit integer.
Java 8
standard input
[ "dp", "greedy", "games", "brute force" ]
a9473e6ec81c10c4f88973ac2d60ad04
The first line contains one odd integer $$$n$$$ ($$$1 \leq n &lt; 2 \cdot 10^5$$$, $$$n$$$ is odd)  — the initial size of the circle. The second line contains $$$n$$$ integers $$$a_{1},a_{2},\dots,a_{n}$$$ ($$$0 \leq a_{i} \leq 10^9$$$)  — the initial numbers in the circle.
2,100
Output the maximum possible circular value after applying some sequence of operations to the given circle.
standard output
PASSED
fcb587df2316432a7a347fa1a30b4dc2
train_001.jsonl
1594479900
Danny, the local Math Maniac, is fascinated by circles, Omkar's most recent creation. Help him solve this circle problem!You are given $$$n$$$ nonnegative integers $$$a_1, a_2, \dots, a_n$$$ arranged in a circle, where $$$n$$$ must be odd (ie. $$$n-1$$$ is divisible by $$$2$$$). Formally, for all $$$i$$$ such that $$$2...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; Ou...
Java
["3\n7 10 2", "1\n4"]
2 seconds
["17", "4"]
NoteFor the first test case, here's how a circular value of $$$17$$$ is obtained:Pick the number at index $$$3$$$. The sum of adjacent elements equals $$$17$$$. Delete $$$7$$$ and $$$10$$$ from the circle and replace $$$2$$$ with $$$17$$$.Note that the answer may not fit in a $$$32$$$-bit integer.
Java 8
standard input
[ "dp", "greedy", "games", "brute force" ]
a9473e6ec81c10c4f88973ac2d60ad04
The first line contains one odd integer $$$n$$$ ($$$1 \leq n &lt; 2 \cdot 10^5$$$, $$$n$$$ is odd)  — the initial size of the circle. The second line contains $$$n$$$ integers $$$a_{1},a_{2},\dots,a_{n}$$$ ($$$0 \leq a_{i} \leq 10^9$$$)  — the initial numbers in the circle.
2,100
Output the maximum possible circular value after applying some sequence of operations to the given circle.
standard output
PASSED
c2636ec82fd483f8e178ce5822cc4199
train_001.jsonl
1594479900
Danny, the local Math Maniac, is fascinated by circles, Omkar's most recent creation. Help him solve this circle problem!You are given $$$n$$$ nonnegative integers $$$a_1, a_2, \dots, a_n$$$ arranged in a circle, where $$$n$$$ must be odd (ie. $$$n-1$$$ is divisible by $$$2$$$). Formally, for all $$$i$$$ such that $$$2...
256 megabytes
import java.util.*; import java.io.*; public class Main { static Queue<Integer>q=new LinkedList<Integer>(); public static void primeFactors(int n) { // Print the number of 2s that divide n while (n % 2 == 0) { q.add(2); n /= 2; ...
Java
["3\n7 10 2", "1\n4"]
2 seconds
["17", "4"]
NoteFor the first test case, here's how a circular value of $$$17$$$ is obtained:Pick the number at index $$$3$$$. The sum of adjacent elements equals $$$17$$$. Delete $$$7$$$ and $$$10$$$ from the circle and replace $$$2$$$ with $$$17$$$.Note that the answer may not fit in a $$$32$$$-bit integer.
Java 8
standard input
[ "dp", "greedy", "games", "brute force" ]
a9473e6ec81c10c4f88973ac2d60ad04
The first line contains one odd integer $$$n$$$ ($$$1 \leq n &lt; 2 \cdot 10^5$$$, $$$n$$$ is odd)  — the initial size of the circle. The second line contains $$$n$$$ integers $$$a_{1},a_{2},\dots,a_{n}$$$ ($$$0 \leq a_{i} \leq 10^9$$$)  — the initial numbers in the circle.
2,100
Output the maximum possible circular value after applying some sequence of operations to the given circle.
standard output
PASSED
0139ae405daa1df438820e4aae2bcf8c
train_001.jsonl
1455986100
As you know, every birthday party has a cake! This time, Babaei is going to prepare the very special birthday party's cake.Simple cake is a cylinder of some radius and height. The volume of the simple cake is equal to the volume of corresponding cylinder. Babaei has n simple cakes and he is going to make a special cake...
256 megabytes
import java.awt.geom.AffineTransform; import java.awt.geom.Point2D; import java.io.*; import java.math.BigDecimal; import java.util.*; public class C343D { private static StringTokenizer st; public static void nextLine(BufferedReader br) throws IOException { st = new StringTokenizer(br.readLine()...
Java
["2\n100 30\n40 10", "4\n1 1\n9 7\n1 4\n10 7"]
2 seconds
["942477.796077000", "3983.539484752"]
NoteIn first sample, the optimal way is to choose the cake number 1.In second sample, the way to get the maximum volume is to use cakes with indices 1, 2 and 4.
Java 7
standard input
[ "data structures", "dp" ]
49a647a99eab59a61b42515d4289d3cd
The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — the number of simple cakes Babaei has. Each of the following n lines contains two integers ri and hi (1 ≤ ri, hi ≤ 10 000), giving the radius and height of the i-th cake.
2,000
Print the maximum volume of the cake that Babaei can make. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
5cd16ca4fbae9dee25cde382383c943d
train_001.jsonl
1455986100
As you know, every birthday party has a cake! This time, Babaei is going to prepare the very special birthday party's cake.Simple cake is a cylinder of some radius and height. The volume of the simple cake is equal to the volume of corresponding cylinder. Babaei has n simple cakes and he is going to make a special cake...
256 megabytes
import java.io.BufferedInputStream; import java.io.IOException; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.InputMismatchExcep...
Java
["2\n100 30\n40 10", "4\n1 1\n9 7\n1 4\n10 7"]
2 seconds
["942477.796077000", "3983.539484752"]
NoteIn first sample, the optimal way is to choose the cake number 1.In second sample, the way to get the maximum volume is to use cakes with indices 1, 2 and 4.
Java 7
standard input
[ "data structures", "dp" ]
49a647a99eab59a61b42515d4289d3cd
The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — the number of simple cakes Babaei has. Each of the following n lines contains two integers ri and hi (1 ≤ ri, hi ≤ 10 000), giving the radius and height of the i-th cake.
2,000
Print the maximum volume of the cake that Babaei can make. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
d6ef92d745c559d5ae98ed1e0928568e
train_001.jsonl
1455986100
As you know, every birthday party has a cake! This time, Babaei is going to prepare the very special birthday party's cake.Simple cake is a cylinder of some radius and height. The volume of the simple cake is equal to the volume of corresponding cylinder. Babaei has n simple cakes and he is going to make a special cake...
256 megabytes
import java.io.*; import java.util.*; public class Main { static class Pair implements Comparable<Pair> { long volume; long sum; public Pair(long volume, long sum) { this.volume = volume; this.sum = sum; } @Override public int compareTo(Pair other) { int compareVolume = Long.compare(volume, o...
Java
["2\n100 30\n40 10", "4\n1 1\n9 7\n1 4\n10 7"]
2 seconds
["942477.796077000", "3983.539484752"]
NoteIn first sample, the optimal way is to choose the cake number 1.In second sample, the way to get the maximum volume is to use cakes with indices 1, 2 and 4.
Java 7
standard input
[ "data structures", "dp" ]
49a647a99eab59a61b42515d4289d3cd
The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — the number of simple cakes Babaei has. Each of the following n lines contains two integers ri and hi (1 ≤ ri, hi ≤ 10 000), giving the radius and height of the i-th cake.
2,000
Print the maximum volume of the cake that Babaei can make. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
ca2aa9ff26de9f6ade0ca07e02159300
train_001.jsonl
1455986100
As you know, every birthday party has a cake! This time, Babaei is going to prepare the very special birthday party's cake.Simple cake is a cylinder of some radius and height. The volume of the simple cake is equal to the volume of corresponding cylinder. Babaei has n simple cakes and he is going to make a special cake...
256 megabytes
import java.io.BufferedInputStream; import java.io.IOException; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.InputMismatchExcep...
Java
["2\n100 30\n40 10", "4\n1 1\n9 7\n1 4\n10 7"]
2 seconds
["942477.796077000", "3983.539484752"]
NoteIn first sample, the optimal way is to choose the cake number 1.In second sample, the way to get the maximum volume is to use cakes with indices 1, 2 and 4.
Java 7
standard input
[ "data structures", "dp" ]
49a647a99eab59a61b42515d4289d3cd
The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — the number of simple cakes Babaei has. Each of the following n lines contains two integers ri and hi (1 ≤ ri, hi ≤ 10 000), giving the radius and height of the i-th cake.
2,000
Print the maximum volume of the cake that Babaei can make. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
d987f5425473ad68a259b0bc7510c410
train_001.jsonl
1375549200
In a far away land, there are two cities near a river. One day, the cities decide that they have too little space and would like to reclaim some of the river area into land.The river area can be represented by a grid with r rows and exactly two columns — each cell represents a rectangular area. The rows are numbered 1 ...
256 megabytes
import java.util.*; import static java.lang.Math.*; import java.io.*; public class C { public static void p(Object...o) { System.out.println(Arrays.deepToString(o));} public static void main(String[] args) throws Exception { Scanner in = new Scanner(System.in); int R = in.nextInt(); int N = in.nextInt(); b...
Java
["3 1\n1 1", "12 2\n4 1\n8 1", "1 1\n1 2"]
2 seconds
["WIN", "WIN", "LOSE"]
NoteIn the first example, there are 3 possible cells for the first city to reclaim: (2, 1), (3, 1), or (3, 2). The first two possibilities both lose, as they leave exactly one cell for the other city. However, reclaiming the cell at (3, 2) leaves no more cells that can be reclaimed, and therefore the first city wins. ...
Java 7
standard input
[]
d66c7774acb7e4b1f5da105dfa5c1d36
The first line consists of two integers r and n (1 ≤ r ≤ 100, 0 ≤ n ≤ r). Then n lines follow, describing the cells that were already reclaimed. Each line consists of two integers: ri and ci (1 ≤ ri ≤ r, 1 ≤ ci ≤ 2), which represent the cell located at row ri and column ci. All of the lines describing the cells will be...
2,100
Output "WIN" if the city whose turn it is to choose a cell can guarantee that they will be the last to choose a cell. Otherwise print "LOSE".
standard output
PASSED
9786fef1b86d0d82bd2ed458d08832e0
train_001.jsonl
1375549200
In a far away land, there are two cities near a river. One day, the cities decide that they have too little space and would like to reclaim some of the river area into land.The river area can be represented by a grid with r rows and exactly two columns — each cell represents a rectangular area. The rows are numbered 1 ...
256 megabytes
import java.io.*; import java.util.*; public class C { public static void main(String[] args) { new C().run(); } BufferedReader br; StringTokenizer in; PrintWriter out; public String nextToken() throws IOException { while (in == null || !in.hasMoreTokens()) { in = new StringTokenizer(br.readLine()); }...
Java
["3 1\n1 1", "12 2\n4 1\n8 1", "1 1\n1 2"]
2 seconds
["WIN", "WIN", "LOSE"]
NoteIn the first example, there are 3 possible cells for the first city to reclaim: (2, 1), (3, 1), or (3, 2). The first two possibilities both lose, as they leave exactly one cell for the other city. However, reclaiming the cell at (3, 2) leaves no more cells that can be reclaimed, and therefore the first city wins. ...
Java 7
standard input
[]
d66c7774acb7e4b1f5da105dfa5c1d36
The first line consists of two integers r and n (1 ≤ r ≤ 100, 0 ≤ n ≤ r). Then n lines follow, describing the cells that were already reclaimed. Each line consists of two integers: ri and ci (1 ≤ ri ≤ r, 1 ≤ ci ≤ 2), which represent the cell located at row ri and column ci. All of the lines describing the cells will be...
2,100
Output "WIN" if the city whose turn it is to choose a cell can guarantee that they will be the last to choose a cell. Otherwise print "LOSE".
standard output
PASSED
6c91762b5e2d2c5bc307bf68a9e30459
train_001.jsonl
1375549200
In a far away land, there are two cities near a river. One day, the cities decide that they have too little space and would like to reclaim some of the river area into land.The river area can be represented by a grid with r rows and exactly two columns — each cell represents a rectangular area. The rows are numbered 1 ...
256 megabytes
import java.util.*; public class C { static boolean[][] move(boolean[][] G, int r, int c) { boolean[][] G2 = new boolean[G.length][2]; for(int rr=0; rr<G.length; rr++) for(int cc=0; cc<2; cc++) G2[rr][cc] = G[rr][cc]; G2[r][c] = true; if(r+1<G2.length) G2[r+1][1-c] = true; if(r-1>=0) G2[r-1][1-c] =...
Java
["3 1\n1 1", "12 2\n4 1\n8 1", "1 1\n1 2"]
2 seconds
["WIN", "WIN", "LOSE"]
NoteIn the first example, there are 3 possible cells for the first city to reclaim: (2, 1), (3, 1), or (3, 2). The first two possibilities both lose, as they leave exactly one cell for the other city. However, reclaiming the cell at (3, 2) leaves no more cells that can be reclaimed, and therefore the first city wins. ...
Java 7
standard input
[]
d66c7774acb7e4b1f5da105dfa5c1d36
The first line consists of two integers r and n (1 ≤ r ≤ 100, 0 ≤ n ≤ r). Then n lines follow, describing the cells that were already reclaimed. Each line consists of two integers: ri and ci (1 ≤ ri ≤ r, 1 ≤ ci ≤ 2), which represent the cell located at row ri and column ci. All of the lines describing the cells will be...
2,100
Output "WIN" if the city whose turn it is to choose a cell can guarantee that they will be the last to choose a cell. Otherwise print "LOSE".
standard output
PASSED
92ab65366f1e96175b625cfbd2c92887
train_001.jsonl
1375549200
In a far away land, there are two cities near a river. One day, the cities decide that they have too little space and would like to reclaim some of the river area into land.The river area can be represented by a grid with r rows and exactly two columns — each cell represents a rectangular area. The rows are numbered 1 ...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.util.Arrays; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public cla...
Java
["3 1\n1 1", "12 2\n4 1\n8 1", "1 1\n1 2"]
2 seconds
["WIN", "WIN", "LOSE"]
NoteIn the first example, there are 3 possible cells for the first city to reclaim: (2, 1), (3, 1), or (3, 2). The first two possibilities both lose, as they leave exactly one cell for the other city. However, reclaiming the cell at (3, 2) leaves no more cells that can be reclaimed, and therefore the first city wins. ...
Java 7
standard input
[]
d66c7774acb7e4b1f5da105dfa5c1d36
The first line consists of two integers r and n (1 ≤ r ≤ 100, 0 ≤ n ≤ r). Then n lines follow, describing the cells that were already reclaimed. Each line consists of two integers: ri and ci (1 ≤ ri ≤ r, 1 ≤ ci ≤ 2), which represent the cell located at row ri and column ci. All of the lines describing the cells will be...
2,100
Output "WIN" if the city whose turn it is to choose a cell can guarantee that they will be the last to choose a cell. Otherwise print "LOSE".
standard output
PASSED
9c066d2fe428105a3b43800d7402b6f6
train_001.jsonl
1331280000
One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p and character c and delete the p-th occurrence of character c from the name. After the user changed his name, he can't undo th...
256 megabytes
import java.io.*; import java.util.*; /** * @author ����� * */ public class C1 implements Runnable { BufferedReader br; StringTokenizer st; PrintWriter out; String nextToken() throws IOException { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } int...
Java
["2\nbac\n3\n2 a\n1 b\n2 c", "1\nabacaba\n4\n1 a\n1 a\n1 c\n2 b"]
3 seconds
["acb", "baa"]
NoteLet's consider the first sample. Initially we have name "bacbac"; the first operation transforms it into "bacbc", the second one — to "acbc", and finally, the third one transforms it into "acb".
Java 6
standard input
[ "*special", "data structures", "binary search", "brute force", "strings" ]
adbfdb0d2fd9e4eb48a27d43f401f0e0
The first line contains an integer k (1 ≤ k ≤ 2000). The second line contains a non-empty string s, consisting of lowercase Latin letters, at most 100 characters long. The third line contains an integer n (0 ≤ n ≤ 20000) — the number of username changes. Each of the next n lines contains the actual changes, one per lin...
1,400
Print a single string — the user's final name after all changes are applied to it.
standard output
PASSED
a6fb9b54c6772274ffd8bb8f57d8a230
train_001.jsonl
1331280000
One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p and character c and delete the p-th occurrence of character c from the name. After the user changed his name, he can't undo th...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; public class C159 { public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int k = Integer.par...
Java
["2\nbac\n3\n2 a\n1 b\n2 c", "1\nabacaba\n4\n1 a\n1 a\n1 c\n2 b"]
3 seconds
["acb", "baa"]
NoteLet's consider the first sample. Initially we have name "bacbac"; the first operation transforms it into "bacbc", the second one — to "acbc", and finally, the third one transforms it into "acb".
Java 6
standard input
[ "*special", "data structures", "binary search", "brute force", "strings" ]
adbfdb0d2fd9e4eb48a27d43f401f0e0
The first line contains an integer k (1 ≤ k ≤ 2000). The second line contains a non-empty string s, consisting of lowercase Latin letters, at most 100 characters long. The third line contains an integer n (0 ≤ n ≤ 20000) — the number of username changes. Each of the next n lines contains the actual changes, one per lin...
1,400
Print a single string — the user's final name after all changes are applied to it.
standard output
PASSED
84bbaeeeb8911def3d5d5bcb900b575c
train_001.jsonl
1331280000
One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p and character c and delete the p-th occurrence of character c from the name. After the user changed his name, he can't undo th...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class C { static class Tmp{ } public static void main(String[] args) { Character ch = (char)17; Scanner sc = new Scanner(System.in); int k = sc.nextInt(); sc.nextLine(); String s = sc.nextLine(); ArrayList<Integer> arr[] = new ArrayList[...
Java
["2\nbac\n3\n2 a\n1 b\n2 c", "1\nabacaba\n4\n1 a\n1 a\n1 c\n2 b"]
3 seconds
["acb", "baa"]
NoteLet's consider the first sample. Initially we have name "bacbac"; the first operation transforms it into "bacbc", the second one — to "acbc", and finally, the third one transforms it into "acb".
Java 6
standard input
[ "*special", "data structures", "binary search", "brute force", "strings" ]
adbfdb0d2fd9e4eb48a27d43f401f0e0
The first line contains an integer k (1 ≤ k ≤ 2000). The second line contains a non-empty string s, consisting of lowercase Latin letters, at most 100 characters long. The third line contains an integer n (0 ≤ n ≤ 20000) — the number of username changes. Each of the next n lines contains the actual changes, one per lin...
1,400
Print a single string — the user's final name after all changes are applied to it.
standard output
PASSED
e29e8b480ca2f6f2bda61ab07593dc3f
train_001.jsonl
1331280000
One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p and character c and delete the p-th occurrence of character c from the name. After the user changed his name, he can't undo th...
256 megabytes
import java.util.*; import java.awt.*; public class C { public static void main(String args[]) { Scanner scan = new Scanner(System.in); int k = scan.nextInt(); String str = scan.next(); StringBuffer sb = new StringBuffer(); for(int i=0;i < k;i++) sb.append(str); if(sb.length() == 1) { System.ou...
Java
["2\nbac\n3\n2 a\n1 b\n2 c", "1\nabacaba\n4\n1 a\n1 a\n1 c\n2 b"]
3 seconds
["acb", "baa"]
NoteLet's consider the first sample. Initially we have name "bacbac"; the first operation transforms it into "bacbc", the second one — to "acbc", and finally, the third one transforms it into "acb".
Java 6
standard input
[ "*special", "data structures", "binary search", "brute force", "strings" ]
adbfdb0d2fd9e4eb48a27d43f401f0e0
The first line contains an integer k (1 ≤ k ≤ 2000). The second line contains a non-empty string s, consisting of lowercase Latin letters, at most 100 characters long. The third line contains an integer n (0 ≤ n ≤ 20000) — the number of username changes. Each of the next n lines contains the actual changes, one per lin...
1,400
Print a single string — the user's final name after all changes are applied to it.
standard output
PASSED
eab3539bccccddcd2a2629304e7c24ce
train_001.jsonl
1331280000
One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p and character c and delete the p-th occurrence of character c from the name. After the user changed his name, he can't undo th...
256 megabytes
import java.io.*; import java.util.*; public class C { public static void main(String[] args) { new C().run(); } BufferedReader br; StringTokenizer in; PrintWriter out; public String nextToken() throws IOException { while (in == null || !in.hasMoreTokens()) { in = new StringTokenizer(br.readLine()); }...
Java
["2\nbac\n3\n2 a\n1 b\n2 c", "1\nabacaba\n4\n1 a\n1 a\n1 c\n2 b"]
3 seconds
["acb", "baa"]
NoteLet's consider the first sample. Initially we have name "bacbac"; the first operation transforms it into "bacbc", the second one — to "acbc", and finally, the third one transforms it into "acb".
Java 6
standard input
[ "*special", "data structures", "binary search", "brute force", "strings" ]
adbfdb0d2fd9e4eb48a27d43f401f0e0
The first line contains an integer k (1 ≤ k ≤ 2000). The second line contains a non-empty string s, consisting of lowercase Latin letters, at most 100 characters long. The third line contains an integer n (0 ≤ n ≤ 20000) — the number of username changes. Each of the next n lines contains the actual changes, one per lin...
1,400
Print a single string — the user's final name after all changes are applied to it.
standard output
PASSED
778ed3b100ab80d152faa839c95af41b
train_001.jsonl
1331280000
One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p and character c and delete the p-th occurrence of character c from the name. After the user changed his name, he can't undo th...
256 megabytes
import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class C { int INF = 1 << 28; String name; void run() { Scanner sc = new Scanner(System.in); int k = sc.nextInt(); name = sc.next(); int n = sc.nextInt(); Operation[] op = ...
Java
["2\nbac\n3\n2 a\n1 b\n2 c", "1\nabacaba\n4\n1 a\n1 a\n1 c\n2 b"]
3 seconds
["acb", "baa"]
NoteLet's consider the first sample. Initially we have name "bacbac"; the first operation transforms it into "bacbc", the second one — to "acbc", and finally, the third one transforms it into "acb".
Java 6
standard input
[ "*special", "data structures", "binary search", "brute force", "strings" ]
adbfdb0d2fd9e4eb48a27d43f401f0e0
The first line contains an integer k (1 ≤ k ≤ 2000). The second line contains a non-empty string s, consisting of lowercase Latin letters, at most 100 characters long. The third line contains an integer n (0 ≤ n ≤ 20000) — the number of username changes. Each of the next n lines contains the actual changes, one per lin...
1,400
Print a single string — the user's final name after all changes are applied to it.
standard output
PASSED
0b33932cec74ea48a693e4cc2f486b8f
train_001.jsonl
1331280000
One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p and character c and delete the p-th occurrence of character c from the name. After the user changed his name, he can't undo th...
256 megabytes
import java.util.*; public class c { public static void main(String args[]) { Scanner in = new Scanner(System.in); int K = in.nextInt(); String S = in.next(); myString[] string = new myString[K]; for(int i = 0; i < K; i++) string[i] = new myString(S); int N = in.nextInt(); for(int i = 0; i < N; i++...
Java
["2\nbac\n3\n2 a\n1 b\n2 c", "1\nabacaba\n4\n1 a\n1 a\n1 c\n2 b"]
3 seconds
["acb", "baa"]
NoteLet's consider the first sample. Initially we have name "bacbac"; the first operation transforms it into "bacbc", the second one — to "acbc", and finally, the third one transforms it into "acb".
Java 6
standard input
[ "*special", "data structures", "binary search", "brute force", "strings" ]
adbfdb0d2fd9e4eb48a27d43f401f0e0
The first line contains an integer k (1 ≤ k ≤ 2000). The second line contains a non-empty string s, consisting of lowercase Latin letters, at most 100 characters long. The third line contains an integer n (0 ≤ n ≤ 20000) — the number of username changes. Each of the next n lines contains the actual changes, one per lin...
1,400
Print a single string — the user's final name after all changes are applied to it.
standard output
PASSED
b60e9bf75cd2d9834b49fb459d2b1b4a
train_001.jsonl
1331280000
One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p and character c and delete the p-th occurrence of character c from the name. After the user changed his name, he can't undo th...
256 megabytes
import java.io.*; import java.util.*; public class TaskC { BufferedReader br; PrintWriter out; StringTokenizer stok; String nextToken() throws IOException { while (stok == null || !stok.hasMoreTokens()) { String s = br.readLine(); if (s == null) { return null; } stok = new StringTokenizer(s); ...
Java
["2\nbac\n3\n2 a\n1 b\n2 c", "1\nabacaba\n4\n1 a\n1 a\n1 c\n2 b"]
3 seconds
["acb", "baa"]
NoteLet's consider the first sample. Initially we have name "bacbac"; the first operation transforms it into "bacbc", the second one — to "acbc", and finally, the third one transforms it into "acb".
Java 6
standard input
[ "*special", "data structures", "binary search", "brute force", "strings" ]
adbfdb0d2fd9e4eb48a27d43f401f0e0
The first line contains an integer k (1 ≤ k ≤ 2000). The second line contains a non-empty string s, consisting of lowercase Latin letters, at most 100 characters long. The third line contains an integer n (0 ≤ n ≤ 20000) — the number of username changes. Each of the next n lines contains the actual changes, one per lin...
1,400
Print a single string — the user's final name after all changes are applied to it.
standard output
PASSED
2cf7cfc5f53ef5f49210ecf2c98d3314
train_001.jsonl
1331280000
One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p and character c and delete the p-th occurrence of character c from the name. After the user changed his name, he can't undo th...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; import java.util.StringTokenizer; public class Sol { BufferedReader br; StringTokenizer st; PrintStream out; String nextToken() throws IOException { while (st == null || !...
Java
["2\nbac\n3\n2 a\n1 b\n2 c", "1\nabacaba\n4\n1 a\n1 a\n1 c\n2 b"]
3 seconds
["acb", "baa"]
NoteLet's consider the first sample. Initially we have name "bacbac"; the first operation transforms it into "bacbc", the second one — to "acbc", and finally, the third one transforms it into "acb".
Java 6
standard input
[ "*special", "data structures", "binary search", "brute force", "strings" ]
adbfdb0d2fd9e4eb48a27d43f401f0e0
The first line contains an integer k (1 ≤ k ≤ 2000). The second line contains a non-empty string s, consisting of lowercase Latin letters, at most 100 characters long. The third line contains an integer n (0 ≤ n ≤ 20000) — the number of username changes. Each of the next n lines contains the actual changes, one per lin...
1,400
Print a single string — the user's final name after all changes are applied to it.
standard output
PASSED
4fca0f2152e26efb1e779a9596760e09
train_001.jsonl
1331280000
One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p and character c and delete the p-th occurrence of character c from the name. After the user changed his name, he can't undo th...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n,m, len; boolean a[][] = new boolean[2000][100]; int sw[][] = new int [2000][26]; for (int i=0; i<2000; i++) { for (int j=0; j<100; j++) { ...
Java
["2\nbac\n3\n2 a\n1 b\n2 c", "1\nabacaba\n4\n1 a\n1 a\n1 c\n2 b"]
3 seconds
["acb", "baa"]
NoteLet's consider the first sample. Initially we have name "bacbac"; the first operation transforms it into "bacbc", the second one — to "acbc", and finally, the third one transforms it into "acb".
Java 6
standard input
[ "*special", "data structures", "binary search", "brute force", "strings" ]
adbfdb0d2fd9e4eb48a27d43f401f0e0
The first line contains an integer k (1 ≤ k ≤ 2000). The second line contains a non-empty string s, consisting of lowercase Latin letters, at most 100 characters long. The third line contains an integer n (0 ≤ n ≤ 20000) — the number of username changes. Each of the next n lines contains the actual changes, one per lin...
1,400
Print a single string — the user's final name after all changes are applied to it.
standard output
PASSED
8b67850bd62be8c68068dbb841d3a467
train_001.jsonl
1331280000
One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p and character c and delete the p-th occurrence of character c from the name. After the user changed his name, he can't undo th...
256 megabytes
import java.awt.*; import java.io.*; import java.math.*; import java.util.*; import static java.lang.Math.*; public class VKCup_Qual2_C implements Runnable { BufferedReader in; PrintWriter out; StringTokenizer tok; public static void main(String[] args) { new Thread(null, new VKCup_Qual2_C(), "", 256 * (1L <<...
Java
["2\nbac\n3\n2 a\n1 b\n2 c", "1\nabacaba\n4\n1 a\n1 a\n1 c\n2 b"]
3 seconds
["acb", "baa"]
NoteLet's consider the first sample. Initially we have name "bacbac"; the first operation transforms it into "bacbc", the second one — to "acbc", and finally, the third one transforms it into "acb".
Java 6
standard input
[ "*special", "data structures", "binary search", "brute force", "strings" ]
adbfdb0d2fd9e4eb48a27d43f401f0e0
The first line contains an integer k (1 ≤ k ≤ 2000). The second line contains a non-empty string s, consisting of lowercase Latin letters, at most 100 characters long. The third line contains an integer n (0 ≤ n ≤ 20000) — the number of username changes. Each of the next n lines contains the actual changes, one per lin...
1,400
Print a single string — the user's final name after all changes are applied to it.
standard output
PASSED
848dc5cdc3deb1a53f8f437e29e041c3
train_001.jsonl
1331280000
One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p and character c and delete the p-th occurrence of character c from the name. After the user changed his name, he can't undo th...
256 megabytes
import java.util.*; public class Pass2{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int k = sc.nextInt(); String pass = sc.next(); int n = sc.nextInt(); String[][] changes = new String[n][2]; for(int i = 0; i < n; i++) { changes[i][0] = sc.next(); changes[i][1] = sc.n...
Java
["2\nbac\n3\n2 a\n1 b\n2 c", "1\nabacaba\n4\n1 a\n1 a\n1 c\n2 b"]
3 seconds
["acb", "baa"]
NoteLet's consider the first sample. Initially we have name "bacbac"; the first operation transforms it into "bacbc", the second one — to "acbc", and finally, the third one transforms it into "acb".
Java 6
standard input
[ "*special", "data structures", "binary search", "brute force", "strings" ]
adbfdb0d2fd9e4eb48a27d43f401f0e0
The first line contains an integer k (1 ≤ k ≤ 2000). The second line contains a non-empty string s, consisting of lowercase Latin letters, at most 100 characters long. The third line contains an integer n (0 ≤ n ≤ 20000) — the number of username changes. Each of the next n lines contains the actual changes, one per lin...
1,400
Print a single string — the user's final name after all changes are applied to it.
standard output
PASSED
73b83e789278daf6ccf417cdea4fa3b6
train_001.jsonl
1331280000
One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p and character c and delete the p-th occurrence of character c from the name. After the user changed his name, he can't undo th...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; public class C { final static int size = 200000; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedR...
Java
["2\nbac\n3\n2 a\n1 b\n2 c", "1\nabacaba\n4\n1 a\n1 a\n1 c\n2 b"]
3 seconds
["acb", "baa"]
NoteLet's consider the first sample. Initially we have name "bacbac"; the first operation transforms it into "bacbc", the second one — to "acbc", and finally, the third one transforms it into "acb".
Java 6
standard input
[ "*special", "data structures", "binary search", "brute force", "strings" ]
adbfdb0d2fd9e4eb48a27d43f401f0e0
The first line contains an integer k (1 ≤ k ≤ 2000). The second line contains a non-empty string s, consisting of lowercase Latin letters, at most 100 characters long. The third line contains an integer n (0 ≤ n ≤ 20000) — the number of username changes. Each of the next n lines contains the actual changes, one per lin...
1,400
Print a single string — the user's final name after all changes are applied to it.
standard output
PASSED
9decc484bb104a5a3c70896758c935f1
train_001.jsonl
1331280000
One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p and character c and delete the p-th occurrence of character c from the name. After the user changed his name, he can't undo th...
256 megabytes
import java.io.*; import java.util.*; public class Main { public void solve( ) throws Throwable { int copies = in.nextInt( ); char ch[ ] = in.next( ).toCharArray( ); int len = ch.length; int count[ ][ ] = new int[ copies ][ 128 ]; boolean ans[ ][ ] = new boolean[ copies ][ l...
Java
["2\nbac\n3\n2 a\n1 b\n2 c", "1\nabacaba\n4\n1 a\n1 a\n1 c\n2 b"]
3 seconds
["acb", "baa"]
NoteLet's consider the first sample. Initially we have name "bacbac"; the first operation transforms it into "bacbc", the second one — to "acbc", and finally, the third one transforms it into "acb".
Java 6
standard input
[ "*special", "data structures", "binary search", "brute force", "strings" ]
adbfdb0d2fd9e4eb48a27d43f401f0e0
The first line contains an integer k (1 ≤ k ≤ 2000). The second line contains a non-empty string s, consisting of lowercase Latin letters, at most 100 characters long. The third line contains an integer n (0 ≤ n ≤ 20000) — the number of username changes. Each of the next n lines contains the actual changes, one per lin...
1,400
Print a single string — the user's final name after all changes are applied to it.
standard output
PASSED
17ee29534cce2803ffd09d388b3fdf80
train_001.jsonl
1331280000
One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p and character c and delete the p-th occurrence of character c from the name. After the user changed his name, he can't undo th...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.Arrays; import static java.lang.Math.*; import static java.lang.Integer.*; @SuppressWarnings("unused") public class VKQual2C { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamR...
Java
["2\nbac\n3\n2 a\n1 b\n2 c", "1\nabacaba\n4\n1 a\n1 a\n1 c\n2 b"]
3 seconds
["acb", "baa"]
NoteLet's consider the first sample. Initially we have name "bacbac"; the first operation transforms it into "bacbc", the second one — to "acbc", and finally, the third one transforms it into "acb".
Java 6
standard input
[ "*special", "data structures", "binary search", "brute force", "strings" ]
adbfdb0d2fd9e4eb48a27d43f401f0e0
The first line contains an integer k (1 ≤ k ≤ 2000). The second line contains a non-empty string s, consisting of lowercase Latin letters, at most 100 characters long. The third line contains an integer n (0 ≤ n ≤ 20000) — the number of username changes. Each of the next n lines contains the actual changes, one per lin...
1,400
Print a single string — the user's final name after all changes are applied to it.
standard output
PASSED
8b59610a57afbbf8e216606820fc1b5f
train_001.jsonl
1288440000
The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the factory warehouse for blind production. The problem is that all of them are spare details from different orders, that is, they ma...
256 megabytes
import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public stat...
Java
["4 2\n1 2 3 4", "5 3\n5 5 7 3 1", "2 3\n1 2"]
2 seconds
["8", "15", "0"]
NoteIn the first sample test the required window is 2 × 4 in size and the blinds for it consist of 4 parts, each 2 bourlemeters long. One of the parts is the initial stripe with the length of 2, the other one is a part of a cut stripe with the length of 3 and the two remaining stripes are parts of a stripe with the len...
Java 7
standard input
[ "brute force" ]
991516fa6f3ed5a71c547a3a50ea1a2b
The first output line contains two space-separated integers n and l (1 ≤ n, l ≤ 100). They are the number of stripes in the warehouse and the minimal acceptable length of a blind stripe in bourlemeters. The second line contains space-separated n integers ai. They are the lengths of initial stripes in bourlemeters (1 ≤ ...
1,400
Print the single number — the maximal area of the window in square bourlemeters that can be completely covered. If no window with a positive area that can be covered completely without breaking any of the given rules exist, then print the single number 0.
standard output
PASSED
de7a67bf00b4325c970b375190318684
train_001.jsonl
1288440000
The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the factory warehouse for blind production. The problem is that all of them are spare details from different orders, that is, they ma...
256 megabytes
import java.io.*; import java.util.*; public class j { public static void main(String a[])throws IOException { BufferedReader b=new BufferedReader(new InputStreamReader(System.in)); int n=0,j=0,m=0,i=0; int d[]=new int[101]; d[0]=0; String s; s=b.readLine(); StringTokenizer c=new StringTokenizer(s); m=Integer.parseInt(...
Java
["4 2\n1 2 3 4", "5 3\n5 5 7 3 1", "2 3\n1 2"]
2 seconds
["8", "15", "0"]
NoteIn the first sample test the required window is 2 × 4 in size and the blinds for it consist of 4 parts, each 2 bourlemeters long. One of the parts is the initial stripe with the length of 2, the other one is a part of a cut stripe with the length of 3 and the two remaining stripes are parts of a stripe with the len...
Java 7
standard input
[ "brute force" ]
991516fa6f3ed5a71c547a3a50ea1a2b
The first output line contains two space-separated integers n and l (1 ≤ n, l ≤ 100). They are the number of stripes in the warehouse and the minimal acceptable length of a blind stripe in bourlemeters. The second line contains space-separated n integers ai. They are the lengths of initial stripes in bourlemeters (1 ≤ ...
1,400
Print the single number — the maximal area of the window in square bourlemeters that can be completely covered. If no window with a positive area that can be covered completely without breaking any of the given rules exist, then print the single number 0.
standard output
PASSED
4e4ddcc5c26cf8b7157bab2526f5d956
train_001.jsonl
1288440000
The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the factory warehouse for blind production. The problem is that all of them are spare details from different orders, that is, they ma...
256 megabytes
import java.util.*; import java.io.*; public class Main implements Runnable { public void solve() throws IOException { int N = nextInt(); int L = nextInt(); int[] a = new int[N]; for(int i = 0; i < N; i++) a[i] = nextInt(); int answer = 0; ...
Java
["4 2\n1 2 3 4", "5 3\n5 5 7 3 1", "2 3\n1 2"]
2 seconds
["8", "15", "0"]
NoteIn the first sample test the required window is 2 × 4 in size and the blinds for it consist of 4 parts, each 2 bourlemeters long. One of the parts is the initial stripe with the length of 2, the other one is a part of a cut stripe with the length of 3 and the two remaining stripes are parts of a stripe with the len...
Java 7
standard input
[ "brute force" ]
991516fa6f3ed5a71c547a3a50ea1a2b
The first output line contains two space-separated integers n and l (1 ≤ n, l ≤ 100). They are the number of stripes in the warehouse and the minimal acceptable length of a blind stripe in bourlemeters. The second line contains space-separated n integers ai. They are the lengths of initial stripes in bourlemeters (1 ≤ ...
1,400
Print the single number — the maximal area of the window in square bourlemeters that can be completely covered. If no window with a positive area that can be covered completely without breaking any of the given rules exist, then print the single number 0.
standard output
PASSED
d12d8478f76e1228f7ff25fd46170b85
train_001.jsonl
1288440000
The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the factory warehouse for blind production. The problem is that all of them are spare details from different orders, that is, they ma...
256 megabytes
import java.io.IOException; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author Zyflair Griffane */ public ...
Java
["4 2\n1 2 3 4", "5 3\n5 5 7 3 1", "2 3\n1 2"]
2 seconds
["8", "15", "0"]
NoteIn the first sample test the required window is 2 × 4 in size and the blinds for it consist of 4 parts, each 2 bourlemeters long. One of the parts is the initial stripe with the length of 2, the other one is a part of a cut stripe with the length of 3 and the two remaining stripes are parts of a stripe with the len...
Java 7
standard input
[ "brute force" ]
991516fa6f3ed5a71c547a3a50ea1a2b
The first output line contains two space-separated integers n and l (1 ≤ n, l ≤ 100). They are the number of stripes in the warehouse and the minimal acceptable length of a blind stripe in bourlemeters. The second line contains space-separated n integers ai. They are the lengths of initial stripes in bourlemeters (1 ≤ ...
1,400
Print the single number — the maximal area of the window in square bourlemeters that can be completely covered. If no window with a positive area that can be covered completely without breaking any of the given rules exist, then print the single number 0.
standard output
PASSED
35d71417d85d236afe30abf976fb8207
train_001.jsonl
1288440000
The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the factory warehouse for blind production. The problem is that all of them are spare details from different orders, that is, they ma...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.lang.reflect.Constructor; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.StringTokenizer; public class CodeE { static class Scanner { BufferedReader br = new BufferedReader(new InputStr...
Java
["4 2\n1 2 3 4", "5 3\n5 5 7 3 1", "2 3\n1 2"]
2 seconds
["8", "15", "0"]
NoteIn the first sample test the required window is 2 × 4 in size and the blinds for it consist of 4 parts, each 2 bourlemeters long. One of the parts is the initial stripe with the length of 2, the other one is a part of a cut stripe with the length of 3 and the two remaining stripes are parts of a stripe with the len...
Java 7
standard input
[ "brute force" ]
991516fa6f3ed5a71c547a3a50ea1a2b
The first output line contains two space-separated integers n and l (1 ≤ n, l ≤ 100). They are the number of stripes in the warehouse and the minimal acceptable length of a blind stripe in bourlemeters. The second line contains space-separated n integers ai. They are the lengths of initial stripes in bourlemeters (1 ≤ ...
1,400
Print the single number — the maximal area of the window in square bourlemeters that can be completely covered. If no window with a positive area that can be covered completely without breaking any of the given rules exist, then print the single number 0.
standard output
PASSED
2b2fe0445d0ac0ab3b25973385b128a3
train_001.jsonl
1288440000
The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the factory warehouse for blind production. The problem is that all of them are spare details from different orders, that is, they ma...
256 megabytes
import java.util.Scanner; public class Some_pr { public static void main(String[] args) { Scanner read = new Scanner(System.in); int n, i, j, l, ans = 0, sum; n = read.nextInt(); l = read.nextInt(); int[] a = new int[n]; for (i=0; i<n; i++) a[i] =...
Java
["4 2\n1 2 3 4", "5 3\n5 5 7 3 1", "2 3\n1 2"]
2 seconds
["8", "15", "0"]
NoteIn the first sample test the required window is 2 × 4 in size and the blinds for it consist of 4 parts, each 2 bourlemeters long. One of the parts is the initial stripe with the length of 2, the other one is a part of a cut stripe with the length of 3 and the two remaining stripes are parts of a stripe with the len...
Java 7
standard input
[ "brute force" ]
991516fa6f3ed5a71c547a3a50ea1a2b
The first output line contains two space-separated integers n and l (1 ≤ n, l ≤ 100). They are the number of stripes in the warehouse and the minimal acceptable length of a blind stripe in bourlemeters. The second line contains space-separated n integers ai. They are the lengths of initial stripes in bourlemeters (1 ≤ ...
1,400
Print the single number — the maximal area of the window in square bourlemeters that can be completely covered. If no window with a positive area that can be covered completely without breaking any of the given rules exist, then print the single number 0.
standard output
PASSED
67b30d6562a328d0368e5a44fb3e0ad3
train_001.jsonl
1288440000
The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the factory warehouse for blind production. The problem is that all of them are spare details from different orders, that is, they ma...
256 megabytes
import java.util.Scanner; public class Task{ public static void main(String args[]){ Solver s = new Solver(); s.solve(); } } class Solver{ private Scanner sc = new Scanner(System.in); public void solve(){ int n = sc.nextInt(), l = sc.nextInt(); int a[] = new int[n]; for (int i=0;i<n;i++) a[i...
Java
["4 2\n1 2 3 4", "5 3\n5 5 7 3 1", "2 3\n1 2"]
2 seconds
["8", "15", "0"]
NoteIn the first sample test the required window is 2 × 4 in size and the blinds for it consist of 4 parts, each 2 bourlemeters long. One of the parts is the initial stripe with the length of 2, the other one is a part of a cut stripe with the length of 3 and the two remaining stripes are parts of a stripe with the len...
Java 7
standard input
[ "brute force" ]
991516fa6f3ed5a71c547a3a50ea1a2b
The first output line contains two space-separated integers n and l (1 ≤ n, l ≤ 100). They are the number of stripes in the warehouse and the minimal acceptable length of a blind stripe in bourlemeters. The second line contains space-separated n integers ai. They are the lengths of initial stripes in bourlemeters (1 ≤ ...
1,400
Print the single number — the maximal area of the window in square bourlemeters that can be completely covered. If no window with a positive area that can be covered completely without breaking any of the given rules exist, then print the single number 0.
standard output
PASSED
4cb4ec1eb9bdff9f7a1a03cc5fca972d
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; import java.io.*; public class Main { static class Scan { private byte[] buf=new byte[1024]; private int index; private InputStream in; private int total; public Scan() { in=System.in; } public int scan()throws IOExcepti...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
8655b90a8205b604d19c4a9450a75625
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; import java.io.*; public class Main { static class Scan { private byte[] buf=new byte[1024]; private int index; private InputStream in; private int total; public Scan() { in=System.in; } public int scan()throws IOExcepti...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
6467eda7e3bd1dfb988120bf05449402
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; public class susie { public static void main(String[] args) { Scanner iangay = new Scanner(System.in); int numPeople = iangay.nextInt(); int[] people = new int[numPeople]; for (int i = 0; i < numPeople; i++) { people[i] = iangay.nextInt(); } Arrays.sort(pe...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
6e84cb5bd6f9ddb3346c58f8f6efe9a7
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Ei...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
28a5c2af67b1608f74610aff22070ce2
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import javax.swing.plaf.basic.BasicInternalFrameTitlePane; import java.util.*; import java.lang.*; public class Main { public static void main (String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int happyPeople=0; int [] timesOfPeople = new int[n]...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
fda675192f8aa0bc4586746a79666fb2
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.io.IOException; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); int n =sc.nextInt(); int[] wait=new int[n]; for(int i=0;i<n;i++){ wait[i]...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
00a7fb0247b763c4ab2104bec2f240f0
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; public class queue { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int a[] = new int[n]; int b[] = new int[n]; int temp=0; for(int i=0;i<n;i++) a[i] = sc.nextInt(); Arrays.sort(a); int count=1; b[0] = a[0]; int j=1; f...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
8de4c7a6ada898cf25a17f8b94ef2ac6
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); List<Integer> l = new ArrayList<>(); for(int i=0;i<n;i++){ int a = sc.nextInt(); l.add(a); } Collections.s...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
103b3c4549ac0db055ea8094d39bed90
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.util.*; public class Codeforces { static class FastReader { BufferedReader br; StringTokenizer st; public Fast...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
2b54e9452696502bc648c40f8a9feb43
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; public class Practise { static Scanner in = new Scanner(System.in); static int[] array(int n) { int[] a = new int[n]; for(int i = 0; i < n; i++) a[i] = in.nextInt(); return a; } public static void main(String[] args) { int n = in.nextInt(); ...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
4767b605e84dec0717968c0ca6017a12
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; public class Practise { static Scanner in = new Scanner(System.in); public static void main(String[] args) { int n = in.nextInt(); int[] a = new int[n]; for(int i = 0; i < n; i++) { a[i] = in.nextInt(); } Arrays.sort(a); int sum = 0; ...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
250a5aa5a0b283afe83f95c9692f7555
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class Solution545D { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); List<Integer> list = new ArrayList<>(); ...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
064fe7fbaef676d41e58af78aed42ee7
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import static java.lang.Math.*; import static java.lang.Integer.parseInt; import static java.lang.Long.parseLong; import static java.lang.Double.parseDouble; import static java.lang.String.*; public class Main { public static void main(String[] args) ...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
31f974c2411e979dbc59793d13555905
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; public class queue { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int a[] = new int[n]; int b[] = new int[n]; int temp=0; for(int i=0;i<n;i++) a[i] = sc.nextInt(); Arrays.sort(a); int count=1; b[0] = a[0]; int j=1; ...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
83f22d2b0ecf992a7404e3c912a79986
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; public class SolutionC { public static void main(String args[]){ Scanner s1=new Scanner(System.in); int n=s1.nextInt(); int arr[]=new int[n]; for(int i=0;i<n;i++){ arr[i]=s1.nextInt(); } Arrays.sort(arr); long sum=0,count=0; for(int i=0;i<n;i++){ int ext=arr[i]; if(sum<=ex...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
f4414680a3539d0361c439cfd912d65b
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { public static void process()throws IOException { int n=ni(); Integer arr[]=new Integer[n+1]; for(int i=1;i<=n;i++) arr[i]=ni(); arr[0]=0; r_sort(arr,n+1); int time=arr[1],r...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
deeacb0d6f79609a4b9efe5e17c08ec3
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; public class cf545D { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); long arr[]=new long[n]; for(int i=0;i<n;i++) {arr[i]=sc.nextLong();} Arrays.sort(arr); long t=0,c=0; for(int i=0;i<n;i++) {if(t<=arr[i]) {c++;} else {arr[i]=0;} t=t+arr[i];} System....
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
19fa853210cac6abf07bfb86f85af728
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class Queue { public static void main(String[]args){ Mainn.FastReader s = new Mainn.FastReader(); int n=s.nextInt(); Integer[]array=...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
25fc1437a107b661bbaf8acd5e3bfd2c
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; // SHIVAM GUPTA : //NSIT //decoder_1671 //BEING PERFECTIONIST IS NOT AN OPTION // ASCII = 48 + i ; // SHIVAM GUPTA : /* Name of the class has to be "Main" only if the class is public. */ public class Main { static PrintWriter out;...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
d5a06ba939b2b467a8a994aff5de21fc
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] time = new int[n]; int waitingTime = 0; int happyPeople = 0; for(int i=0; i<n; i++){ ...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
1beb390e609645dc10da4fd8ac08a6ba
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
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.StringTokenizer; public class Queue { static class FastReader { BufferedReader br; StringTokenizer st; public FastReade...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
36409ca95b513e9922ada969c5c19543
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
//package learning; import java.util.*; public class Answer { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n; n=sc.nextInt(); int arr[]=new int[n]; for(int i=0;i<n;i++) arr[i]=sc.nextInt(); Arrays.sort(arr); int sum=0,count=0; for(int i=0;i<n;i++) { if(sum<=arr[...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
e906aee5c632957bd0e22c4b52a9a655
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Problem545D { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int noOfGuys = sc.nextInt(); long timeNeededToServe[] = new long[noOfGuys]; for (int i = 0; i < noOfGuys; i++) { tim...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
874ed781676180ef0bfc42c1f83acda4
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; import java.io.*; public class codeforces { public static void main(String[] args) throws IOException { try{ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int[] arr=new int[n]; for(int i=0;i<n;i++){ arr[i]=sc.nextInt(); } Arrays.parallelSort(arr); int counter=0,sum=0; for(int...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
3d07d0acd329168ec550a3f59a42ff78
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.Arrays; import java.util.Collections; import java.util.Scanner; public class Queue { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); Integer[] arr = new Integer[n]; for(int i = 0; i < n;i++) { arr[i] = sc.nextInt(); } Collections.sort...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
9c798dc47a4865c9e2b13f6af3df8ea0
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; public class Main { public static void main(String[] args) throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); int n = nextInt(); long[] a...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
ad5fdac279a359d8ab12d89300189554
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class RPS { public static void main (String[] args) throws java.lang.Exception { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] times = new int[n]; for (int i = 0; i < n; i++) { times[i] ...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
4f31b9f7a47b3ee12935bf7a962068f9
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class codeforces545D { public static void main(String[] args){ Scanner sc=new Scanner(System.in); int noOfGuys=sc.nextInt(); long timeNeededToServe[]=new long[noOfGuys]; for(int i=0;i<noOfGuys;i++){ timeNeededToSer...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
8e43d37f85f25621cccfdad76c06ca81
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.io.*; import java.util.*; public class Main { private static void solver(InputReader sc, PrintWriter out) { int n = sc.nextInt(); int[] arr = new int[n]; for(int i=0; i<n; i++) arr[i] = sc.nextInt(); Arrays.sort(arr); int count=1; long sum...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
1d3914f15286f2c87021523b2a0901a4
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main { static ArrayList<Integer>[] gr; static boolean[] was; static boolean[] want_h; static int to; static boolean ans; public static void...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
d3783ba0cedfa6a17624977e26d84f86
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class D545Unsolved { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader(){ br = new Buff...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
83183d710ff51a6af41a37e90a048bf1
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; import java.io.*; public class Solution{ static PrintWriter out=new PrintWriter(System.out); public static void main (String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String[] input=br.readLine().trim().split(" "); int n=Integer....
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
88fa72b24067a9a4c23b5fab5d24f2b0
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
/* package codechef; // don't place package name! */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.*; public class HelloWorld{ public static void main(String[] args) throws IOException ...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
9593bc1b3706c1564737f5d0efa59de3
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
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 node { public static void main (String[] args) throws java.lang.Exception { // your code goes here Scanner sc=new Scan...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
cf1db9c7c813cf1eb485bfe3cf41e208
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import javafx.util.Pair; import java.util.*; public class Main { // private int V; // private LinkedList<Integer> adj[]; // // Main(int v) { // V = v; // adj = new LinkedList[v]; // for (int i = 0; i < v; ++i) { // adj[i] = new LinkedList(); // } // } // // void a...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
98d18c886d0442c0e2c298c2281c5129
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int[] a = new int[n]; for(int i=0; i<n; i++) { a[i] = input.nextInt(); } ...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
c6df5210fd2d2f96e08d87a77133e262
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t,a,c=1,n=sc.nextInt(); int ar[]=new int[n]; for(t=0;t<n;t++) ar[t]=sc.nextInt(); Arrays.sort(ar); a=ar[0]; for(t=1;t<n;t++) ...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
2893caab84a25d22e14dd3f823e64921
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; public class Length { public static int min = 0; public static int sg = 0; public static ArrayList<Integer> arr = new ArrayList<Integer>(1000); public static boolean possible = true; public static void main(String[] args){ Scanner in = new Scanner(System.in); int...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
e470070f98fed96d75877d9c47561e82
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class QueueProb { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n]; for (int i=0; i<n; i++){ arr[i] = sc.nextInt(); } Arra...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
5946089c7e8bddd36fc948f8f9c20dce
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; import java.io.*; public class Queue { public static void main(String[] args) throws IOException, FileNotFoundException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); //BufferedReader in = new BufferedReader(new FileReader("Queue.in")); // INPUT // int n = I...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
5d7ad14a857832bfc6da77cd7458068b
train_001.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; import java.lang.*; public class Main { public static void main (String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] time = new int[n]; for (int i = 0; i < n; i++) { time[i] = in.nextInt(); } Arrays.sort(...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 11
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
f02ba18b32d1e3c6e1bd8f4e4d301fe2
train_001.jsonl
1552322100
At the big break Nastya came to the school dining room. There are $$$n$$$ pupils in the school, numbered from $$$1$$$ to $$$n$$$. Unfortunately, Nastya came pretty late, so that all pupils had already stood in the queue, i.e. Nastya took the last place in the queue. Of course, it's a little bit sad for Nastya, but she ...
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.HashMap; import java.util.HashSet; @SuppressWarnings("Duplicates") public class ProblemD { public static void main(String[] args) throws IOException{ Reader sc = new Rea...
Java
["2 1\n1 2\n1 2", "3 3\n3 1 2\n1 2\n3 1\n3 2", "5 2\n3 1 5 4 2\n5 2\n5 4"]
2 seconds
["1", "2", "1"]
NoteIn the first example Nastya can just change places with the first pupil in the queue.Optimal sequence of changes in the second example is change places for pupils with numbers $$$1$$$ and $$$3$$$. change places for pupils with numbers $$$3$$$ and $$$2$$$. change places for pupils with numbers $$$1$$$ and $$$2$$...
Java 8
standard input
[ "greedy" ]
1716b35de299e88c891ba71f9c368b51
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 3 \cdot 10^{5}$$$, $$$0 \leq m \leq 5 \cdot 10^{5}$$$) — the number of pupils in the queue and number of pairs of pupils such that the first one agrees to change places with the second one if the first is directly in front of the second. The sec...
1,800
Print a single integer — the number of places in queue she can move forward.
standard output
PASSED
49319d0940cdaa21ef480b3ec4335ddc
train_001.jsonl
1552322100
At the big break Nastya came to the school dining room. There are $$$n$$$ pupils in the school, numbered from $$$1$$$ to $$$n$$$. Unfortunately, Nastya came pretty late, so that all pupils had already stood in the queue, i.e. Nastya took the last place in the queue. Of course, it's a little bit sad for Nastya, but she ...
256 megabytes
import java.util.*; import java.io.*; public class Solution{ public static void main (String[] args) throws java.lang.Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); StringToken...
Java
["2 1\n1 2\n1 2", "3 3\n3 1 2\n1 2\n3 1\n3 2", "5 2\n3 1 5 4 2\n5 2\n5 4"]
2 seconds
["1", "2", "1"]
NoteIn the first example Nastya can just change places with the first pupil in the queue.Optimal sequence of changes in the second example is change places for pupils with numbers $$$1$$$ and $$$3$$$. change places for pupils with numbers $$$3$$$ and $$$2$$$. change places for pupils with numbers $$$1$$$ and $$$2$$...
Java 8
standard input
[ "greedy" ]
1716b35de299e88c891ba71f9c368b51
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 3 \cdot 10^{5}$$$, $$$0 \leq m \leq 5 \cdot 10^{5}$$$) — the number of pupils in the queue and number of pairs of pupils such that the first one agrees to change places with the second one if the first is directly in front of the second. The sec...
1,800
Print a single integer — the number of places in queue she can move forward.
standard output
PASSED
8d57baacbe2e78aaf9b9d5a279825eb0
train_001.jsonl
1552322100
At the big break Nastya came to the school dining room. There are $$$n$$$ pupils in the school, numbered from $$$1$$$ to $$$n$$$. Unfortunately, Nastya came pretty late, so that all pupils had already stood in the queue, i.e. Nastya took the last place in the queue. Of course, it's a little bit sad for Nastya, but she ...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); StringTokenizer st = new StringTokenizer(in.readLine(...
Java
["2 1\n1 2\n1 2", "3 3\n3 1 2\n1 2\n3 1\n3 2", "5 2\n3 1 5 4 2\n5 2\n5 4"]
2 seconds
["1", "2", "1"]
NoteIn the first example Nastya can just change places with the first pupil in the queue.Optimal sequence of changes in the second example is change places for pupils with numbers $$$1$$$ and $$$3$$$. change places for pupils with numbers $$$3$$$ and $$$2$$$. change places for pupils with numbers $$$1$$$ and $$$2$$...
Java 8
standard input
[ "greedy" ]
1716b35de299e88c891ba71f9c368b51
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 3 \cdot 10^{5}$$$, $$$0 \leq m \leq 5 \cdot 10^{5}$$$) — the number of pupils in the queue and number of pairs of pupils such that the first one agrees to change places with the second one if the first is directly in front of the second. The sec...
1,800
Print a single integer — the number of places in queue she can move forward.
standard output
PASSED
5a6fb787fd036968b2ed539a85f12332
train_001.jsonl
1552322100
At the big break Nastya came to the school dining room. There are $$$n$$$ pupils in the school, numbered from $$$1$$$ to $$$n$$$. Unfortunately, Nastya came pretty late, so that all pupils had already stood in the queue, i.e. Nastya took the last place in the queue. Of course, it's a little bit sad for Nastya, but she ...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; import java.util.List; import java.util.*; public class realfast implements Runnable { private static final int INF = (int) 1e9; long in= (long)Math.pow(10,9); long fac[]= new long[3000]; public...
Java
["2 1\n1 2\n1 2", "3 3\n3 1 2\n1 2\n3 1\n3 2", "5 2\n3 1 5 4 2\n5 2\n5 4"]
2 seconds
["1", "2", "1"]
NoteIn the first example Nastya can just change places with the first pupil in the queue.Optimal sequence of changes in the second example is change places for pupils with numbers $$$1$$$ and $$$3$$$. change places for pupils with numbers $$$3$$$ and $$$2$$$. change places for pupils with numbers $$$1$$$ and $$$2$$...
Java 8
standard input
[ "greedy" ]
1716b35de299e88c891ba71f9c368b51
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 3 \cdot 10^{5}$$$, $$$0 \leq m \leq 5 \cdot 10^{5}$$$) — the number of pupils in the queue and number of pairs of pupils such that the first one agrees to change places with the second one if the first is directly in front of the second. The sec...
1,800
Print a single integer — the number of places in queue she can move forward.
standard output
PASSED
45d3af3bc0405d5751c64e2fe5e9c6a1
train_001.jsonl
1552322100
At the big break Nastya came to the school dining room. There are $$$n$$$ pupils in the school, numbered from $$$1$$$ to $$$n$$$. Unfortunately, Nastya came pretty late, so that all pupils had already stood in the queue, i.e. Nastya took the last place in the queue. Of course, it's a little bit sad for Nastya, but she ...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { try { String[] line; BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); line = in.readLine().split(" "); int n = Integer.parseInt(line[0...
Java
["2 1\n1 2\n1 2", "3 3\n3 1 2\n1 2\n3 1\n3 2", "5 2\n3 1 5 4 2\n5 2\n5 4"]
2 seconds
["1", "2", "1"]
NoteIn the first example Nastya can just change places with the first pupil in the queue.Optimal sequence of changes in the second example is change places for pupils with numbers $$$1$$$ and $$$3$$$. change places for pupils with numbers $$$3$$$ and $$$2$$$. change places for pupils with numbers $$$1$$$ and $$$2$$...
Java 8
standard input
[ "greedy" ]
1716b35de299e88c891ba71f9c368b51
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 3 \cdot 10^{5}$$$, $$$0 \leq m \leq 5 \cdot 10^{5}$$$) — the number of pupils in the queue and number of pairs of pupils such that the first one agrees to change places with the second one if the first is directly in front of the second. The sec...
1,800
Print a single integer — the number of places in queue she can move forward.
standard output
PASSED
7b5a637c550e8ae8413380f11c1f768f
train_001.jsonl
1552322100
At the big break Nastya came to the school dining room. There are $$$n$$$ pupils in the school, numbered from $$$1$$$ to $$$n$$$. Unfortunately, Nastya came pretty late, so that all pupils had already stood in the queue, i.e. Nastya took the last place in the queue. Of course, it's a little bit sad for Nastya, but she ...
256 megabytes
import javafx.util.*; import java.util.*; import java.io.*; public class Prg6 { Random rnd = new Random(); PrintWriter pw = new PrintWriter(System.out); HashSet<Integer>[] l; int[] p, s; int a; void run(){ a = ni(); l = new HashSet[a]; for(int q=0; q<a; q++) l[q] = new...
Java
["2 1\n1 2\n1 2", "3 3\n3 1 2\n1 2\n3 1\n3 2", "5 2\n3 1 5 4 2\n5 2\n5 4"]
2 seconds
["1", "2", "1"]
NoteIn the first example Nastya can just change places with the first pupil in the queue.Optimal sequence of changes in the second example is change places for pupils with numbers $$$1$$$ and $$$3$$$. change places for pupils with numbers $$$3$$$ and $$$2$$$. change places for pupils with numbers $$$1$$$ and $$$2$$...
Java 8
standard input
[ "greedy" ]
1716b35de299e88c891ba71f9c368b51
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 3 \cdot 10^{5}$$$, $$$0 \leq m \leq 5 \cdot 10^{5}$$$) — the number of pupils in the queue and number of pairs of pupils such that the first one agrees to change places with the second one if the first is directly in front of the second. The sec...
1,800
Print a single integer — the number of places in queue she can move forward.
standard output