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
4837148d8c5182734f724bf3983248e0
train_003.jsonl
1556989500
You are given two $$$n \times m$$$ matrices containing integers. A sequence of integers is strictly increasing if each next number is greater than the previous one. A row is strictly increasing if all numbers from left to right are strictly increasing. A column is strictly increasing if all numbers from top to bottom a...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { static void W(Object s){ System.out.print(s.toString()); } static void println(Object s){ System.out.println(s.toString()); } static void inputArr(int[] arr, int n){ for(int i=0;i<n;i++){ arr[i] = sc.nextInt()...
Java
["2 2\n2 10\n11 5\n9 4\n3 12", "2 3\n2 4 5\n4 5 6\n3 6 7\n8 10 11", "3 2\n1 3\n2 4\n5 10\n3 1\n3 6\n4 8"]
1 second
["Possible", "Possible", "Impossible"]
NoteThe first example, we can do an operation on the top left and bottom right cells of the matrices. The resulting matrices will be $$$\begin{bmatrix} 9&amp;10\\ 11&amp;12\\ \end{bmatrix}$$$ and $$$\begin{bmatrix} 2&amp;4\\ 3&amp;5\\ \end{bmatrix}$$$.In the second example, we don't need to do any operations.In the thi...
Java 8
standard input
[ "greedy", "brute force" ]
53e061fe3fbe3695d69854c621ab6037
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n,m \leq 50$$$) — the dimensions of each matrix. Each of the next $$$n$$$ lines contains $$$m$$$ integers $$$a_{i1}, a_{i2}, \ldots, a_{im}$$$ ($$$1 \leq a_{ij} \leq 10^9$$$) — the number located in position $$$(i, j)$$$ in the first matrix. Each of th...
1,400
Print a string "Impossible" or "Possible".
standard output
PASSED
f8a909133988c4fbe8eb6f8d471c2818
train_003.jsonl
1556989500
You are given two $$$n \times m$$$ matrices containing integers. A sequence of integers is strictly increasing if each next number is greater than the previous one. A row is strictly increasing if all numbers from left to right are strictly increasing. A column is strictly increasing if all numbers from top to bottom a...
256 megabytes
import java.lang.*; import java.math.*; import java.util.*; import java.io.*; public class Main { void solve() { int n=ni(),m=ni(); int a[][]=new int[n+1][m+1]; int b[][]=new int[n+1][m+1]; for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) a[i][j]=ni(); for(int i=1;i<=n;i++) for(in...
Java
["2 2\n2 10\n11 5\n9 4\n3 12", "2 3\n2 4 5\n4 5 6\n3 6 7\n8 10 11", "3 2\n1 3\n2 4\n5 10\n3 1\n3 6\n4 8"]
1 second
["Possible", "Possible", "Impossible"]
NoteThe first example, we can do an operation on the top left and bottom right cells of the matrices. The resulting matrices will be $$$\begin{bmatrix} 9&amp;10\\ 11&amp;12\\ \end{bmatrix}$$$ and $$$\begin{bmatrix} 2&amp;4\\ 3&amp;5\\ \end{bmatrix}$$$.In the second example, we don't need to do any operations.In the thi...
Java 8
standard input
[ "greedy", "brute force" ]
53e061fe3fbe3695d69854c621ab6037
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n,m \leq 50$$$) — the dimensions of each matrix. Each of the next $$$n$$$ lines contains $$$m$$$ integers $$$a_{i1}, a_{i2}, \ldots, a_{im}$$$ ($$$1 \leq a_{ij} \leq 10^9$$$) — the number located in position $$$(i, j)$$$ in the first matrix. Each of th...
1,400
Print a string "Impossible" or "Possible".
standard output
PASSED
5cb4f632ca3a225c69c27018af287b27
train_003.jsonl
1556989500
You are given two $$$n \times m$$$ matrices containing integers. A sequence of integers is strictly increasing if each next number is greater than the previous one. A row is strictly increasing if all numbers from left to right are strictly increasing. A column is strictly increasing if all numbers from top to bottom a...
256 megabytes
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 m=sc.nextInt(); long a[][]=new long[n][m]; long b[][]=new long[n][m]; for(int i=0;i<n;i++) { ...
Java
["2 2\n2 10\n11 5\n9 4\n3 12", "2 3\n2 4 5\n4 5 6\n3 6 7\n8 10 11", "3 2\n1 3\n2 4\n5 10\n3 1\n3 6\n4 8"]
1 second
["Possible", "Possible", "Impossible"]
NoteThe first example, we can do an operation on the top left and bottom right cells of the matrices. The resulting matrices will be $$$\begin{bmatrix} 9&amp;10\\ 11&amp;12\\ \end{bmatrix}$$$ and $$$\begin{bmatrix} 2&amp;4\\ 3&amp;5\\ \end{bmatrix}$$$.In the second example, we don't need to do any operations.In the thi...
Java 8
standard input
[ "greedy", "brute force" ]
53e061fe3fbe3695d69854c621ab6037
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n,m \leq 50$$$) — the dimensions of each matrix. Each of the next $$$n$$$ lines contains $$$m$$$ integers $$$a_{i1}, a_{i2}, \ldots, a_{im}$$$ ($$$1 \leq a_{ij} \leq 10^9$$$) — the number located in position $$$(i, j)$$$ in the first matrix. Each of th...
1,400
Print a string "Impossible" or "Possible".
standard output
PASSED
db4a78c0385c34edca508c285f44dabb
train_003.jsonl
1556989500
You are given two $$$n \times m$$$ matrices containing integers. A sequence of integers is strictly increasing if each next number is greater than the previous one. A row is strictly increasing if all numbers from left to right are strictly increasing. A column is strictly increasing if all numbers from top to bottom a...
256 megabytes
import java.io.*; import java.util.NoSuchElementException; public class Main_1162B { private static Scanner sc; private static Printer pr; private static void solve() { int n = sc.nextInt(); int m = sc.nextInt(); int[][] a = new int[n][m]; int[][] b = new int[n][m]; for (int i = 0; i < n; i++) { a[...
Java
["2 2\n2 10\n11 5\n9 4\n3 12", "2 3\n2 4 5\n4 5 6\n3 6 7\n8 10 11", "3 2\n1 3\n2 4\n5 10\n3 1\n3 6\n4 8"]
1 second
["Possible", "Possible", "Impossible"]
NoteThe first example, we can do an operation on the top left and bottom right cells of the matrices. The resulting matrices will be $$$\begin{bmatrix} 9&amp;10\\ 11&amp;12\\ \end{bmatrix}$$$ and $$$\begin{bmatrix} 2&amp;4\\ 3&amp;5\\ \end{bmatrix}$$$.In the second example, we don't need to do any operations.In the thi...
Java 8
standard input
[ "greedy", "brute force" ]
53e061fe3fbe3695d69854c621ab6037
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n,m \leq 50$$$) — the dimensions of each matrix. Each of the next $$$n$$$ lines contains $$$m$$$ integers $$$a_{i1}, a_{i2}, \ldots, a_{im}$$$ ($$$1 \leq a_{ij} \leq 10^9$$$) — the number located in position $$$(i, j)$$$ in the first matrix. Each of th...
1,400
Print a string "Impossible" or "Possible".
standard output
PASSED
9a6df4807339d1f63035cd8901581978
train_003.jsonl
1592663700
Ashishgup and FastestFinger play a game. They start with a number $$$n$$$ and play in turns. In each turn, a player can make any one of the following moves: Divide $$$n$$$ by any of its odd divisors greater than $$$1$$$. Subtract $$$1$$$ from $$$n$$$ if $$$n$$$ is greater than $$$1$$$. Divisors of a number include th...
256 megabytes
import java.io.*; import java.util.*; public class C { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next(...
Java
["7\n1\n2\n3\n4\n5\n6\n12"]
2 seconds
["FastestFinger\nAshishgup\nAshishgup\nFastestFinger\nAshishgup\nFastestFinger\nAshishgup"]
NoteIn the first test case, $$$n = 1$$$, Ashishgup cannot make a move. He loses.In the second test case, $$$n = 2$$$, Ashishgup subtracts $$$1$$$ on the first move. Now $$$n = 1$$$, FastestFinger cannot make a move, so he loses.In the third test case, $$$n = 3$$$, Ashishgup divides by $$$3$$$ on the first move. Now $$$...
Java 8
standard input
[ "number theory", "games", "math" ]
b533572dd6d5fe7350589c7f4d5e1c8c
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$)  — the number of test cases. The description of the test cases follows. The only line of each test case contains a single integer  — $$$n$$$ ($$$1 \leq n \leq 10^9$$$).
1,400
For each test case, print "Ashishgup" if he wins, and "FastestFinger" otherwise (without quotes).
standard output
PASSED
c9e2ee85ae43af796cc85f9261e36406
train_003.jsonl
1592663700
Ashishgup and FastestFinger play a game. They start with a number $$$n$$$ and play in turns. In each turn, a player can make any one of the following moves: Divide $$$n$$$ by any of its odd divisors greater than $$$1$$$. Subtract $$$1$$$ from $$$n$$$ if $$$n$$$ is greater than $$$1$$$. Divisors of a number include th...
256 megabytes
import java.util.*; import java.io.*; import java.lang.Math; public class Main{ static boolean isPrime(int n) { if (n == 1) { return false; } for (int i = 2; i*i <= n; i++) { if (n % i == 0) return false; } return true; } public static void main(String[] args){ FastScanner s = new FastSc...
Java
["7\n1\n2\n3\n4\n5\n6\n12"]
2 seconds
["FastestFinger\nAshishgup\nAshishgup\nFastestFinger\nAshishgup\nFastestFinger\nAshishgup"]
NoteIn the first test case, $$$n = 1$$$, Ashishgup cannot make a move. He loses.In the second test case, $$$n = 2$$$, Ashishgup subtracts $$$1$$$ on the first move. Now $$$n = 1$$$, FastestFinger cannot make a move, so he loses.In the third test case, $$$n = 3$$$, Ashishgup divides by $$$3$$$ on the first move. Now $$$...
Java 8
standard input
[ "number theory", "games", "math" ]
b533572dd6d5fe7350589c7f4d5e1c8c
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$)  — the number of test cases. The description of the test cases follows. The only line of each test case contains a single integer  — $$$n$$$ ($$$1 \leq n \leq 10^9$$$).
1,400
For each test case, print "Ashishgup" if he wins, and "FastestFinger" otherwise (without quotes).
standard output
PASSED
ddc496f624f781d7f71282efc82d0be6
train_003.jsonl
1592663700
Ashishgup and FastestFinger play a game. They start with a number $$$n$$$ and play in turns. In each turn, a player can make any one of the following moves: Divide $$$n$$$ by any of its odd divisors greater than $$$1$$$. Subtract $$$1$$$ from $$$n$$$ if $$$n$$$ is greater than $$$1$$$. Divisors of a number include th...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; public class MyClass { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0) { long n = sc.nextLong(); if(n==2) { System.out.printl...
Java
["7\n1\n2\n3\n4\n5\n6\n12"]
2 seconds
["FastestFinger\nAshishgup\nAshishgup\nFastestFinger\nAshishgup\nFastestFinger\nAshishgup"]
NoteIn the first test case, $$$n = 1$$$, Ashishgup cannot make a move. He loses.In the second test case, $$$n = 2$$$, Ashishgup subtracts $$$1$$$ on the first move. Now $$$n = 1$$$, FastestFinger cannot make a move, so he loses.In the third test case, $$$n = 3$$$, Ashishgup divides by $$$3$$$ on the first move. Now $$$...
Java 8
standard input
[ "number theory", "games", "math" ]
b533572dd6d5fe7350589c7f4d5e1c8c
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$)  — the number of test cases. The description of the test cases follows. The only line of each test case contains a single integer  — $$$n$$$ ($$$1 \leq n \leq 10^9$$$).
1,400
For each test case, print "Ashishgup" if he wins, and "FastestFinger" otherwise (without quotes).
standard output
PASSED
7e6844da4f3100280bf2e2961b3ba643
train_003.jsonl
1592663700
Ashishgup and FastestFinger play a game. They start with a number $$$n$$$ and play in turns. In each turn, a player can make any one of the following moves: Divide $$$n$$$ by any of its odd divisors greater than $$$1$$$. Subtract $$$1$$$ from $$$n$$$ if $$$n$$$ is greater than $$$1$$$. Divisors of a number include th...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Hashtable; import java.util.Scanner; import java.util.Set; import java.util.Vector; import javax.swing.plaf.synth.SynthSeparatorUI; public class game { public static int isPrime(int num) { int num2=num; for(int i=3;i<=Math.sqrt(num2);i+=2) { ...
Java
["7\n1\n2\n3\n4\n5\n6\n12"]
2 seconds
["FastestFinger\nAshishgup\nAshishgup\nFastestFinger\nAshishgup\nFastestFinger\nAshishgup"]
NoteIn the first test case, $$$n = 1$$$, Ashishgup cannot make a move. He loses.In the second test case, $$$n = 2$$$, Ashishgup subtracts $$$1$$$ on the first move. Now $$$n = 1$$$, FastestFinger cannot make a move, so he loses.In the third test case, $$$n = 3$$$, Ashishgup divides by $$$3$$$ on the first move. Now $$$...
Java 8
standard input
[ "number theory", "games", "math" ]
b533572dd6d5fe7350589c7f4d5e1c8c
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$)  — the number of test cases. The description of the test cases follows. The only line of each test case contains a single integer  — $$$n$$$ ($$$1 \leq n \leq 10^9$$$).
1,400
For each test case, print "Ashishgup" if he wins, and "FastestFinger" otherwise (without quotes).
standard output
PASSED
4330b7346ae89dfc29af8aaf072b7ad3
train_003.jsonl
1592663700
Ashishgup and FastestFinger play a game. They start with a number $$$n$$$ and play in turns. In each turn, a player can make any one of the following moves: Divide $$$n$$$ by any of its odd divisors greater than $$$1$$$. Subtract $$$1$$$ from $$$n$$$ if $$$n$$$ is greater than $$$1$$$. Divisors of a number include th...
256 megabytes
import java.math.BigInteger; import java.util.Scanner; public class Solution { public static void main(String[] args) { /* * 1 11 2 10000001001 */ Solution sl=new Solution(); Scanner scan = new Scanner(System.in); int c =scan.nextInt(); while(c-->0) { int n = scan.nextInt(); //int k = scan...
Java
["7\n1\n2\n3\n4\n5\n6\n12"]
2 seconds
["FastestFinger\nAshishgup\nAshishgup\nFastestFinger\nAshishgup\nFastestFinger\nAshishgup"]
NoteIn the first test case, $$$n = 1$$$, Ashishgup cannot make a move. He loses.In the second test case, $$$n = 2$$$, Ashishgup subtracts $$$1$$$ on the first move. Now $$$n = 1$$$, FastestFinger cannot make a move, so he loses.In the third test case, $$$n = 3$$$, Ashishgup divides by $$$3$$$ on the first move. Now $$$...
Java 8
standard input
[ "number theory", "games", "math" ]
b533572dd6d5fe7350589c7f4d5e1c8c
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$)  — the number of test cases. The description of the test cases follows. The only line of each test case contains a single integer  — $$$n$$$ ($$$1 \leq n \leq 10^9$$$).
1,400
For each test case, print "Ashishgup" if he wins, and "FastestFinger" otherwise (without quotes).
standard output
PASSED
999a0393864a1b3944f11f1891cf88b0
train_003.jsonl
1592663700
Ashishgup and FastestFinger play a game. They start with a number $$$n$$$ and play in turns. In each turn, a player can make any one of the following moves: Divide $$$n$$$ by any of its odd divisors greater than $$$1$$$. Subtract $$$1$$$ from $$$n$$$ if $$$n$$$ is greater than $$$1$$$. Divisors of a number include th...
256 megabytes
import java.util.HashMap; import java.util.Scanner; public class Main { public static void test() { for (int i = 2; i < 100; i+=2) { System.out.println(i + " " + wins(i)); } } public static void main(String[] args) { //test(); Scanner sc = new Scanner(System.in); int n = sc.nextInt()...
Java
["7\n1\n2\n3\n4\n5\n6\n12"]
2 seconds
["FastestFinger\nAshishgup\nAshishgup\nFastestFinger\nAshishgup\nFastestFinger\nAshishgup"]
NoteIn the first test case, $$$n = 1$$$, Ashishgup cannot make a move. He loses.In the second test case, $$$n = 2$$$, Ashishgup subtracts $$$1$$$ on the first move. Now $$$n = 1$$$, FastestFinger cannot make a move, so he loses.In the third test case, $$$n = 3$$$, Ashishgup divides by $$$3$$$ on the first move. Now $$$...
Java 8
standard input
[ "number theory", "games", "math" ]
b533572dd6d5fe7350589c7f4d5e1c8c
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$)  — the number of test cases. The description of the test cases follows. The only line of each test case contains a single integer  — $$$n$$$ ($$$1 \leq n \leq 10^9$$$).
1,400
For each test case, print "Ashishgup" if he wins, and "FastestFinger" otherwise (without quotes).
standard output
PASSED
110847772a999baea9fa70360b0ebdc9
train_003.jsonl
1592663700
Ashishgup and FastestFinger play a game. They start with a number $$$n$$$ and play in turns. In each turn, a player can make any one of the following moves: Divide $$$n$$$ by any of its odd divisors greater than $$$1$$$. Subtract $$$1$$$ from $$$n$$$ if $$$n$$$ is greater than $$$1$$$. Divisors of a number include th...
256 megabytes
/****************************************************************************** Online Java Compiler. Code, Compile, Run and Debug java program online. Write your code in this editor and press "Run" button to execute it. *****************************************************...
Java
["7\n1\n2\n3\n4\n5\n6\n12"]
2 seconds
["FastestFinger\nAshishgup\nAshishgup\nFastestFinger\nAshishgup\nFastestFinger\nAshishgup"]
NoteIn the first test case, $$$n = 1$$$, Ashishgup cannot make a move. He loses.In the second test case, $$$n = 2$$$, Ashishgup subtracts $$$1$$$ on the first move. Now $$$n = 1$$$, FastestFinger cannot make a move, so he loses.In the third test case, $$$n = 3$$$, Ashishgup divides by $$$3$$$ on the first move. Now $$$...
Java 8
standard input
[ "number theory", "games", "math" ]
b533572dd6d5fe7350589c7f4d5e1c8c
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$)  — the number of test cases. The description of the test cases follows. The only line of each test case contains a single integer  — $$$n$$$ ($$$1 \leq n \leq 10^9$$$).
1,400
For each test case, print "Ashishgup" if he wins, and "FastestFinger" otherwise (without quotes).
standard output
PASSED
b578a180a5e0bc8ac8eb3afa9014673c
train_003.jsonl
1592663700
Ashishgup and FastestFinger play a game. They start with a number $$$n$$$ and play in turns. In each turn, a player can make any one of the following moves: Divide $$$n$$$ by any of its odd divisors greater than $$$1$$$. Subtract $$$1$$$ from $$$n$$$ if $$$n$$$ is greater than $$$1$$$. Divisors of a number include th...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); ...
Java
["7\n1\n2\n3\n4\n5\n6\n12"]
2 seconds
["FastestFinger\nAshishgup\nAshishgup\nFastestFinger\nAshishgup\nFastestFinger\nAshishgup"]
NoteIn the first test case, $$$n = 1$$$, Ashishgup cannot make a move. He loses.In the second test case, $$$n = 2$$$, Ashishgup subtracts $$$1$$$ on the first move. Now $$$n = 1$$$, FastestFinger cannot make a move, so he loses.In the third test case, $$$n = 3$$$, Ashishgup divides by $$$3$$$ on the first move. Now $$$...
Java 8
standard input
[ "number theory", "games", "math" ]
b533572dd6d5fe7350589c7f4d5e1c8c
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$)  — the number of test cases. The description of the test cases follows. The only line of each test case contains a single integer  — $$$n$$$ ($$$1 \leq n \leq 10^9$$$).
1,400
For each test case, print "Ashishgup" if he wins, and "FastestFinger" otherwise (without quotes).
standard output
PASSED
57588447d176745cbeb2406df0a58e25
train_003.jsonl
1592663700
Ashishgup and FastestFinger play a game. They start with a number $$$n$$$ and play in turns. In each turn, a player can make any one of the following moves: Divide $$$n$$$ by any of its odd divisors greater than $$$1$$$. Subtract $$$1$$$ from $$$n$$$ if $$$n$$$ is greater than $$$1$$$. Divisors of a number include th...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class MakingString implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; pri...
Java
["7\n1\n2\n3\n4\n5\n6\n12"]
2 seconds
["FastestFinger\nAshishgup\nAshishgup\nFastestFinger\nAshishgup\nFastestFinger\nAshishgup"]
NoteIn the first test case, $$$n = 1$$$, Ashishgup cannot make a move. He loses.In the second test case, $$$n = 2$$$, Ashishgup subtracts $$$1$$$ on the first move. Now $$$n = 1$$$, FastestFinger cannot make a move, so he loses.In the third test case, $$$n = 3$$$, Ashishgup divides by $$$3$$$ on the first move. Now $$$...
Java 8
standard input
[ "number theory", "games", "math" ]
b533572dd6d5fe7350589c7f4d5e1c8c
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$)  — the number of test cases. The description of the test cases follows. The only line of each test case contains a single integer  — $$$n$$$ ($$$1 \leq n \leq 10^9$$$).
1,400
For each test case, print "Ashishgup" if he wins, and "FastestFinger" otherwise (without quotes).
standard output
PASSED
8eca9377d87120cd7fce1cf2ea613710
train_003.jsonl
1592663700
Ashishgup and FastestFinger play a game. They start with a number $$$n$$$ and play in turns. In each turn, a player can make any one of the following moves: Divide $$$n$$$ by any of its odd divisors greater than $$$1$$$. Subtract $$$1$$$ from $$$n$$$ if $$$n$$$ is greater than $$$1$$$. Divisors of a number include th...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.awt.Point; //ArrayList<Integer> ar=new ArrayList<Integer>(); //HashSet<Integer> h=new HashSet<Integer>(); //HashMap<Integer,Integer> h=new HashMap<Integer, Integer>(); //int b[]=new int[m]; //int a[]=new int[n]; //for(i=0;i<n;i++) //a[i]=sc.ni(); //...
Java
["7\n1\n2\n3\n4\n5\n6\n12"]
2 seconds
["FastestFinger\nAshishgup\nAshishgup\nFastestFinger\nAshishgup\nFastestFinger\nAshishgup"]
NoteIn the first test case, $$$n = 1$$$, Ashishgup cannot make a move. He loses.In the second test case, $$$n = 2$$$, Ashishgup subtracts $$$1$$$ on the first move. Now $$$n = 1$$$, FastestFinger cannot make a move, so he loses.In the third test case, $$$n = 3$$$, Ashishgup divides by $$$3$$$ on the first move. Now $$$...
Java 8
standard input
[ "number theory", "games", "math" ]
b533572dd6d5fe7350589c7f4d5e1c8c
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$)  — the number of test cases. The description of the test cases follows. The only line of each test case contains a single integer  — $$$n$$$ ($$$1 \leq n \leq 10^9$$$).
1,400
For each test case, print "Ashishgup" if he wins, and "FastestFinger" otherwise (without quotes).
standard output
PASSED
8191e136bdd3912069303ad601492924
train_003.jsonl
1592663700
Ashishgup and FastestFinger play a game. They start with a number $$$n$$$ and play in turns. In each turn, a player can make any one of the following moves: Divide $$$n$$$ by any of its odd divisors greater than $$$1$$$. Subtract $$$1$$$ from $$$n$$$ if $$$n$$$ is greater than $$$1$$$. Divisors of a number include th...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class ProblemC { public static void main(String[] args) throws IOException { InputStream in = System.in; InputReader scan = new InputReader(in); int ...
Java
["7\n1\n2\n3\n4\n5\n6\n12"]
2 seconds
["FastestFinger\nAshishgup\nAshishgup\nFastestFinger\nAshishgup\nFastestFinger\nAshishgup"]
NoteIn the first test case, $$$n = 1$$$, Ashishgup cannot make a move. He loses.In the second test case, $$$n = 2$$$, Ashishgup subtracts $$$1$$$ on the first move. Now $$$n = 1$$$, FastestFinger cannot make a move, so he loses.In the third test case, $$$n = 3$$$, Ashishgup divides by $$$3$$$ on the first move. Now $$$...
Java 8
standard input
[ "number theory", "games", "math" ]
b533572dd6d5fe7350589c7f4d5e1c8c
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$)  — the number of test cases. The description of the test cases follows. The only line of each test case contains a single integer  — $$$n$$$ ($$$1 \leq n \leq 10^9$$$).
1,400
For each test case, print "Ashishgup" if he wins, and "FastestFinger" otherwise (without quotes).
standard output
PASSED
c2f268d0cb8b52dcff4302a31f9f5b1a
train_003.jsonl
1592663700
Ashishgup and FastestFinger play a game. They start with a number $$$n$$$ and play in turns. In each turn, a player can make any one of the following moves: Divide $$$n$$$ by any of its odd divisors greater than $$$1$$$. Subtract $$$1$$$ from $$$n$$$ if $$$n$$$ is greater than $$$1$$$. Divisors of a number include th...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; import java.math.*; public class A { public boolean isPrime(int a) { for (int i = 2; i<=Math.sqrt(a); i++) { if (a%i == 0) return false; } return true; } public void run() throws Exception { FastScanner sc = new FastScanner(); int test = sc....
Java
["7\n1\n2\n3\n4\n5\n6\n12"]
2 seconds
["FastestFinger\nAshishgup\nAshishgup\nFastestFinger\nAshishgup\nFastestFinger\nAshishgup"]
NoteIn the first test case, $$$n = 1$$$, Ashishgup cannot make a move. He loses.In the second test case, $$$n = 2$$$, Ashishgup subtracts $$$1$$$ on the first move. Now $$$n = 1$$$, FastestFinger cannot make a move, so he loses.In the third test case, $$$n = 3$$$, Ashishgup divides by $$$3$$$ on the first move. Now $$$...
Java 8
standard input
[ "number theory", "games", "math" ]
b533572dd6d5fe7350589c7f4d5e1c8c
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$)  — the number of test cases. The description of the test cases follows. The only line of each test case contains a single integer  — $$$n$$$ ($$$1 \leq n \leq 10^9$$$).
1,400
For each test case, print "Ashishgup" if he wins, and "FastestFinger" otherwise (without quotes).
standard output
PASSED
af9e7688e58878e35cf2b226a713421a
train_003.jsonl
1592663700
Ashishgup and FastestFinger play a game. They start with a number $$$n$$$ and play in turns. In each turn, a player can make any one of the following moves: Divide $$$n$$$ by any of its odd divisors greater than $$$1$$$. Subtract $$$1$$$ from $$$n$$$ if $$$n$$$ is greater than $$$1$$$. Divisors of a number include th...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashSet; import java.util.Set; import java.util.StringTokenizer; public class Solution { static final FS sc = new FS(); static final PrintWriter pw = new PrintWriter(System.out); private static ...
Java
["7\n1\n2\n3\n4\n5\n6\n12"]
2 seconds
["FastestFinger\nAshishgup\nAshishgup\nFastestFinger\nAshishgup\nFastestFinger\nAshishgup"]
NoteIn the first test case, $$$n = 1$$$, Ashishgup cannot make a move. He loses.In the second test case, $$$n = 2$$$, Ashishgup subtracts $$$1$$$ on the first move. Now $$$n = 1$$$, FastestFinger cannot make a move, so he loses.In the third test case, $$$n = 3$$$, Ashishgup divides by $$$3$$$ on the first move. Now $$$...
Java 8
standard input
[ "number theory", "games", "math" ]
b533572dd6d5fe7350589c7f4d5e1c8c
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$)  — the number of test cases. The description of the test cases follows. The only line of each test case contains a single integer  — $$$n$$$ ($$$1 \leq n \leq 10^9$$$).
1,400
For each test case, print "Ashishgup" if he wins, and "FastestFinger" otherwise (without quotes).
standard output
PASSED
a3dd01a2e89de6a06fbeaed5073d3015
train_003.jsonl
1592663700
Ashishgup and FastestFinger play a game. They start with a number $$$n$$$ and play in turns. In each turn, a player can make any one of the following moves: Divide $$$n$$$ by any of its odd divisors greater than $$$1$$$. Subtract $$$1$$$ from $$$n$$$ if $$$n$$$ is greater than $$$1$$$. Divisors of a number include th...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scn=new Scanner(System.in); int t =scn.nextInt(); StringBuilder sb=new StringBuilder(); while(t-->0){ int n=scn.nextInt(); int n1=n; if(n==1){ sb.append("FastestFing...
Java
["7\n1\n2\n3\n4\n5\n6\n12"]
2 seconds
["FastestFinger\nAshishgup\nAshishgup\nFastestFinger\nAshishgup\nFastestFinger\nAshishgup"]
NoteIn the first test case, $$$n = 1$$$, Ashishgup cannot make a move. He loses.In the second test case, $$$n = 2$$$, Ashishgup subtracts $$$1$$$ on the first move. Now $$$n = 1$$$, FastestFinger cannot make a move, so he loses.In the third test case, $$$n = 3$$$, Ashishgup divides by $$$3$$$ on the first move. Now $$$...
Java 8
standard input
[ "number theory", "games", "math" ]
b533572dd6d5fe7350589c7f4d5e1c8c
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$)  — the number of test cases. The description of the test cases follows. The only line of each test case contains a single integer  — $$$n$$$ ($$$1 \leq n \leq 10^9$$$).
1,400
For each test case, print "Ashishgup" if he wins, and "FastestFinger" otherwise (without quotes).
standard output
PASSED
b5d5d002a04a3cc722cf13b8720b6b90
train_003.jsonl
1592663700
Ashishgup and FastestFinger play a game. They start with a number $$$n$$$ and play in turns. In each turn, a player can make any one of the following moves: Divide $$$n$$$ by any of its odd divisors greater than $$$1$$$. Subtract $$$1$$$ from $$$n$$$ if $$$n$$$ is greater than $$$1$$$. Divisors of a number include th...
256 megabytes
//package learning; import java.util.*; import java.io.*; import java.lang.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Try { static ArrayList<String> s1; static boolean[] prime; static int n = (int)1e7; static void sieve() { Arrays.fill(prime , true); prime[0]...
Java
["7\n1\n2\n3\n4\n5\n6\n12"]
2 seconds
["FastestFinger\nAshishgup\nAshishgup\nFastestFinger\nAshishgup\nFastestFinger\nAshishgup"]
NoteIn the first test case, $$$n = 1$$$, Ashishgup cannot make a move. He loses.In the second test case, $$$n = 2$$$, Ashishgup subtracts $$$1$$$ on the first move. Now $$$n = 1$$$, FastestFinger cannot make a move, so he loses.In the third test case, $$$n = 3$$$, Ashishgup divides by $$$3$$$ on the first move. Now $$$...
Java 8
standard input
[ "number theory", "games", "math" ]
b533572dd6d5fe7350589c7f4d5e1c8c
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$)  — the number of test cases. The description of the test cases follows. The only line of each test case contains a single integer  — $$$n$$$ ($$$1 \leq n \leq 10^9$$$).
1,400
For each test case, print "Ashishgup" if he wins, and "FastestFinger" otherwise (without quotes).
standard output
PASSED
6110dffd34f7e42f103bb83586666f9b
train_003.jsonl
1360596600
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.A substring s[l...r] (1 ≤ l ≤ r ≤ |s|) of string s  =  s1s2...s|s| (where |s| is the length of string s) is string  slsl + 1...sr.The substring s[l...r] is good, if among the letters  sl, sl + 1, ..., sr the...
512 megabytes
import java.io.*; import java.util.*; public class Main { static InputReader in; static OutputWriter out; static final boolean OJ = System.getProperty("ONLINE_JUDGE") != null; public static void main(String[] args) throws IOException { in = new InputReader(OJ ? System.in : new FileInputStr...
Java
["ababab\n01000000000000000000000000\n1", "acbacbacaa\n00000000000000000000000000\n2"]
2 seconds
["5", "8"]
NoteIn the first example there are following good substrings: "a", "ab", "b", "ba", "bab".In the second example there are following good substrings: "a", "aa", "ac", "b", "ba", "c", "ca", "cb".
Java 6
standard input
[ "data structures", "strings" ]
c0998741424cd53de41d31f0bbaef9a2
The first line of the input is the non-empty string s, consisting of small English letters, the string's length is at most 1500 characters. The second line of the input is the string of characters "0" and "1", the length is exactly 26 characters. If the i-th character of this string equals "1", then the i-th English le...
1,800
Print a single integer — the number of distinct good substrings of string s.
standard output
PASSED
51b72357b722dcdbfb69e91bccc6b010
train_003.jsonl
1360596600
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.A substring s[l...r] (1 ≤ l ≤ r ≤ |s|) of string s  =  s1s2...s|s| (where |s| is the length of string s) is string  slsl + 1...sr.The substring s[l...r] is good, if among the letters  sl, sl + 1, ..., sr the...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class R166D { static String str; static char[] letters; static int k; public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReade...
Java
["ababab\n01000000000000000000000000\n1", "acbacbacaa\n00000000000000000000000000\n2"]
2 seconds
["5", "8"]
NoteIn the first example there are following good substrings: "a", "ab", "b", "ba", "bab".In the second example there are following good substrings: "a", "aa", "ac", "b", "ba", "c", "ca", "cb".
Java 6
standard input
[ "data structures", "strings" ]
c0998741424cd53de41d31f0bbaef9a2
The first line of the input is the non-empty string s, consisting of small English letters, the string's length is at most 1500 characters. The second line of the input is the string of characters "0" and "1", the length is exactly 26 characters. If the i-th character of this string equals "1", then the i-th English le...
1,800
Print a single integer — the number of distinct good substrings of string s.
standard output
PASSED
d634d53a76ebd653074868a94645637e
train_003.jsonl
1360596600
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.A substring s[l...r] (1 ≤ l ≤ r ≤ |s|) of string s  =  s1s2...s|s| (where |s| is the length of string s) is string  slsl + 1...sr.The substring s[l...r] is good, if among the letters  sl, sl + 1, ..., sr the...
512 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.util.Set; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.math.BigInteger; import java.util.HashSet; imp...
Java
["ababab\n01000000000000000000000000\n1", "acbacbacaa\n00000000000000000000000000\n2"]
2 seconds
["5", "8"]
NoteIn the first example there are following good substrings: "a", "ab", "b", "ba", "bab".In the second example there are following good substrings: "a", "aa", "ac", "b", "ba", "c", "ca", "cb".
Java 6
standard input
[ "data structures", "strings" ]
c0998741424cd53de41d31f0bbaef9a2
The first line of the input is the non-empty string s, consisting of small English letters, the string's length is at most 1500 characters. The second line of the input is the string of characters "0" and "1", the length is exactly 26 characters. If the i-th character of this string equals "1", then the i-th English le...
1,800
Print a single integer — the number of distinct good substrings of string s.
standard output
PASSED
abfeba6465e24dc8576cc013bbdf757e
train_003.jsonl
1360596600
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.A substring s[l...r] (1 ≤ l ≤ r ≤ |s|) of string s  =  s1s2...s|s| (where |s| is the length of string s) is string  slsl + 1...sr.The substring s[l...r] is good, if among the letters  sl, sl + 1, ..., sr the...
512 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.StringTokenizer; /** * 111118315581 * * -3 3 2 3 2 3 2 3 -3 3...
Java
["ababab\n01000000000000000000000000\n1", "acbacbacaa\n00000000000000000000000000\n2"]
2 seconds
["5", "8"]
NoteIn the first example there are following good substrings: "a", "ab", "b", "ba", "bab".In the second example there are following good substrings: "a", "aa", "ac", "b", "ba", "c", "ca", "cb".
Java 6
standard input
[ "data structures", "strings" ]
c0998741424cd53de41d31f0bbaef9a2
The first line of the input is the non-empty string s, consisting of small English letters, the string's length is at most 1500 characters. The second line of the input is the string of characters "0" and "1", the length is exactly 26 characters. If the i-th character of this string equals "1", then the i-th English le...
1,800
Print a single integer — the number of distinct good substrings of string s.
standard output
PASSED
eec63110859ac803cbf09034e92ef4f0
train_003.jsonl
1360596600
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.A substring s[l...r] (1 ≤ l ≤ r ≤ |s|) of string s  =  s1s2...s|s| (where |s| is the length of string s) is string  slsl + 1...sr.The substring s[l...r] is good, if among the letters  sl, sl + 1, ..., sr the...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class TC { static String s; static String isBad; static long COUNT=0; static int k; static int[] badCnt; static Trie t; static void init() { bad...
Java
["ababab\n01000000000000000000000000\n1", "acbacbacaa\n00000000000000000000000000\n2"]
2 seconds
["5", "8"]
NoteIn the first example there are following good substrings: "a", "ab", "b", "ba", "bab".In the second example there are following good substrings: "a", "aa", "ac", "b", "ba", "c", "ca", "cb".
Java 6
standard input
[ "data structures", "strings" ]
c0998741424cd53de41d31f0bbaef9a2
The first line of the input is the non-empty string s, consisting of small English letters, the string's length is at most 1500 characters. The second line of the input is the string of characters "0" and "1", the length is exactly 26 characters. If the i-th character of this string equals "1", then the i-th English le...
1,800
Print a single integer — the number of distinct good substrings of string s.
standard output
PASSED
41b45be38d3f0ac14a42c426f7f1532d
train_003.jsonl
1360596600
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.A substring s[l...r] (1 ≤ l ≤ r ≤ |s|) of string s  =  s1s2...s|s| (where |s| is the length of string s) is string  slsl + 1...sr.The substring s[l...r] is good, if among the letters  sl, sl + 1, ..., sr the...
512 megabytes
import java.util.*; import java.math.*; import java.io.*; public class Main { public static void main(String args[]) throws IOException { BufferedReader c=new BufferedReader(new InputStreamReader(System.in)); char A[]=c.readLine().toCharArray(); int N=A.length; String s=c.readLine(); boolean Bad[]=new bo...
Java
["ababab\n01000000000000000000000000\n1", "acbacbacaa\n00000000000000000000000000\n2"]
2 seconds
["5", "8"]
NoteIn the first example there are following good substrings: "a", "ab", "b", "ba", "bab".In the second example there are following good substrings: "a", "aa", "ac", "b", "ba", "c", "ca", "cb".
Java 6
standard input
[ "data structures", "strings" ]
c0998741424cd53de41d31f0bbaef9a2
The first line of the input is the non-empty string s, consisting of small English letters, the string's length is at most 1500 characters. The second line of the input is the string of characters "0" and "1", the length is exactly 26 characters. If the i-th character of this string equals "1", then the i-th English le...
1,800
Print a single integer — the number of distinct good substrings of string s.
standard output
PASSED
95aaa5292e59fe7280607b92563e6883
train_003.jsonl
1360596600
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.A substring s[l...r] (1 ≤ l ≤ r ≤ |s|) of string s  =  s1s2...s|s| (where |s| is the length of string s) is string  slsl + 1...sr.The substring s[l...r] is good, if among the letters  sl, sl + 1, ..., sr the...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; public class ProblemD { static boolean[] ptable(int max) { boolean[...
Java
["ababab\n01000000000000000000000000\n1", "acbacbacaa\n00000000000000000000000000\n2"]
2 seconds
["5", "8"]
NoteIn the first example there are following good substrings: "a", "ab", "b", "ba", "bab".In the second example there are following good substrings: "a", "aa", "ac", "b", "ba", "c", "ca", "cb".
Java 6
standard input
[ "data structures", "strings" ]
c0998741424cd53de41d31f0bbaef9a2
The first line of the input is the non-empty string s, consisting of small English letters, the string's length is at most 1500 characters. The second line of the input is the string of characters "0" and "1", the length is exactly 26 characters. If the i-th character of this string equals "1", then the i-th English le...
1,800
Print a single integer — the number of distinct good substrings of string s.
standard output
PASSED
8a7b4ee768f2ffe215e8a34060ac5408
train_003.jsonl
1360596600
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.A substring s[l...r] (1 ≤ l ≤ r ≤ |s|) of string s  =  s1s2...s|s| (where |s| is the length of string s) is string  slsl + 1...sr.The substring s[l...r] is good, if among the letters  sl, sl + 1, ..., sr the...
512 megabytes
//package round166; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class D { InputStream is; PrintWriter out; String INPUT = ""; void solve() { char[] s = ns(1501)...
Java
["ababab\n01000000000000000000000000\n1", "acbacbacaa\n00000000000000000000000000\n2"]
2 seconds
["5", "8"]
NoteIn the first example there are following good substrings: "a", "ab", "b", "ba", "bab".In the second example there are following good substrings: "a", "aa", "ac", "b", "ba", "c", "ca", "cb".
Java 6
standard input
[ "data structures", "strings" ]
c0998741424cd53de41d31f0bbaef9a2
The first line of the input is the non-empty string s, consisting of small English letters, the string's length is at most 1500 characters. The second line of the input is the string of characters "0" and "1", the length is exactly 26 characters. If the i-th character of this string equals "1", then the i-th English le...
1,800
Print a single integer — the number of distinct good substrings of string s.
standard output
PASSED
f2a3de2f5b8da4b9c6949a8590989fa0
train_003.jsonl
1360596600
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.A substring s[l...r] (1 ≤ l ≤ r ≤ |s|) of string s  =  s1s2...s|s| (where |s| is the length of string s) is string  slsl + 1...sr.The substring s[l...r] is good, if among the letters  sl, sl + 1, ..., sr the...
512 megabytes
import java.io.*; import java.util.*; public class Code implements Runnable { public static void main(String[] args) throws IOException { new Thread(new Code()).start(); } private void solve() throws IOException { String str = nextToken(); String type = nextToken(); int k ...
Java
["ababab\n01000000000000000000000000\n1", "acbacbacaa\n00000000000000000000000000\n2"]
2 seconds
["5", "8"]
NoteIn the first example there are following good substrings: "a", "ab", "b", "ba", "bab".In the second example there are following good substrings: "a", "aa", "ac", "b", "ba", "c", "ca", "cb".
Java 6
standard input
[ "data structures", "strings" ]
c0998741424cd53de41d31f0bbaef9a2
The first line of the input is the non-empty string s, consisting of small English letters, the string's length is at most 1500 characters. The second line of the input is the string of characters "0" and "1", the length is exactly 26 characters. If the i-th character of this string equals "1", then the i-th English le...
1,800
Print a single integer — the number of distinct good substrings of string s.
standard output
PASSED
0f9275a75bf420d46da6d293e8df7f51
train_003.jsonl
1360596600
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.A substring s[l...r] (1 ≤ l ≤ r ≤ |s|) of string s  =  s1s2...s|s| (where |s| is the length of string s) is string  slsl + 1...sr.The substring s[l...r] is good, if among the letters  sl, sl + 1, ..., sr the...
512 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main{ static class Trie{ Trie next[] = new Trie[26]; public void insert(char c[], int from, int to){ if(from > to) return; if(next[c[from]-'a'] == null) { count++; next...
Java
["ababab\n01000000000000000000000000\n1", "acbacbacaa\n00000000000000000000000000\n2"]
2 seconds
["5", "8"]
NoteIn the first example there are following good substrings: "a", "ab", "b", "ba", "bab".In the second example there are following good substrings: "a", "aa", "ac", "b", "ba", "c", "ca", "cb".
Java 6
standard input
[ "data structures", "strings" ]
c0998741424cd53de41d31f0bbaef9a2
The first line of the input is the non-empty string s, consisting of small English letters, the string's length is at most 1500 characters. The second line of the input is the string of characters "0" and "1", the length is exactly 26 characters. If the i-th character of this string equals "1", then the i-th English le...
1,800
Print a single integer — the number of distinct good substrings of string s.
standard output
PASSED
f2dbf27b0e9d3c32611161c5da0199ec
train_003.jsonl
1360596600
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.A substring s[l...r] (1 ≤ l ≤ r ≤ |s|) of string s  =  s1s2...s|s| (where |s| is the length of string s) is string  slsl + 1...sr.The substring s[l...r] is good, if among the letters  sl, sl + 1, ..., sr the...
512 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.Arrays; import java.util.Enumeration; import java.util.HashMap; impor...
Java
["ababab\n01000000000000000000000000\n1", "acbacbacaa\n00000000000000000000000000\n2"]
2 seconds
["5", "8"]
NoteIn the first example there are following good substrings: "a", "ab", "b", "ba", "bab".In the second example there are following good substrings: "a", "aa", "ac", "b", "ba", "c", "ca", "cb".
Java 6
standard input
[ "data structures", "strings" ]
c0998741424cd53de41d31f0bbaef9a2
The first line of the input is the non-empty string s, consisting of small English letters, the string's length is at most 1500 characters. The second line of the input is the string of characters "0" and "1", the length is exactly 26 characters. If the i-th character of this string equals "1", then the i-th English le...
1,800
Print a single integer — the number of distinct good substrings of string s.
standard output
PASSED
9174d6fa497cb4e90d551e9afa5c4019
train_003.jsonl
1360596600
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.A substring s[l...r] (1 ≤ l ≤ r ≤ |s|) of string s  =  s1s2...s|s| (where |s| is the length of string s) is string  slsl + 1...sr.The substring s[l...r] is good, if among the letters  sl, sl + 1, ..., sr the...
512 megabytes
import java.util.*; import java.io.*; public class D { public void solve() throws IOException { char[] str = nextToken().toCharArray(); String key = nextToken(); int k = nextInt(); boolean[] good = new boolean[26]; for(int i = 0; i < 26; i++){ char x = key.charAt(i); if( x == '1' ){ good[i] = true;...
Java
["ababab\n01000000000000000000000000\n1", "acbacbacaa\n00000000000000000000000000\n2"]
2 seconds
["5", "8"]
NoteIn the first example there are following good substrings: "a", "ab", "b", "ba", "bab".In the second example there are following good substrings: "a", "aa", "ac", "b", "ba", "c", "ca", "cb".
Java 6
standard input
[ "data structures", "strings" ]
c0998741424cd53de41d31f0bbaef9a2
The first line of the input is the non-empty string s, consisting of small English letters, the string's length is at most 1500 characters. The second line of the input is the string of characters "0" and "1", the length is exactly 26 characters. If the i-th character of this string equals "1", then the i-th English le...
1,800
Print a single integer — the number of distinct good substrings of string s.
standard output
PASSED
c5f7a53ac034053692fecb3b6df49bb8
train_003.jsonl
1360596600
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.A substring s[l...r] (1 ≤ l ≤ r ≤ |s|) of string s  =  s1s2...s|s| (where |s| is the length of string s) is string  slsl + 1...sr.The substring s[l...r] is good, if among the letters  sl, sl + 1, ..., sr the...
512 megabytes
import java.io.*; import java.util.*; import sun.security.provider.certpath.OCSP.RevocationStatus; public class D { String line; StringTokenizer inputParser; BufferedReader is; FileInputStream fstream; DataInputStream in; void openInput(String file) { if(file==null)is = new BufferedReader(new InputStreamR...
Java
["ababab\n01000000000000000000000000\n1", "acbacbacaa\n00000000000000000000000000\n2"]
2 seconds
["5", "8"]
NoteIn the first example there are following good substrings: "a", "ab", "b", "ba", "bab".In the second example there are following good substrings: "a", "aa", "ac", "b", "ba", "c", "ca", "cb".
Java 6
standard input
[ "data structures", "strings" ]
c0998741424cd53de41d31f0bbaef9a2
The first line of the input is the non-empty string s, consisting of small English letters, the string's length is at most 1500 characters. The second line of the input is the string of characters "0" and "1", the length is exactly 26 characters. If the i-th character of this string equals "1", then the i-th English le...
1,800
Print a single integer — the number of distinct good substrings of string s.
standard output
PASSED
3bb6f15786909932c178c586542f60ff
train_003.jsonl
1360596600
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.A substring s[l...r] (1 ≤ l ≤ r ≤ |s|) of string s  =  s1s2...s|s| (where |s| is the length of string s) is string  slsl + 1...sr.The substring s[l...r] is good, if among the letters  sl, sl + 1, ..., sr the...
512 megabytes
import java.util.HashSet; import java.util.Scanner; public class D { public static long H = 7613529876128795615L; public static long B = 1234782732774L; public static void main(String[] args){ Scanner sc = new Scanner(System.in); String input = sc.next(); char[] array = sc.next().toCharArray(); b...
Java
["ababab\n01000000000000000000000000\n1", "acbacbacaa\n00000000000000000000000000\n2"]
2 seconds
["5", "8"]
NoteIn the first example there are following good substrings: "a", "ab", "b", "ba", "bab".In the second example there are following good substrings: "a", "aa", "ac", "b", "ba", "c", "ca", "cb".
Java 6
standard input
[ "data structures", "strings" ]
c0998741424cd53de41d31f0bbaef9a2
The first line of the input is the non-empty string s, consisting of small English letters, the string's length is at most 1500 characters. The second line of the input is the string of characters "0" and "1", the length is exactly 26 characters. If the i-th character of this string equals "1", then the i-th English le...
1,800
Print a single integer — the number of distinct good substrings of string s.
standard output
PASSED
130a790e3018dcad12656f01969f7aaf
train_003.jsonl
1360596600
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.A substring s[l...r] (1 ≤ l ≤ r ≤ |s|) of string s  =  s1s2...s|s| (where |s| is the length of string s) is string  slsl + 1...sr.The substring s[l...r] is good, if among the letters  sl, sl + 1, ..., sr the...
512 megabytes
import java.io.StreamTokenizer; import java.io.InputStreamReader; import java.io.IOException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Reader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class M...
Java
["ababab\n01000000000000000000000000\n1", "acbacbacaa\n00000000000000000000000000\n2"]
2 seconds
["5", "8"]
NoteIn the first example there are following good substrings: "a", "ab", "b", "ba", "bab".In the second example there are following good substrings: "a", "aa", "ac", "b", "ba", "c", "ca", "cb".
Java 6
standard input
[ "data structures", "strings" ]
c0998741424cd53de41d31f0bbaef9a2
The first line of the input is the non-empty string s, consisting of small English letters, the string's length is at most 1500 characters. The second line of the input is the string of characters "0" and "1", the length is exactly 26 characters. If the i-th character of this string equals "1", then the i-th English le...
1,800
Print a single integer — the number of distinct good substrings of string s.
standard output
PASSED
39d33bb1d7e363a1ab8a1c7c47d4df9e
train_003.jsonl
1360596600
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.A substring s[l...r] (1 ≤ l ≤ r ≤ |s|) of string s  =  s1s2...s|s| (where |s| is the length of string s) is string  slsl + 1...sr.The substring s[l...r] is good, if among the letters  sl, sl + 1, ..., sr the...
512 megabytes
import java.io.StreamTokenizer; import java.io.InputStreamReader; import java.io.IOException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Reader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class M...
Java
["ababab\n01000000000000000000000000\n1", "acbacbacaa\n00000000000000000000000000\n2"]
2 seconds
["5", "8"]
NoteIn the first example there are following good substrings: "a", "ab", "b", "ba", "bab".In the second example there are following good substrings: "a", "aa", "ac", "b", "ba", "c", "ca", "cb".
Java 6
standard input
[ "data structures", "strings" ]
c0998741424cd53de41d31f0bbaef9a2
The first line of the input is the non-empty string s, consisting of small English letters, the string's length is at most 1500 characters. The second line of the input is the string of characters "0" and "1", the length is exactly 26 characters. If the i-th character of this string equals "1", then the i-th English le...
1,800
Print a single integer — the number of distinct good substrings of string s.
standard output
PASSED
d8df12dac1c52923f84bb05d63b697d7
train_003.jsonl
1360596600
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.A substring s[l...r] (1 ≤ l ≤ r ≤ |s|) of string s  =  s1s2...s|s| (where |s| is the length of string s) is string  slsl + 1...sr.The substring s[l...r] is good, if among the letters  sl, sl + 1, ..., sr the...
512 megabytes
import java.io.*; import java.util.*; public class D { public static void main(String[] args) throws IOException { new D().solve(); } void solve() throws IOException { // Scanner sc = new Scanner(new File("input.txt")); BufferedReader in = new BufferedReader(new InputStreamReader(S...
Java
["ababab\n01000000000000000000000000\n1", "acbacbacaa\n00000000000000000000000000\n2"]
2 seconds
["5", "8"]
NoteIn the first example there are following good substrings: "a", "ab", "b", "ba", "bab".In the second example there are following good substrings: "a", "aa", "ac", "b", "ba", "c", "ca", "cb".
Java 6
standard input
[ "data structures", "strings" ]
c0998741424cd53de41d31f0bbaef9a2
The first line of the input is the non-empty string s, consisting of small English letters, the string's length is at most 1500 characters. The second line of the input is the string of characters "0" and "1", the length is exactly 26 characters. If the i-th character of this string equals "1", then the i-th English le...
1,800
Print a single integer — the number of distinct good substrings of string s.
standard output
PASSED
18d71ab4ca4fd9319d8d2a2613160e54
train_003.jsonl
1360596600
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.A substring s[l...r] (1 ≤ l ≤ r ≤ |s|) of string s  =  s1s2...s|s| (where |s| is the length of string s) is string  slsl + 1...sr.The substring s[l...r] is good, if among the letters  sl, sl + 1, ..., sr the...
512 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; public class Solution { BufferedReader in; StringTokenizer st; PrintWriter out; char[] s; boolean[] ok = new boolean[26]; int k; static class Node { Node[] next = new Node[26]; boolean hasNext(char c...
Java
["ababab\n01000000000000000000000000\n1", "acbacbacaa\n00000000000000000000000000\n2"]
2 seconds
["5", "8"]
NoteIn the first example there are following good substrings: "a", "ab", "b", "ba", "bab".In the second example there are following good substrings: "a", "aa", "ac", "b", "ba", "c", "ca", "cb".
Java 6
standard input
[ "data structures", "strings" ]
c0998741424cd53de41d31f0bbaef9a2
The first line of the input is the non-empty string s, consisting of small English letters, the string's length is at most 1500 characters. The second line of the input is the string of characters "0" and "1", the length is exactly 26 characters. If the i-th character of this string equals "1", then the i-th English le...
1,800
Print a single integer — the number of distinct good substrings of string s.
standard output
PASSED
73238d8394b7c689163243163b3efceb
train_003.jsonl
1360596600
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.A substring s[l...r] (1 ≤ l ≤ r ≤ |s|) of string s  =  s1s2...s|s| (where |s| is the length of string s) is string  slsl + 1...sr.The substring s[l...r] is good, if among the letters  sl, sl + 1, ..., sr the...
512 megabytes
import static java.lang.Math.*; import static java.util.Arrays.*; import java.util.*; import java.io.*; public class Main { void run() { Scanner sc = new Scanner(System.in); HashSet<Long> good = new HashSet<Long>(); boolean[] alf = new boolean[26]; String str = sc.next();...
Java
["ababab\n01000000000000000000000000\n1", "acbacbacaa\n00000000000000000000000000\n2"]
2 seconds
["5", "8"]
NoteIn the first example there are following good substrings: "a", "ab", "b", "ba", "bab".In the second example there are following good substrings: "a", "aa", "ac", "b", "ba", "c", "ca", "cb".
Java 6
standard input
[ "data structures", "strings" ]
c0998741424cd53de41d31f0bbaef9a2
The first line of the input is the non-empty string s, consisting of small English letters, the string's length is at most 1500 characters. The second line of the input is the string of characters "0" and "1", the length is exactly 26 characters. If the i-th character of this string equals "1", then the i-th English le...
1,800
Print a single integer — the number of distinct good substrings of string s.
standard output
PASSED
bfcf126392b87b8f95521ad5f2d6431c
train_003.jsonl
1360596600
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.A substring s[l...r] (1 ≤ l ≤ r ≤ |s|) of string s  =  s1s2...s|s| (where |s| is the length of string s) is string  slsl + 1...sr.The substring s[l...r] is good, if among the letters  sl, sl + 1, ..., sr the...
512 megabytes
import java.io.*; import java.util.*; public class ProblemD { InputReader in; PrintWriter out; final int MAXN = 1505; long[] p29 = new long[MAXN]; class Str implements Comparable<Str> { long h; int len; int from; public int compareTo(Str s2) { if (h < s2.h) ...
Java
["ababab\n01000000000000000000000000\n1", "acbacbacaa\n00000000000000000000000000\n2"]
2 seconds
["5", "8"]
NoteIn the first example there are following good substrings: "a", "ab", "b", "ba", "bab".In the second example there are following good substrings: "a", "aa", "ac", "b", "ba", "c", "ca", "cb".
Java 6
standard input
[ "data structures", "strings" ]
c0998741424cd53de41d31f0bbaef9a2
The first line of the input is the non-empty string s, consisting of small English letters, the string's length is at most 1500 characters. The second line of the input is the string of characters "0" and "1", the length is exactly 26 characters. If the i-th character of this string equals "1", then the i-th English le...
1,800
Print a single integer — the number of distinct good substrings of string s.
standard output
PASSED
77246d80f6bf7c80e1051a122f9f668c
train_003.jsonl
1360596600
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.A substring s[l...r] (1 ≤ l ≤ r ≤ |s|) of string s  =  s1s2...s|s| (where |s| is the length of string s) is string  slsl + 1...sr.The substring s[l...r] is good, if among the letters  sl, sl + 1, ..., sr the...
512 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.StringTokenizer; import java.awt.*; @SuppressWarnings("unused") public class round166D { static BufferedReader br = new B...
Java
["ababab\n01000000000000000000000000\n1", "acbacbacaa\n00000000000000000000000000\n2"]
2 seconds
["5", "8"]
NoteIn the first example there are following good substrings: "a", "ab", "b", "ba", "bab".In the second example there are following good substrings: "a", "aa", "ac", "b", "ba", "c", "ca", "cb".
Java 6
standard input
[ "data structures", "strings" ]
c0998741424cd53de41d31f0bbaef9a2
The first line of the input is the non-empty string s, consisting of small English letters, the string's length is at most 1500 characters. The second line of the input is the string of characters "0" and "1", the length is exactly 26 characters. If the i-th character of this string equals "1", then the i-th English le...
1,800
Print a single integer — the number of distinct good substrings of string s.
standard output
PASSED
9de1e5dcfe7ae7ce32f1b877bbf73042
train_003.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.util.*; public class test { public static void main(String[] args) { Scanner in = new Scanner(System.in); int hh = in .nextInt(); int mm = in.nextInt(); int h = in.nextInt(); int d = in.nextInt(); int c = in.nextInt(); int n = in.nextInt(); double ans = 0; if(hh<20){ double ans1 = Ma...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
e167a5fd1530396565dcbb25f81ea5d3
train_003.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; import java.util.Arrays; public class Test1{ public static void main(String args[])throws IOException{ Scanner sc=new Scanner(System.in); int hh=sc.nextInt(); int mm=sc.nextInt(); int h=sc.nextInt(); int d=sc.nextInt()...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
553b0fbb688ffae19cabae8e6dcab46d
train_003.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.util.Scanner; public class main { public static void main(String[] args) { Scanner i = new Scanner(System.in); int hh = i.nextInt(); int mm = i.nextInt(); int H = i.nextInt(); int D = i.nextInt(); int C =i.nextInt(); int N = i.nextInt(); int diffMinitues = getMinDiff(hh, mm); int...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
7c84e9fcaf059120efdbb5dd21a74962
train_003.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.text.DecimalFormat; import java.util.*; public class Main { public static void main(String[] args) throws Exception { FastReader reader = new FastReader(); int hh = reader.nextInt(), mm = reader...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
d58eead4ff31b2ed3d065aec06b27638
train_003.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Question1 { public static void main (String[] args) throws java.lang.Exception { // your code goes here Scanner s = new Scanner(System.in); int h = s.nextInt(); int m =...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
54f20cedafa2a0266e739319774b3876
train_003.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.util.Scanner; public class A { public static void main(String[] args) { Scanner in = new Scanner(System.in); double hh = in.nextInt(); double mm = in.nextInt(); double h = in.nextDouble(); double d = in.nextDouble(); double c = in.nextDouble(); do...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
dda65e44c5a643477761cb716784610b
train_003.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.awt.*; import java.io.*; import java.util.*; import java.util.Objects; public class Main implements Runnable { int maxn = (int)2e3+111; int inf = (int)1e9+111; int n,k,m; int a[] = new int[maxn]; void solve() throws Exception { int hour = in.nextInt(); int minute = in....
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
d46b8a91c7c905c0c743efbe0e9d032d
train_003.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Sample { public static void main(String[] args) throws IOException{ BufferedReader read= new BufferedReader(new InputStreamReader(System.in)); StringTokenizer t...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
ee3e337e5b29bb1faef9d18559cb81e4
train_003.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.util.Scanner; public class Sheet3 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int hh; hh=in.nextInt(); int mm; mm=in.nextInt(); int h,d,c,n; h=in.nextInt(); d=in.nextInt(); c=in.nextInt(); n=in.nextInt(); double op1; double op2; if(hh<20) { op1 = h / n + ...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
6684ebcdcd96b2f6d4ce3b9980fcdf3d
train_003.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.lang.Math.*; import java.util.Scanner; import javax.swing.plaf.synth.SynthSeparatorUI; public class Class_3 { public static void main(String[] args) throws FileNotFoundException { Scanner in = new Scanner(System.in);...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
b37d4c5470f2666233f7bd4586ef233a
train_003.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
//package solve; import java.util.*; import java.math.*; /** * @author 溟檠 * 上午12:04:33 */ public class Main24 { public static void main(String[] args) { Scanner in=new Scanner (System.in); int hh=in.nextInt(),mm=in.nextInt(); int H=in.nextInt(),D=in.nextInt(),C=in.nextInt(),N=in.nextInt(); double cost1=0...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
7e2aeaabacc88dd999ba6bdfafa8266f
train_003.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
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.*; public class A { static double H; static double D; static double C; static double N; public static void main(String[] args) { FastScan...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
651bc03d04f1d7b0beb4484f74e2d009
train_003.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; public class A { static double H; static double D; static double C; static double N; public static void main(String[] args) { JS in = new JS(); int hh = in.nextInt(); int mm = in...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
155431b68d60a2551b19e55f701dd494
train_003.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.io.IOException; import java.util.*; /** * * @author SNEHITH */ public class Main { public void solve(double ...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
04f448ee15268f24d1c354570e96f976
train_003.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.util.Scanner; public class MainA { public static void main(String[] args) { Scanner in = new Scanner(System.in); int hours = in.nextInt(); int minutes = in.nextInt(); int hungerRate = in.nextInt(); int hungerSpeed = in.nextInt(); double bunCost = in.nex...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
991baaa5c98f96772b9a782bcd2d1d21
train_003.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.util.Scanner; public class CF955A { public static void main(String[] args) { Scanner input = new Scanner(System.in); int hh = input.nextInt(); int mm = input.nextInt(); int h = input.nextInt(); int d = input.nextInt(); int c = input.nextInt(); ...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
8a8d4ae1382d7fa2a3c2505be36b1eb9
train_003.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.StringTokenizer; public class C_955_A { public static void main(String[] args) throws IOException { FastSca...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
adb18ee035f5004eb113da5c6c3607c0
train_003.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.util.*; import java.io.*; public class A955 { public static void main(String[] args) throws Exception { st = new StringTokenizer(in.readLine()); double hh = d(), mm = d(); st = new StringTokenizer(in.readLine()); double H = d(), D = d(), C = d(), N = d(); if (hh >= 20) { out.println(Math....
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
9717acf092f7ee76fecb07f3b871e45c
train_003.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.util.Scanner; public class FeedACat { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int HH = sc.nextInt(); int mm = sc.nextInt(); double H = sc.nextDouble(); double D = sc.nextDouble(); double C = sc.nextDouble(); do...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
9928242cb61ee471a1ec5e556bd8b619
train_003.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { InputReader reader = new InputReader(System.in); d...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
dd5f570dc0f26c79dd3b175588cd9c1b
train_003.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; public class Main implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCharFilt...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
839e3fa7c78ef3f4119282b16e17606a
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class E { public static void main(String[] args) { // write your code here Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int i = 0; i < t; i++) { int n = sc.nextInt(); int map[]...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
3d98b6dca8338b00bed90191a1781a4a
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.util.Scanner; public class Polygon { public static void main(String[] args) { int t; int n; String[] mat2; char[][] mat; boolean ok; Scanner input = new Scanner(System.in); t = input.nextInt(); for(int i = 0; i < t; i++) { ok = ...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
662dc27bccc2ad681072b5aa4ceb34af
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.util.*; public class Chess { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); while (t-- > 0) { int k = in.nextInt(); char[][] matrix = new char[k][k]; for(int i=0;i<k;i++) { ...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
deed0f6c1952c427c599e088d2f0b1a4
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.util.*; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t=sc.nextInt(); for(int i=0;i<t;i++) { int n=sc.nextInt(); String[] s=new String[n]; int[][] arr=new int[n][n]; ...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
fbdf687c9cca188077493c5bc6ca3889
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.InputMismatchException; im...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
09d1eaf3e3033166c3bf4e16520d6c58
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class Q5 { public static void main(String[] args) throws IOException { // TODO Auto-generated method s...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
eb14b817d22de9dd6bb16487ad20eb17
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.*; public class S { static BufferedReader reader; static StringTokenizer tokenizer; /** call this method to initialize reader for InputStream */ static void init(I...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
9317d53c2050b5856014e4247b2b1a69
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.io.*; import java.util.*; public class SolutionB { public static void main(String[] args) throws Exception { int tc = scan.nextInt(); for (int i = 0; i < tc; i++) { solve(); } // out.close(); } private static void solve() { int n = scan.next...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
e1f92c531e26e9100669c932f5087cf3
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.io.*; import java.util.*; public class SolutionB { public static void main(String[] args) throws Exception { int tc = scan.nextInt(); for (int i = 0; i < tc; i++) { solve(); } // out.close(); } private static void solve() { int n = scan.next...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
328def6b0770352b0424c03e375c7c70
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class polygon { public static void main(String[] args) { FastReader ob=new FastReader(); int t=ob.nextInt(); while(t-->0) { int n=ob.nextInt(); int a[][]=new int[n+1][n+...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
6dfdb117d5667c52f1466ca10b71f1e3
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
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\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
117fbda03825e25e0759f03f2509831b
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
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\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
d63716b6eac8c41a18928fc89b04b9bd
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.util.Scanner; public class Div3644E { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); for (int i = 0; i < t; i++) { int n = scanner.nextInt(); int[][] field = new int[n][n]; for (in...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
21e6c114d6fdc16bb435a543ee4efd5e
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.util.Scanner; import java.util.*; public class Helloworld { public static void main(String[] args) { Scanner s = new Scanner(System.in); int input = s.nextInt(); for (int i1 = 0; i1 < input; i1++) { int a = s.nextInt(); char[][] array = new char[a][a];...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
b8941708b7776d1f901eb78074860e8d
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.util.*; public class cf644div3E { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int k=sc.nextInt(); for(int p=1;p<=k;p++) {int n=sc.nextInt(); int arr[][]=new int[n][n]; for(int i=0;i<n;i++) {String s=sc.next(); for(int j=0;j<n;j++) {arr[i][j]=Integer.parseInt(String.valueOf((s...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
f692d49ead6e0c1a7326c1a87205d356
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.util.*; import java.math.*; public class S{ public static void main(String[] args){ Scanner in = new Scanner(System.in); int q = in.nextInt(); for(int t = 0; t < q; t++){ int n = in.nextInt(); char arr[][] = new char[n][n]; for(int i = 0; i < n; i++){ String temp = in.next(); arr[...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
746a5cd5245c9680e11a87cce32f5c66
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.util.*; public class MyClass { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int t,i,n,j,k; boolean b; String s; t=sc.nextInt(); for(i=0;i<t;i++){ n=sc.nextInt(); int a[][]=new int[n][n]; for(j=0;j<n;j++){ ...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
6fa933a1bc0701bb6c34c71dadeadc88
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.io.*; import java.util.*; public final class Template { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- != 0) { int n = sc.nextInt(); int a[][] = new int[n][n]; for (int i = 0; i...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
72c8538737e52fab2ba2b89498a080af
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.util.*; import java.io.*; public class Solution { public static void main(String args[])throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out)); int t=Integer.parseInt(...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
a228030d0f3faea89631693e15055d45
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.util.*; import java.io.*; public class Solution { public static void main(String args[])throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out)); int t=Integer.parseInt(...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
541bbd336c3bc21591207492c6ae95b7
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner read = new Scanner(System.in); int t = Integer.parseInt(read.nextLine()); for(int tc = 0; tc < t; tc++) { int n = Integer.parseInt(read.nextLine()); String[][] mat_temp = new S...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
9da02e8a2905d3d1857f96e26d193bce
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.util.*; public class E1 { public static boolean isRight(String[] grid, int i, int j) { int a = grid.length; if (grid[i].charAt(j) == '0') { return true; } else { if (i == a - 1 && j == a- 1) { return true; } if (i == a - 1) {return true;} if (j == a - 1) {return true;} if (j ...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
b10bb745e0ef72dceacdcb0fe32f555b
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.io.*; import java.util.*; public class E { public static void main(String[] args) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); int t = sc.nextInt(); for(int i = 0; i < t; ++i) { int n = sc.nextInt(); ...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
3c07ee3edf90d0d099bfa0ce97446300
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.util.* ; import java.lang.Math ; public class Main { public static void main (String [] args){ Scanner in = new Scanner (System.in) ; int t = in.nextInt() ; while (t-- > 0){ int n = in.nextInt(); String [] a = new String[n]; in.nextLine(); for(int i = 0;i<n;i++)a[i]...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
970eda3fd234a5e97cead90fc4c00d42
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.util.*; public class Main { public static Scanner input = new Scanner(System.in); public static void main(String args[]) { int cases = input.nextInt(); int n; String[] s; while (cases-- > 0) { n = input.nextInt(); s = new String[n]; ...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
3989956e9fb459a8d3e91c8cbb1182c6
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.util.*; import java.io.*; public class MyClass { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next(...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
6381dcd9a9339989e9eed903b86a75a9
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { private static class FastScanner { private BufferedReader reader = null; private StringTokenizer tokenizer = null; public FastSca...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
b0c30da4e9dc9f845132569107376c75
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.io.*; import java.util.*; public class Main{ public static boolean check(int polygon[][],int n){ for(int i=n-1;i>=0;i--){ boolean flag=false; for(int j=n-1;j>=0;j--){ if(polygon[j][i]==0){ flag=true; }else{ ...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
f079a51375e94124ba5f890fa8d540fc
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.io.*; import java.util.*; public class Main { static class InputReader { private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, snumChars; public InputReader(InputStream st) { this.stream = st; } p...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
705f7f178581614437da383df629ea72
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.util.*; public class Solution { public static void main(String args[]) throws IOException { FastReader in = new FastReader(System.in); StringBuilder sb = new StringBuilder(); int i, j; boolean ok=true; int ...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
903952801af6df2deac17771e47f5d01
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.util.Scanner; //1360/E public class Ploygon { public static void main(String[] args) { Scanner val = new Scanner(System.in); int t = val.nextInt(); for (int i = 0; i < t; i++) { int n = val.nextInt(); int a[][] = new int[n + 1][n + 1]; for (int j = 0; j < a.length; j++) { for ...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
4904123b70c3fda9ba643897f87d80e9
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
/* package codechef; // don't place package name! */ import java.lang.*; import java.io.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.*; /* Name of the class has to be "Main" only if the class is public. */ public clas...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
8a1e8dc2d0433b9905510568d775b8f8
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
//package Code; import java.util.*; import java.math.*; import java.lang.System; import java.nio.CharBuffer; import static java.lang.System.*; import java.io.InputStream; import java.sql.Time; public class Main { public static void main(String[] args) { Integer b, j, k, t; Integer l, r, m, i,...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
e3ccf39b049e13443e78e509dd44bb66
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.util.Scanner; public class polygon { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (--t >= 0) { int n = sc.nextInt(), matrix[][] = new int[n][n]; for (int i = 0; i < n; i++) { String s = sc.next(); for (int j = 0; j < n; j++) ...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
1065cc7a0aaaad9598b41f153d8fa630
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.util.*; public class canons{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ int n = sc.nextInt(); int[][] arr = new int[n][n]; for(int i=0;i<n;i++){ String s = sc.next(); char[] c = s.toCharArray(); for(int j=0;j<...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
3b28d44e25c87c2bda7ee89f232a3100
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.util.HashMap; import java.util.Scanner; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int zzz = sc.nextInt(); for (int zz = 0; zz < zzz; zz++) { int n = sc.nextInt(); char[][]m = new char[n][n]; ...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
c0c1315e673143437a22fda4fd390c3b
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.util.*; import java.io.*; public class polygon { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t != 0) { t--; int n = sc.nextInt(); sc.nextLine(); String[] arr = new ...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
38e7580734ee328c906eff30b8fdb3fe
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
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.IOException; import java.io.Reader; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.io.Writer; impor...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output
PASSED
2c173147e85b3c8be584c4e224b970f4
train_003.jsonl
1590327300
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0.On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exact...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int polCount = s.nextInt(); ArrayList<String> answers = new ArrayList(); for (int i = 0; i < polCount; i++) { // ...
Java
["5\n4\n0010\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1110\n0101\n0111"]
2 seconds
["YES\nNO\nYES\nYES\nNO"]
NoteThe first test case was explained in the statement.The answer to the second test case is NO, since a 1 in a cell ($$$1, 1$$$) flying out of any cannon would continue its flight further.
Java 11
standard input
[ "dp", "implementation", "graphs", "shortest paths" ]
eea15ff7e939bfcc7002cacbc8a1a3a5
The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case starts with a line containing an integer $$$n$$$ ($$$1 \le n \le 50$$$) — the size of the polygon. This is followed by $$$n$$$ lines of length $$$n$$$, consisting of 0 and 1 — t...
1,300
For each test case print: YES if there is a sequence of shots leading to a given matrix; NO if such a sequence does not exist. The letters in the words YES and NO can be printed in any case.
standard output