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
92f827f7ba2abbdf8b371ebefe058e01
train_001.jsonl
1390231800
Iahub likes chess very much. He even invented a new chess piece named Coder. A Coder can move (and attack) one square horizontally or vertically. More precisely, if the Coder is located at position (x, y), he can move to (or attack) positions (x + 1, y), (x–1, y), (x, y + 1) and (x, y–1).Iahub wants to know how many Co...
256 megabytes
import java.io.PrintWriter; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner (System.in); PrintWriter output = new PrintWriter(System.out); int n = input.nextInt(); output.println((n*...
Java
["2"]
1 second
["2\nC.\n.C"]
null
Java 8
standard input
[ "implementation" ]
1aede54b41d6fad3e74f24a6592198eb
The first line contains an integer n (1 ≤ n ≤ 1000).
800
On the first line print an integer, the maximum number of Coders that can be placed on the chessboard. On each of the next n lines print n characters, describing the configuration of the Coders. For an empty cell print an '.', and for a Coder print a 'C'. If there are multiple correct answers, you can print any.
standard output
PASSED
6cc3acf7deb808feabc52e7ea76ed349
train_001.jsonl
1390231800
Iahub likes chess very much. He even invented a new chess piece named Coder. A Coder can move (and attack) one square horizontally or vertically. More precisely, if the Coder is located at position (x, y), he can move to (or attack) positions (x + 1, y), (x–1, y), (x, y + 1) and (x, y–1).Iahub wants to know how many Co...
256 megabytes
import java.util.*; import java.io.*; public class Coder { public static void main(String args[]) throws Exception { BufferedReader f=new BufferedReader(new InputStreamReader(System.in)); int size=Integer.parseInt(f.readLine()); System.out.println(size*size/2+(size%2==1?1:0)); String[] arr=new String[2]; St...
Java
["2"]
1 second
["2\nC.\n.C"]
null
Java 8
standard input
[ "implementation" ]
1aede54b41d6fad3e74f24a6592198eb
The first line contains an integer n (1 ≤ n ≤ 1000).
800
On the first line print an integer, the maximum number of Coders that can be placed on the chessboard. On each of the next n lines print n characters, describing the configuration of the Coders. For an empty cell print an '.', and for a Coder print a 'C'. If there are multiple correct answers, you can print any.
standard output
PASSED
6c1f2aa797fbf343c94d01972cd07fa4
train_001.jsonl
1390231800
Iahub likes chess very much. He even invented a new chess piece named Coder. A Coder can move (and attack) one square horizontally or vertically. More precisely, if the Coder is located at position (x, y), he can move to (or attack) positions (x + 1, y), (x–1, y), (x, y + 1) and (x, y–1).Iahub wants to know how many Co...
256 megabytes
import java.util.Scanner; public class Coder{ public static void main(String args[]){ Scanner scan = new Scanner(System.in); int n = scan.nextInt(); long numPieces = 0; //n is odd if(n%2 == 1){ //Odd rows numPieces += ((n+1)...
Java
["2"]
1 second
["2\nC.\n.C"]
null
Java 8
standard input
[ "implementation" ]
1aede54b41d6fad3e74f24a6592198eb
The first line contains an integer n (1 ≤ n ≤ 1000).
800
On the first line print an integer, the maximum number of Coders that can be placed on the chessboard. On each of the next n lines print n characters, describing the configuration of the Coders. For an empty cell print an '.', and for a Coder print a 'C'. If there are multiple correct answers, you can print any.
standard output
PASSED
687fe28f013471e0d1f4aae4bcc4013b
train_001.jsonl
1443430800
Three companies decided to order a billboard with pictures of their logos. A billboard is a big square board. A logo of each company is a rectangle of a non-zero area. Advertisers will put up the ad only if it is possible to place all three logos on the billboard so that they do not overlap and the billboard has no emp...
256 megabytes
import java.io.BufferedOutputStream; import java.io.Closeable; import java.io.DataInputStream; import java.io.Flushable; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Arrays; import java.util.InputMismatchException; /** * Built using CHelper plug-in * Actual so...
Java
["5 1 2 5 5 2", "4 4 2 6 4 2"]
1 second
["5\nAAAAA\nBBBBB\nBBBBB\nCCCCC\nCCCCC", "6\nBBBBBB\nBBBBBB\nAAAACC\nAAAACC\nAAAACC\nAAAACC"]
null
Java 11
standard input
[ "geometry", "constructive algorithms", "bitmasks", "math", "implementation", "brute force" ]
2befe5da2df57d23934601cbe4d4f151
The first line of the input contains six positive integers x1, y1, x2, y2, x3, y3 (1 ≤ x1, y1, x2, y2, x3, y3 ≤ 100), where xi and yi determine the length and width of the logo of the i-th company respectively.
1,700
If it is impossible to place all the three logos on a square shield, print a single integer "-1" (without the quotes). If it is possible, print in the first line the length of a side of square n, where you can place all the three logos. Each of the next n lines should contain n uppercase English letters "A", "B" or "C"...
standard output
PASSED
45e01a38ef33f73d1e0f7160676d101f
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner cin1 = new Scanner(System.in); while (cin1.hasNext()) { int n = cin1.nextInt(); int num = 0; int res = 0; int[] ary = new int[n]; for (int i = 0; i < n; i++) { int b = cin1.nextInt(); num += b; ...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
5a6e19cd586f5ccfeae41d62887c0aee
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); //inputs int n = in.nextInt(); int sum = 0 , cnt = 0; int [] a = new int [n]; for(int i=0 ; i<n ; i++){ int k = in.nextInt(); sum += k; a[i] = k; } ...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
ce941bed324b2ca09ecc8204831d26b4
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class TestClass { public static void main(String[] args){ // TODO Auto-generated method stub FastScanner sc = ne...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
09788cf4b9b76027c94e778484a1cb60
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; import java.util.StringTokenizer; public class dad { public static void main(String[] args) { InputReader in = new InputReader(System.in); ...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
8ac05e2176b946fb62780e7a78cce191
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.util.Scanner; public class ProblemSet { private static Scanner reader; public static void main(String[] args) { // TODO Auto-generated method stub reader = new Scanner(System.in); int n = reader.nextInt(); double sum = 0; int arr[] = new int[n]; for(int i = 0; i < n; i++) { arr[i] = reade...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
a446f0bd39a4251ecee648aaed85e30f
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.util.Scanner; public class AEquator { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int tot = 0; int[] a = new int[n]; for (int i=0;i<n;i++) { a[i] = scanner.nextInt(); tot +=...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
955b7ddc86092d37db3a34d78e32f1c2
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.util.*; public class atink { public static void main(String args[]) { Scanner in=new Scanner(System.in); int n=in.nextInt(); int arr[]=new int[n]; int sum=0; for(int i=0;i<n;i++) { arr[i]=in.nextInt(); sum+=arr[i]; } int temp=0; for(int i=0;i<n;i++) { temp+=arr[i]; if(...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
2c868ab3cddb2b03da3b05d54ae2e5a5
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.util.Scanner; public class test { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int [] tab = new int[n]; double sum = 0; for (int i = 0; i < tab.length; i++) { tab[i] = in.nextInt(); sum += tab[i]; } int i = 0; double somme = 0; ...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
ad7838cea7d7f7fab15eccc3b37a0be3
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.util.Scanner; public class Equator { public static void main (String [] args ){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int sum=0; int [] arr = new int[n]; for(int i =0;i< n; i++){ arr[i]= sc.nextInt(); sum += arr[i]; ...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
61c2b2bc3e561fd67e55e05972f55af4
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.util.Scanner; public class Polycarp { private int n; private int []a ; private Scanner sc; private int s=0; private int[] z; public Polycarp(){ sc=new Scanner(System.in); n=sc.nextInt(); a=new int[n]; z = new int[n]; for(int i=0; i<n; i++){ ...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
b4b54d7e601388797e529b2e965a3602
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class abcd { public static void main (String[] args) throws java.lang.Exception { Scanner s=new Scanner(System.in); int n=s.nextInt(); int a[]=new int[n]; int sum=0; for(int i=0;i<n;i++){ a[i...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
29d0afd52a083587718ad34abd89a972
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.util.Scanner; public class P962A { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); long[] arr = new long[n]; long sum = 0; for (int i = 0; i < n; i++) { arr[i] = s.nextLong(); sum += arr[i]; } long current = 0; for (int i = 0; i <...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
4245901c48f24b7a0709999275901b4f
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.util.Arrays; import java.util.LinkedList; import java.util.Scanner; /** * @author yazan */ public class JavaApplication1 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); double [] arr = new double[n]; ...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
e83c86d0072d8a43cc577d75fbb0bc1c
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.util.Scanner; public class Equator { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String n = sc.nextLine(); int days = Integer.parseInt(n); String input_problems = sc.nextLine(); String[] problems_per_day = input_problems.split(" "); int[] problems_so_far = n...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
b9327e5c460810f8c23f15d0b089ce70
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Ideone { public static void main (String[] args) throws java.lang.Exception { Scanner sc=new Scanner(System.in); ArrayList<Integer> a=new ArrayList<Integer> (); int n=sc.nextInt(); int i,sum=0,sum1=0,c=0; for(i=0;i<n;i++){ a.add(sc.nextInt()); sum...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
d2977abfbd787288b6c0f782644ebc4f
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { private void solve() { int days = nextInt(); int[] problemsInDay = new int[days]; int sumOfProblems = 0; for(int i = 0; i < days; i++) { int tmp = nextInt(); problemsInDay[i] = tmp; ...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
31f90610eb21a31b895df704231dec51
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.util.Scanner; /** * * @author Mostafa */ public class Equator { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Scanner in = new Scanner ( System.in ) ; int n = in.nextInt() ...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
a4a6a5ec0b303b8d8fc45c11d67c25b9
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
34f2e584398e4e1232dcb42dd9366ae4
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.util.*; public class Equator { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int arr[] = new int[n]; long sum = 0; for(int i = 0; i<n; i++) { arr[i] = sc.nextInt(); sum += arr[i]; ...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
b0b1e9aa8255584dcce9e5e0792b674a
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.util.*; import java.lang.Math; import java.io.*; public class Solution { public static void main(String[] args) throws IOException { FastReader in=new FastReader(System.in); int n=in.nextInt(); long[] sum=new long[n]; sum[0]=in.nextLong(); for(int i=1;i<n;i++...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
94e5e5c47644b725f78cfda7f7b932cc
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.util.Scanner; public class EQUATOR { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int arr[]=new int[n]; long sum=0; for(int i=0;i<n;i++){ arr[i]=sc.nextInt(); sum=sum+arr[i]; } long sum2=0; for(int i=0;i<n;i++){ sum2=sum2+arr[i]; if((2*s...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
657c29e6698a10e966dbaec0cb72d068
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.util.Scanner; public class EQUATOR { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); double arr[]=new double[n]; double sum=0; for(int i=0;i<n;i++){ arr[i]=sc.nextInt(); sum=sum+arr[i]; } double half=0; if(sum>0){ half=sum/2.0; } double sum...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
accdddfc92f84ee33b6b507b83dd52f7
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.PrintStream; import java.util.InputMismatchException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Nirav */ public class Main...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
a53a89d2fba5763bce1b97e7ea5b57cc
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.util.Scanner; /** * * @author Ahmad */ public class JavaApplication1 { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner console = new Scanner (System.in) ; int n = console.nextInt() ; int count = 0 ; int c...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
7fbbe7aa7b1c07ae45170f530b9bca8e
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.io.*; public class Main { public static void main(String[] args) throws IOException { FastScanner in = new FastScanner(System.in); PrintWriter out = new PrintWriter(System.out); int n= in.nextInt(); int sum=0,sum1=0; int[] tabb = in.nextIntArray(n); for...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
1974d3b8d3d8e2de1c004b4918a103ff
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.util.Scanner; import java.util.ArrayList; public class Equator{ static int run(int n, String[] a){ int[] an = new int[a.length]; int sum = 0; for(int i = 0; i < an.length; i ++){ sum += Integer.parseInt(a[i]); an[i] = sum; } for(int i ...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
94f84d163e4ff362a88be7ff02b96790
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.util.*; public class contestA { public static void main(String[]args){ double answer=0;int sum=0; 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();sum+=arr[i]; } ...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
581a29e7e66c5799d793085ecc3cb1ff
train_001.jsonl
1523370900
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi...
256 megabytes
import java.lang.*; import java.io.*; import java.util.*; public class MyClass { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int a[]=new int[n]; int p[]=new int[n+1]; int sum=0; for(int i=0;i<n;i++) { ...
Java
["4\n1 3 2 1", "6\n2 2 2 2 2 2"]
2 seconds
["2", "3"]
NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ...
Java 8
standard input
[ "implementation" ]
241157c465fe5dd96acd514010904321
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$...
1,300
Print the index of the day when Polycarp will celebrate the equator.
standard output
PASSED
cdc3cb32d560722311063341988a6d14
train_001.jsonl
1403191800
When Adam gets a rooted tree (connected non-directed graph without cycles), he immediately starts coloring it. More formally, he assigns a color to each edge of the tree so that it meets the following two conditions: There is no vertex that has more than two incident edges painted the same color. For any two vertexe...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public...
Java
["11\n1 1 1 3 4 4 7 3 7 6 6"]
2 seconds
["1 1 1 1 1 2 2 2 2 2 3"]
NoteThe figure below shows one of the possible variants to paint a tree from the sample at the last moment. The cost of the vertexes with numbers 11 and 12 equals 3.
Java 8
standard input
[ "data structures", "trees" ]
dd47f47922a5457f89391beea749242b
The first line contains integer n (1 ≤ n ≤ 106) — the number of times a new vertex is added. The second line contains n numbers pi (1 ≤ pi ≤ i) — the numbers of the vertexes to which we add another vertex.
2,600
Print n integers — the minimum costs of the tree painting after each addition.
standard output
PASSED
6c1f3cdd50d14f996a606debcea7bc33
train_001.jsonl
1403191800
When Adam gets a rooted tree (connected non-directed graph without cycles), he immediately starts coloring it. More formally, he assigns a color to each edge of the tree so that it meets the following two conditions: There is no vertex that has more than two incident edges painted the same color. For any two vertexe...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; import java.math.BigInteger; import java.util.Collections.*; import java.util.function.Consumer; import static java.lang.Math.*; import static java.lang.Math.min; import static java.util.Arrays.*; import static java.math.BigInteger.*; public class...
Java
["11\n1 1 1 3 4 4 7 3 7 6 6"]
2 seconds
["1 1 1 1 1 2 2 2 2 2 3"]
NoteThe figure below shows one of the possible variants to paint a tree from the sample at the last moment. The cost of the vertexes with numbers 11 and 12 equals 3.
Java 8
standard input
[ "data structures", "trees" ]
dd47f47922a5457f89391beea749242b
The first line contains integer n (1 ≤ n ≤ 106) — the number of times a new vertex is added. The second line contains n numbers pi (1 ≤ pi ≤ i) — the numbers of the vertexes to which we add another vertex.
2,600
Print n integers — the minimum costs of the tree painting after each addition.
standard output
PASSED
c16ed0c5916bc48422c514f6ce09c5c4
train_001.jsonl
1432053000
Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr...
256 megabytes
import java.util.Scanner; public class woodcutter { public static void main(String[] arg){ Scanner scan = new Scanner(System.in); int len = scan.nextInt(); if(len<2){System.out.println(len); return;} int[][] nums = new int[len][2]; boolean[] v = new boolean[len+1]; ...
Java
["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"]
1 second
["3", "4"]
NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ...
Java 8
standard input
[ "dp", "greedy" ]
a850dd88a67a6295823e70e2c5c857c9
The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate.
1,500
Print a single number — the maximum number of trees that you can cut down by the given rules.
standard output
PASSED
399bb9ba43fd8f9b8265fc9cec3139f9
train_001.jsonl
1432053000
Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr...
256 megabytes
import java.util.*; import java.io.*; public class Main implements Runnable { public void solve() throws IOException { int n = nextInt(); int[] x = new int[n]; int[] h = new int[n]; for(int i = 0; i < n; i++){ x[i] = nextInt(); ...
Java
["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"]
1 second
["3", "4"]
NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ...
Java 8
standard input
[ "dp", "greedy" ]
a850dd88a67a6295823e70e2c5c857c9
The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate.
1,500
Print a single number — the maximum number of trees that you can cut down by the given rules.
standard output
PASSED
73b40f850d47b95046e8615609735c68
train_001.jsonl
1432053000
Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr...
256 megabytes
import java.util.*; import java.io.*; public class Main implements Runnable { int[][] a; int[][] b; int[][] ret; boolean[][] was; int n; public void solve() throws IOException { n = nextInt(); a = new int[n][3]; b = new int[...
Java
["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"]
1 second
["3", "4"]
NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ...
Java 8
standard input
[ "dp", "greedy" ]
a850dd88a67a6295823e70e2c5c857c9
The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate.
1,500
Print a single number — the maximum number of trees that you can cut down by the given rules.
standard output
PASSED
360fbc628f673002c4c222524bf40b6e
train_001.jsonl
1432053000
Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr...
256 megabytes
import java.util.Scanner; public class CF545_C_Woodcutters { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int[] x = new int[n]; int[] h = new int[n]; for (int i = 0; i < n; i++) { x[i] = scanner.nex...
Java
["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"]
1 second
["3", "4"]
NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ...
Java 8
standard input
[ "dp", "greedy" ]
a850dd88a67a6295823e70e2c5c857c9
The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate.
1,500
Print a single number — the maximum number of trees that you can cut down by the given rules.
standard output
PASSED
15d09f43c53ae25214cca9f98f6639b7
train_001.jsonl
1432053000
Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr...
256 megabytes
import java.util.* ; import java.io.BufferedReader ; import java.io.InputStreamReader ; public class WoodCutters { private static final boolean debug = true ; public static void main(String args[]) throws Exception { BufferedReader bro = new BufferedReader(new InputStreamReader(System.in)) ; ...
Java
["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"]
1 second
["3", "4"]
NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ...
Java 8
standard input
[ "dp", "greedy" ]
a850dd88a67a6295823e70e2c5c857c9
The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate.
1,500
Print a single number — the maximum number of trees that you can cut down by the given rules.
standard output
PASSED
1a125ddafdb68bf941b231a9b653c0a9
train_001.jsonl
1432053000
Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr...
256 megabytes
import java.util.*; public class Test { public static void main(String args[]) { Scanner scn = new Scanner(System.in); int n = scn.nextInt(); int x[] = new int[n]; int h[] = new int[n]; for(int i=0;i<n;i++) { x[i] = scn.nextInt(); h[i] = s...
Java
["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"]
1 second
["3", "4"]
NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ...
Java 8
standard input
[ "dp", "greedy" ]
a850dd88a67a6295823e70e2c5c857c9
The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate.
1,500
Print a single number — the maximum number of trees that you can cut down by the given rules.
standard output
PASSED
2743cd0c10aaa7ad86c8c31c2a46154e
train_001.jsonl
1432053000
Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"]
1 second
["3", "4"]
NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ...
Java 8
standard input
[ "dp", "greedy" ]
a850dd88a67a6295823e70e2c5c857c9
The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate.
1,500
Print a single number — the maximum number of trees that you can cut down by the given rules.
standard output
PASSED
eec4542c7c3eed1045770f0a027aae8a
train_001.jsonl
1432053000
Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr...
256 megabytes
import java.util.Scanner; public class Woodcutters { public static int n; public static int[] coordinates; public static int[] heights; public static int[][] memo = new int[100002][3]; static { for (int i = 0; i < 100002; i++) { for (int j = 0; j < 3; j++) { me...
Java
["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"]
1 second
["3", "4"]
NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ...
Java 8
standard input
[ "dp", "greedy" ]
a850dd88a67a6295823e70e2c5c857c9
The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate.
1,500
Print a single number — the maximum number of trees that you can cut down by the given rules.
standard output
PASSED
b37dddd38a56035a5d73cdfc2ec74ce4
train_001.jsonl
1432053000
Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Temp { public static class InputReader { public BufferedReader reader; public StringTokenizer tokenizer; public InputReader() { reader = new BufferedReader(new InputStreamReader(System.in), 32768); tokenizer = null; } p...
Java
["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"]
1 second
["3", "4"]
NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ...
Java 8
standard input
[ "dp", "greedy" ]
a850dd88a67a6295823e70e2c5c857c9
The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate.
1,500
Print a single number — the maximum number of trees that you can cut down by the given rules.
standard output
PASSED
e33e1e1932fca622753a60d0b4cfd679
train_001.jsonl
1432053000
Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr...
256 megabytes
import java.util.Scanner; /** * * @author ADNAN */ public class Woodcutters { public static int dp[]; public static void main(String args[]) { int x[]; int h[]; int n; Scanner scanner = new Scanner(System.in); n = scanner.nextInt(); scanner.nextLine(); ...
Java
["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"]
1 second
["3", "4"]
NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ...
Java 8
standard input
[ "dp", "greedy" ]
a850dd88a67a6295823e70e2c5c857c9
The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate.
1,500
Print a single number — the maximum number of trees that you can cut down by the given rules.
standard output
PASSED
56fad37e9926d4cfdfcf670ee608c301
train_001.jsonl
1432053000
Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); if (n == 1) { System.out.println(1); return; } int[] x = new int[n]; int[] h = new int[n]; ...
Java
["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"]
1 second
["3", "4"]
NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ...
Java 8
standard input
[ "dp", "greedy" ]
a850dd88a67a6295823e70e2c5c857c9
The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate.
1,500
Print a single number — the maximum number of trees that you can cut down by the given rules.
standard output
PASSED
9ddb3cdf22a3499ddfbee5292fc310b9
train_001.jsonl
1432053000
Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr...
256 megabytes
import java.util.*; public class WoodCutters { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int tree = sc.nextInt(); int[] X = new int[tree]; int[] H = new int[tree]; for (int i = 0; i < tree; i++) { int first = sc.nextInt(); int second = sc.nextInt(); X[i] = ...
Java
["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"]
1 second
["3", "4"]
NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ...
Java 8
standard input
[ "dp", "greedy" ]
a850dd88a67a6295823e70e2c5c857c9
The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate.
1,500
Print a single number — the maximum number of trees that you can cut down by the given rules.
standard output
PASSED
56230c20ba67a29ad207f3c0ab304b92
train_001.jsonl
1432053000
Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { Input...
Java
["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"]
1 second
["3", "4"]
NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ...
Java 8
standard input
[ "dp", "greedy" ]
a850dd88a67a6295823e70e2c5c857c9
The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate.
1,500
Print a single number — the maximum number of trees that you can cut down by the given rules.
standard output
PASSED
334cccdb9918d8ef48727ca77e6a57e0
train_001.jsonl
1432053000
Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr...
256 megabytes
import java.util.ArrayList; import java.util.List; import java.util.Scanner; import java.util.Stack; /* tutorial solution much better*/ public class Main { public static int dirr[][] = {{1,0},{0,1},{0,-1},{-1,0}}; public static boolean possible; public static void main(String[] args) { // write your code...
Java
["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"]
1 second
["3", "4"]
NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ...
Java 8
standard input
[ "dp", "greedy" ]
a850dd88a67a6295823e70e2c5c857c9
The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate.
1,500
Print a single number — the maximum number of trees that you can cut down by the given rules.
standard output
PASSED
0b9cd9c64b9149fe55e57a8ad0d6d470
train_001.jsonl
1432053000
Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr...
256 megabytes
import java.util.Scanner; public class Woodcutters { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); // number of trees int num = scan.nextInt(); int [] xi = new int [num]; int [] height = new int [num]; for(int i = 0; i < num; i+...
Java
["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"]
1 second
["3", "4"]
NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ...
Java 8
standard input
[ "dp", "greedy" ]
a850dd88a67a6295823e70e2c5c857c9
The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate.
1,500
Print a single number — the maximum number of trees that you can cut down by the given rules.
standard output
PASSED
3cada42aec438ff583acd5e677035715
train_001.jsonl
1432053000
Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr...
256 megabytes
import java.io.*; import java.util.*; public class Solution { public void run() throws IOException{ Scanner s = new Scanner(System.in); int n = s.nextInt(); int [] x = new int[n]; int [] h = new int[n]; int [] rocc = new int[n]; int [][] dp = new int[n][3]; for(int i=0;i<n;i++){ x[i] = s.nextIn...
Java
["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"]
1 second
["3", "4"]
NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ...
Java 8
standard input
[ "dp", "greedy" ]
a850dd88a67a6295823e70e2c5c857c9
The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate.
1,500
Print a single number — the maximum number of trees that you can cut down by the given rules.
standard output
PASSED
7b2ac7cdc6b64ae4624fb13e9c4a8cb1
train_001.jsonl
1432053000
Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr...
256 megabytes
/* `\-. ` \ `. ` \ \ | __.._ | \. S O N - G O K U ..---~~ ~ . | Y ~-. `| | `. `~~--. \ ~. \ \__. ...
Java
["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"]
1 second
["3", "4"]
NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ...
Java 8
standard input
[ "dp", "greedy" ]
a850dd88a67a6295823e70e2c5c857c9
The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate.
1,500
Print a single number — the maximum number of trees that you can cut down by the given rules.
standard output
PASSED
f361f4220d43536418876bc756a2f911
train_001.jsonl
1432053000
Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr...
256 megabytes
/* `\-. ` \ `. ` \ \ | __.._ | \. S O N - G O K U ..---~~ ~ . | Y ~-. `| | `. `~~--. \ ~. \ \__. ...
Java
["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"]
1 second
["3", "4"]
NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ...
Java 8
standard input
[ "dp", "greedy" ]
a850dd88a67a6295823e70e2c5c857c9
The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate.
1,500
Print a single number — the maximum number of trees that you can cut down by the given rules.
standard output
PASSED
3a97625f26fb69c04dabd71e6aa59c73
train_001.jsonl
1432053000
Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr...
256 megabytes
import java.util.Scanner; public class TaskC { public static int max(int a,int b) { if(a>b) return a; else return b; } public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); int n=sc.nextInt(); if(n==1) { System.out.println(1); retur...
Java
["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"]
1 second
["3", "4"]
NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ...
Java 8
standard input
[ "dp", "greedy" ]
a850dd88a67a6295823e70e2c5c857c9
The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate.
1,500
Print a single number — the maximum number of trees that you can cut down by the given rules.
standard output
PASSED
4d9af81ae01558c076e5a78738507363
train_001.jsonl
1432053000
Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr...
256 megabytes
import java.util.Scanner; public class Program { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner (System.in); int n = Integer.parseInt(sc.nextLine()); int [] x = new int [n]; int [] h = new int [n]; for (int i = 0; i < n; i ++) { String [] temp...
Java
["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"]
1 second
["3", "4"]
NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ...
Java 8
standard input
[ "dp", "greedy" ]
a850dd88a67a6295823e70e2c5c857c9
The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate.
1,500
Print a single number — the maximum number of trees that you can cut down by the given rules.
standard output
PASSED
4020b231b628732667e5bdce6f46f74c
train_001.jsonl
1432053000
Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr...
256 megabytes
import java.util.Scanner; public class Program { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner (System.in); int n = Integer.parseInt(sc.nextLine()); int [] x = new int [n]; int [] h = new int [n]; for (int i = 0; i < n; i ++) { String [] temp...
Java
["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"]
1 second
["3", "4"]
NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ...
Java 8
standard input
[ "dp", "greedy" ]
a850dd88a67a6295823e70e2c5c857c9
The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate.
1,500
Print a single number — the maximum number of trees that you can cut down by the given rules.
standard output
PASSED
e736729aff279c4812096bbb8479fc47
train_001.jsonl
1432658100
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ...
256 megabytes
/* Harish Anumula */ import java.util.*; //import java.awt.Point; import java.io.*; //import java.math.BigInteger; public class MAXEINSTLE { public static void main (String[] args) throws java.lang.Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWrite...
Java
["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"]
2 seconds
["3\n4\n3\n3\n4"]
null
Java 8
standard input
[ "dp", "implementation", "greedy", "brute force" ]
337b6d2a11a25ef917809e6409f8edef
The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea...
1,400
After each round, print the current score of the bears.
standard output
PASSED
d1f5fe8f2cdfbb9c4ce9b4e661afb24b
train_001.jsonl
1432658100
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class B { public static void main(String[] args) throws IOException { FastScanner scan = new FastScanner(); PrintWriter out = new PrintWriter(System.ou...
Java
["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"]
2 seconds
["3\n4\n3\n3\n4"]
null
Java 8
standard input
[ "dp", "implementation", "greedy", "brute force" ]
337b6d2a11a25ef917809e6409f8edef
The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea...
1,400
After each round, print the current score of the bears.
standard output
PASSED
ee3e8bdd6b21379d141dccc78e1478c7
train_001.jsonl
1432658100
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class B548 { public static void main(String[] args) { // TODO Auto-generated method stub. Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int m = scan.nextInt(); int q ...
Java
["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"]
2 seconds
["3\n4\n3\n3\n4"]
null
Java 8
standard input
[ "dp", "implementation", "greedy", "brute force" ]
337b6d2a11a25ef917809e6409f8edef
The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea...
1,400
After each round, print the current score of the bears.
standard output
PASSED
14afe2e1b34170f25017d2eed14347f0
train_001.jsonl
1432658100
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ...
256 megabytes
import java.util.Scanner; import java.util.Arrays; import java.util.Collections; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int m=sc.nextInt(); int q=sc.nextInt(); int[][] table=new int[n+1][m+1]; i...
Java
["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"]
2 seconds
["3\n4\n3\n3\n4"]
null
Java 8
standard input
[ "dp", "implementation", "greedy", "brute force" ]
337b6d2a11a25ef917809e6409f8edef
The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea...
1,400
After each round, print the current score of the bears.
standard output
PASSED
c6114391912ca772911779aa02b0a863
train_001.jsonl
1432658100
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ...
256 megabytes
import java.util.*; public class cf_02 { static int[][] map=new int[501][501]; public static int check(int s[]){ int max=0; int cur=0; for(int a:s){ if (a==1){ cur++; } else{ max=Math.max(max,cur); cur=0;...
Java
["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"]
2 seconds
["3\n4\n3\n3\n4"]
null
Java 8
standard input
[ "dp", "implementation", "greedy", "brute force" ]
337b6d2a11a25ef917809e6409f8edef
The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea...
1,400
After each round, print the current score of the bears.
standard output
PASSED
56652198829107125f5f5843ddae5b15
train_001.jsonl
1432658100
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Q305B2 { static int n, m, q; static int[][] arr; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"]
2 seconds
["3\n4\n3\n3\n4"]
null
Java 8
standard input
[ "dp", "implementation", "greedy", "brute force" ]
337b6d2a11a25ef917809e6409f8edef
The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea...
1,400
After each round, print the current score of the bears.
standard output
PASSED
5febde78e248e3e581ae9b60fcebc981
train_001.jsonl
1432658100
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.util.*; import java.io.*; /** * * @author Alex */ public class B { public static void main(String[] args) throws IOE...
Java
["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"]
2 seconds
["3\n4\n3\n3\n4"]
null
Java 8
standard input
[ "dp", "implementation", "greedy", "brute force" ]
337b6d2a11a25ef917809e6409f8edef
The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea...
1,400
After each round, print the current score of the bears.
standard output
PASSED
e86844ff25b5b5ca9ad26eca3ed70e9e
train_001.jsonl
1432658100
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.math.BigI...
Java
["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"]
2 seconds
["3\n4\n3\n3\n4"]
null
Java 8
standard input
[ "dp", "implementation", "greedy", "brute force" ]
337b6d2a11a25ef917809e6409f8edef
The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea...
1,400
After each round, print the current score of the bears.
standard output
PASSED
f3265f4b11ec2d116195ff873e45c2ee
train_001.jsonl
1432658100
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class CP { public static void main(String[] args) { InputStreamReader ir = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(ir); String line; String[] arr; try { line = br.r...
Java
["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"]
2 seconds
["3\n4\n3\n3\n4"]
null
Java 8
standard input
[ "dp", "implementation", "greedy", "brute force" ]
337b6d2a11a25ef917809e6409f8edef
The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea...
1,400
After each round, print the current score of the bears.
standard output
PASSED
d60882b3ff4a2b60fcd22e55439f1ef4
train_001.jsonl
1432658100
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; /** * * @author Saju * */ public class Main { private static int dx[] = { 1, 0, -1, 0 }; private static int dy[] = { 0, -1, 0, 1 }; private static final long INF = Long.MAX_VALUE; private static final int INT_INF = Integer.MAX_VALUE; ...
Java
["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"]
2 seconds
["3\n4\n3\n3\n4"]
null
Java 8
standard input
[ "dp", "implementation", "greedy", "brute force" ]
337b6d2a11a25ef917809e6409f8edef
The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea...
1,400
After each round, print the current score of the bears.
standard output
PASSED
8d86c79dec12fc5fd18064a59f80da0b
train_001.jsonl
1432658100
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ...
256 megabytes
import java.util.*; public final class MikeAndFun {static int a[][], res[],n,m,b[]; public static void main(String arg[]) { Scanner br=new Scanner(System.in); n=br.nextInt(); m=br.nextInt(); int q=br.nextInt(); res=new int [q]; a=new int[n][m]; b=new int[n]; for(int i=0;i<n;i++) {int c=0; fo...
Java
["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"]
2 seconds
["3\n4\n3\n3\n4"]
null
Java 8
standard input
[ "dp", "implementation", "greedy", "brute force" ]
337b6d2a11a25ef917809e6409f8edef
The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea...
1,400
After each round, print the current score of the bears.
standard output
PASSED
57a7978bb44058e9476cd0fe508940bc
train_001.jsonl
1432658100
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ...
256 megabytes
import java.util.Scanner; import java.util.Arrays; /** * * @author win7 */ public class Lifecodechef{ /** * @param args the command line arguments */ public static void main(String[] args) throws java.lang.Exception{ // TODO code application logic here Scanner input = new Scanner(...
Java
["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"]
2 seconds
["3\n4\n3\n3\n4"]
null
Java 8
standard input
[ "dp", "implementation", "greedy", "brute force" ]
337b6d2a11a25ef917809e6409f8edef
The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea...
1,400
After each round, print the current score of the bears.
standard output
PASSED
8ad6ecd4082ba191a05cfe2fb5ecdd09
train_001.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import java.awt.Point; // SHIVAM GUPTA : //NSIT //decoder_1671 // STOP NOT TILL IT IS DONE OR U DIE . // U KNOW THAT IF THIS DAY WILL BE URS THEN NO ONE CAN DEFEAT U HERE................ // ASCII = 48 + i ;// 2^28 = 268,435,456 > 2* 10^8 // log 10 base 2 = ...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 11
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
9e0c5d8b8ab77b94bdf781b8e07e6dbc
train_001.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
//import com.sun.org.apache.xpath.internal.operations.String; import java.io.*; import java.util.*; public class scratch_25 { //static long count=0; static class Reader { static BufferedReader reader; static StringTokenizer tokenizer; /** * call this method to initialize rea...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 11
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
e51c5895bdf8c85774f8c6180ff705b4
train_001.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Test { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int a[] = new int[n+1]; for (int i = 0, j = 1; i < n - 1; i += 2, j++) { ...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 11
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
d626362e8ea556ffa21bcbf07d6e74a9
train_001.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.Scanner; public class Forces1B { public static void main(String[] args) { Scanner input = new Scanner(System.in); int numCycles = Integer.parseInt(input.nextLine()); for(int i = 0; i < numCycles; i++){ String line = input.nextLine(); if(line.charAt(1...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 11
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
234733a0ad4b612800d1e3b9a823064b
train_001.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class QuickSort { public static void main(String[] args) { Pattern pattern1 = Pattern.compile("^R(\\d+)C(\\d+)"); Pattern pattern2 = Pattern.compile("(^[A-Z]+)(\\d+)"); Scanner scanner = new ...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 11
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
ac623925cdd81a73a77347ff6b3aa8cb
train_001.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.Scanner; public class Spreadsheets { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); while (--n >= 0) { String coord = scan.next(); int cIndex = coord.indexOf('C'); if (coord.start...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 11
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
ce17bf08d7b407be5cfc603eea20fdd2
train_001.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.Scanner; public class Spreadsheet{ public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); while (--n >= 0) { String coord = scan.next(); int cIndex = coord.indexOf('C'); if (coord.startsW...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 11
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
33c0bc9a0ef55ba2cc377072445fd301
train_001.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int i=0; i<t; i++) { String s = sc.next(); int indexOfC = s.indexOf('C'); if(s.charAt(0)=='R' && s.charAt...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 11
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
552962128fd382d97c364b48d9420fdf
train_001.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Solution { public static Pattern numbersPattern = Pattern.compile("^R(\\d+)C(\\d+)$"); public static Pattern lettersPattern = Pattern.compile("^([A-Z]+)(\\d+)$"); public static int[] numbersBase = {1, 26...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 11
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
ab61961ad6989d7036c75573959d3f87
train_001.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.Scanner; public class spreadsheets { public static void main(String[] args){ Scanner scan = new Scanner(System.in); int n = scan.nextInt(); String str2 = scan.nextLine(); while(n-->0){ String str = scan.nextLine(); int i=0; int fl...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 11
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
79243f6429ab800ea52460f863b6ecc4
train_001.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.io.*; import java.util.StringTokenizer; public class B { static class Task { public void solve(int testNumber, InputReader in, PrintWriter out) { int n = in.nextInt(); while ((n--) > 0) { String str = in.next(); char[] arr = str.toCharArr...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 11
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
e3a39153dcaaca884d6660aadeb0a347
train_001.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
/*package whatever //do not write package name here */ import java.io.*; import java.util.*; public class GFG { public static void main (String[] args) { Scanner sc=new Scanner(System.in); long _a=sc.nextLong(); while(_a-->0) { String s=sc.next(); if(s.charAt(0)=='R' && Character.isDigit(s.charAt(...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 11
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
4fa988ec18477eaf25f844f97d185cdd
train_001.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Spreadsheets { public static void main(String[] args) { int n; String regex1 = "R(?<row>[0-9]+)C(?<column>[0-9]+)"; String regex2 = "(?<column>[A-Z]+)(?<row>[0-9]+)"; Pattern pattern1 = Pattern.compi...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 11
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
50d4d0dd8a018fbcf994097d9c05450b
train_001.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.Scanner; import java.util.regex.*; import java.lang.Object; public class cf_1B{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); String dummy = sc.nextLine(); while(t>0) { int i = 0, len = 0; String imu = ""; String ara[] = new...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 11
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
d3c535a1be147d09e939260446ba4a6e
train_001.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Spreadsheets { private static final int BASE = 26; private static final String PATTERN_NUMBERS = "^R(\\d+)C(\\d*)$"; private static final String PATTERN_LETTERS = "^([A-Z]*)(\\d*)$"; private static f...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 11
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
2bca180348ef3bbdd777cd71dfc5688b
train_001.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.Scanner; public class Spreadsheets { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); while (--n >= 0) { String coord = scan.next(); int cIndex = coord.indexOf('C'); if (coord.start...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 11
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
ba6f20233c1b493ba75e8a23df0bc747
train_001.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
//package code.package_import.baitap; import java.util.Scanner; import java.util.*; public class main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int soTest = sc.nextInt(); String chuoi = sc.nextLine(); while(soTest > 0) { chuoi = sc.nextLine(); int id_R = chuoi.ind...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 11
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
9ffab7eaacb7de4b762feac4d098d620
train_001.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner console = new Scanner(System.in); int t = console.nextInt(); String alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; while (t-- > 0) { String word = console.next(); if (word.substring(0, 1).equals("R") && alpha.i...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 11
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
551787afed1709c7456abb5443472533
train_001.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner console = new Scanner(System.in); int t = console.nextInt(); String alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; while (t-- > 0) { String word = console.next(); if (word.matches("^R[0-9]+C[0-9]+")) { ...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 11
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
83c0660fbe6dba0b8eca3c67f055f5f5
train_001.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.io.*; import java.util.*; public class A { public static void main (String[] args) { new A(); } public A() { FastScanner fs = new FastScanner(); PrintWriter out = new PrintWriter(System.out); System.err.println(""); String[] all = new String[1000001]; all[1] = "A"; for(int i = 2; i < all....
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 11
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
8eb8194b18b4e20bd39889a46ccb41ff
train_001.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.Scanner; public class Spreadsheets { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); while (--n >= 0) { String coord = scan.next(); int cIndex = coord.indexOf('C'); if (coord.start...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 11
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
7966a68b9778e838a70a7d9721d66d42
train_001.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.regex.Pattern; import java.util.regex.Matcher; import java.util.Scanner; public class Spreadsheets { public static void main(String[] args) { /*Splits n1 = new Splits("R32C45"); n1.printNum(); n1.printStr();*/ /*String s = "abcd0123m1".replaceAll("\\d+", ""); ...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 11
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
7e4fc97c12b3ac76d071facbe8bdea38
train_001.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
// #pragma GCC optimize("Ofast") // #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") import java.io.*; import java.util.*; import static java.lang.Math.*; public class Main { static int infi = Integer.MAX_VALUE / 2, mod = (int) (1e9 + 7), maxn = (int) 1e5; static long infl = Long...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 11
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
d28cfdb9182b6af554f70c426df81eba
train_001.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.Scanner; public class solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int i=0; i<t; i++) { String s = sc.next(); int indexOfC = s.indexOf('C'); if(s.charAt(0)=='R' && s.charAt(1)-'0'<=9 && indexOfC>0) { int row, ...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 11
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
beebf791f8d9269df1387d1540951f4d
train_001.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.*; // 1700 - implementation, math public class Problem1B_Spreadsheets { public static void main (String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); while (--n >= 0) { String str = s.next(); int cIndex = str.indexOf('C'); // if string is in RXCY format if (str....
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 11
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
460792ca95dd1305f795221547409be0
train_001.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.ArrayList; import java.util.List; import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; //R228C494 //wrong answer 56th words differ - expected: 'RZ228', found: 'S@228' public class B_Spreadsheets { public static void main(String[] args) { Scanner sc = new Sc...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 11
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
02825b7e9089438b72eeb9a0218fec85
train_001.jsonl
1365694200
Greg has a weighed directed graph, consisting of n vertices. In this graph any pair of distinct vertices has an edge between them in both directions. Greg loves playing with the graph and now he has invented a new game: The game consists of n steps. On the i-th step Greg removes vertex number xi from the graph. As Gr...
256 megabytes
import java.io.*; import java.util.*; public class Main { Scanner in; PrintWriter out; static class Scanner { StreamTokenizer in; Scanner(InputStream is) { in = new StreamTokenizer(new BufferedReader(new InputStreamReader(is))); } int nextInt() { try { in.nextToken(); return (int)in...
Java
["1\n0\n1", "2\n0 5\n4 0\n1 2", "4\n0 3 1 1\n6 0 400 1\n2 4 0 1\n1 1 1 0\n4 1 2 3"]
3 seconds
["0", "9 0", "17 23 404 0"]
null
Java 7
standard input
[ "dp", "graphs", "shortest paths" ]
46920a192a8f5fca0f2aad665ba2c22d
The first line contains integer n (1 ≤ n ≤ 500) — the number of vertices in the graph. Next n lines contain n integers each — the graph adjacency matrix: the j-th number in the i-th line aij (1 ≤ aij ≤ 105, aii = 0) represents the weight of the edge that goes from vertex i to vertex j. The next line contains n distinct...
1,700
Print n integers — the i-th number equals the required sum before the i-th step. Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams of the %I64d specifier.
standard output
PASSED
43f215250adb356a779c50bc06b310a5
train_001.jsonl
1365694200
Greg has a weighed directed graph, consisting of n vertices. In this graph any pair of distinct vertices has an edge between them in both directions. Greg loves playing with the graph and now he has invented a new game: The game consists of n steps. On the i-th step Greg removes vertex number xi from the graph. As Gr...
256 megabytes
import static java.util.Arrays.deepToString; import java.io.*; import java.math.*; import java.util.*; public class B { static void solve() { int n = nextInt(); int[][] d = new int[n][n]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { d[i][j] = nextInt(); } } int[] x = new int[n]; ...
Java
["1\n0\n1", "2\n0 5\n4 0\n1 2", "4\n0 3 1 1\n6 0 400 1\n2 4 0 1\n1 1 1 0\n4 1 2 3"]
3 seconds
["0", "9 0", "17 23 404 0"]
null
Java 7
standard input
[ "dp", "graphs", "shortest paths" ]
46920a192a8f5fca0f2aad665ba2c22d
The first line contains integer n (1 ≤ n ≤ 500) — the number of vertices in the graph. Next n lines contain n integers each — the graph adjacency matrix: the j-th number in the i-th line aij (1 ≤ aij ≤ 105, aii = 0) represents the weight of the edge that goes from vertex i to vertex j. The next line contains n distinct...
1,700
Print n integers — the i-th number equals the required sum before the i-th step. Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams of the %I64d specifier.
standard output
PASSED
4d7e7fb1825b8c1130d6a295763dd6a7
train_001.jsonl
1365694200
Greg has a weighed directed graph, consisting of n vertices. In this graph any pair of distinct vertices has an edge between them in both directions. Greg loves playing with the graph and now he has invented a new game: The game consists of n steps. On the i-th step Greg removes vertex number xi from the graph. As Gr...
256 megabytes
import static java.util.Arrays.deepToString; import java.io.*; import java.math.*; import java.util.*; public class Main { static void solve() { int n = nextInt(); int[][] a = new int[n][n]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { a[i][j] = nextInt(); } } int[] b = new int[n]...
Java
["1\n0\n1", "2\n0 5\n4 0\n1 2", "4\n0 3 1 1\n6 0 400 1\n2 4 0 1\n1 1 1 0\n4 1 2 3"]
3 seconds
["0", "9 0", "17 23 404 0"]
null
Java 7
standard input
[ "dp", "graphs", "shortest paths" ]
46920a192a8f5fca0f2aad665ba2c22d
The first line contains integer n (1 ≤ n ≤ 500) — the number of vertices in the graph. Next n lines contain n integers each — the graph adjacency matrix: the j-th number in the i-th line aij (1 ≤ aij ≤ 105, aii = 0) represents the weight of the edge that goes from vertex i to vertex j. The next line contains n distinct...
1,700
Print n integers — the i-th number equals the required sum before the i-th step. Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams of the %I64d specifier.
standard output
PASSED
db40ef6247c1e8612600a7616b04ca54
train_001.jsonl
1365694200
Greg has a weighed directed graph, consisting of n vertices. In this graph any pair of distinct vertices has an edge between them in both directions. Greg loves playing with the graph and now he has invented a new game: The game consists of n steps. On the i-th step Greg removes vertex number xi from the graph. As Gr...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap;...
Java
["1\n0\n1", "2\n0 5\n4 0\n1 2", "4\n0 3 1 1\n6 0 400 1\n2 4 0 1\n1 1 1 0\n4 1 2 3"]
3 seconds
["0", "9 0", "17 23 404 0"]
null
Java 7
standard input
[ "dp", "graphs", "shortest paths" ]
46920a192a8f5fca0f2aad665ba2c22d
The first line contains integer n (1 ≤ n ≤ 500) — the number of vertices in the graph. Next n lines contain n integers each — the graph adjacency matrix: the j-th number in the i-th line aij (1 ≤ aij ≤ 105, aii = 0) represents the weight of the edge that goes from vertex i to vertex j. The next line contains n distinct...
1,700
Print n integers — the i-th number equals the required sum before the i-th step. Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams of the %I64d specifier.
standard output
PASSED
05b284d776675428081f6813b71fa8b8
train_001.jsonl
1365694200
Greg has a weighed directed graph, consisting of n vertices. In this graph any pair of distinct vertices has an edge between them in both directions. Greg loves playing with the graph and now he has invented a new game: The game consists of n steps. On the i-th step Greg removes vertex number xi from the graph. As Gr...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap;...
Java
["1\n0\n1", "2\n0 5\n4 0\n1 2", "4\n0 3 1 1\n6 0 400 1\n2 4 0 1\n1 1 1 0\n4 1 2 3"]
3 seconds
["0", "9 0", "17 23 404 0"]
null
Java 7
standard input
[ "dp", "graphs", "shortest paths" ]
46920a192a8f5fca0f2aad665ba2c22d
The first line contains integer n (1 ≤ n ≤ 500) — the number of vertices in the graph. Next n lines contain n integers each — the graph adjacency matrix: the j-th number in the i-th line aij (1 ≤ aij ≤ 105, aii = 0) represents the weight of the edge that goes from vertex i to vertex j. The next line contains n distinct...
1,700
Print n integers — the i-th number equals the required sum before the i-th step. Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams of the %I64d specifier.
standard output
PASSED
e29e95cad7916b1ae8ec56268120bb8a
train_001.jsonl
1365694200
Greg has a weighed directed graph, consisting of n vertices. In this graph any pair of distinct vertices has an edge between them in both directions. Greg loves playing with the graph and now he has invented a new game: The game consists of n steps. On the i-th step Greg removes vertex number xi from the graph. As Gr...
256 megabytes
import static java.lang.Math.*; import static java.util.Arrays.*; import java.util.*; //@SuppressWarnings("unused") public class B { private final static boolean autoflush = false; public B () { int N = sc.nextInt(); Long [][] A = sc.nextLongs(N); Integer [] X = sc.nextInts(); int [] Y = new int [N]; f...
Java
["1\n0\n1", "2\n0 5\n4 0\n1 2", "4\n0 3 1 1\n6 0 400 1\n2 4 0 1\n1 1 1 0\n4 1 2 3"]
3 seconds
["0", "9 0", "17 23 404 0"]
null
Java 7
standard input
[ "dp", "graphs", "shortest paths" ]
46920a192a8f5fca0f2aad665ba2c22d
The first line contains integer n (1 ≤ n ≤ 500) — the number of vertices in the graph. Next n lines contain n integers each — the graph adjacency matrix: the j-th number in the i-th line aij (1 ≤ aij ≤ 105, aii = 0) represents the weight of the edge that goes from vertex i to vertex j. The next line contains n distinct...
1,700
Print n integers — the i-th number equals the required sum before the i-th step. Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams of the %I64d specifier.
standard output
PASSED
17600c15bfcb35959a79a58d6b448cd2
train_001.jsonl
1365694200
Greg has a weighed directed graph, consisting of n vertices. In this graph any pair of distinct vertices has an edge between them in both directions. Greg loves playing with the graph and now he has invented a new game: The game consists of n steps. On the i-th step Greg removes vertex number xi from the graph. As Gr...
256 megabytes
// @author Sanzhar import java.io.*; import java.util.*; import java.awt.Point; public class Template { BufferedReader in; PrintWriter out; StringTokenizer st; String next() { while (st == null || !st.hasMoreTokens()) { try { st = new StringTokenizer(in.readLine())...
Java
["1\n0\n1", "2\n0 5\n4 0\n1 2", "4\n0 3 1 1\n6 0 400 1\n2 4 0 1\n1 1 1 0\n4 1 2 3"]
3 seconds
["0", "9 0", "17 23 404 0"]
null
Java 7
standard input
[ "dp", "graphs", "shortest paths" ]
46920a192a8f5fca0f2aad665ba2c22d
The first line contains integer n (1 ≤ n ≤ 500) — the number of vertices in the graph. Next n lines contain n integers each — the graph adjacency matrix: the j-th number in the i-th line aij (1 ≤ aij ≤ 105, aii = 0) represents the weight of the edge that goes from vertex i to vertex j. The next line contains n distinct...
1,700
Print n integers — the i-th number equals the required sum before the i-th step. Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams of the %I64d specifier.
standard output