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
bc9ad4c22c3ca47d644e52de7fce8f10
train_003.jsonl
1575038100
One unknown hacker wants to get the admin's password of AtForces testing system, to get problems from the next contest. To achieve that, he sneaked into the administrator's office and stole a piece of paper with a list of $$$n$$$ passwords — strings, consists of small Latin letters.Hacker went home and started preparin...
256 megabytes
import java.util.*; import java.io.*; public class File { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); DSU dsu = new DSU(); // True is character among the passwords. // We treat characters as numbers 0-25 instead. boolean[] charExis...
Java
["4\na\nb\nab\nd", "3\nab\nbc\nabc", "1\ncodeforces"]
1 second
["2", "1", "1"]
NoteIn the second example hacker need to use any of the passwords to access the system.
Java 11
standard input
[ "dsu", "dfs and similar", "graphs" ]
00db0111fd80ce1820da2af07a6cb8f1
The first line contain integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — number of passwords in the list. Next $$$n$$$ lines contains passwords from the list – non-empty strings $$$s_i$$$, with length at most $$$50$$$ letters. Some of the passwords may be equal. It is guaranteed that the total length of all passwords ...
1,500
In a single line print the minimal number of passwords, the use of which will allow guaranteed to access the system.
standard output
PASSED
07d0f76b64e611cb3cedae46cb7d47c7
train_003.jsonl
1575038100
One unknown hacker wants to get the admin's password of AtForces testing system, to get problems from the next contest. To achieve that, he sneaked into the administrator's office and stole a piece of paper with a list of $$$n$$$ passwords — strings, consists of small Latin letters.Hacker went home and started preparin...
256 megabytes
import java.io.*; import java.util.*; public class Graph { private int V; private LinkedList<Integer> adj[]; Graph(int v) { V = v; adj = new LinkedList[v]; for (int i=0; i<v; ++i) adj[i] = new LinkedList(); } void addEdge(int v, int w) { ...
Java
["4\na\nb\nab\nd", "3\nab\nbc\nabc", "1\ncodeforces"]
1 second
["2", "1", "1"]
NoteIn the second example hacker need to use any of the passwords to access the system.
Java 11
standard input
[ "dsu", "dfs and similar", "graphs" ]
00db0111fd80ce1820da2af07a6cb8f1
The first line contain integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — number of passwords in the list. Next $$$n$$$ lines contains passwords from the list – non-empty strings $$$s_i$$$, with length at most $$$50$$$ letters. Some of the passwords may be equal. It is guaranteed that the total length of all passwords ...
1,500
In a single line print the minimal number of passwords, the use of which will allow guaranteed to access the system.
standard output
PASSED
0ceef08b2005a5720a12550ad5c81e6b
train_003.jsonl
1575038100
One unknown hacker wants to get the admin's password of AtForces testing system, to get problems from the next contest. To achieve that, he sneaked into the administrator's office and stole a piece of paper with a list of $$$n$$$ passwords — strings, consists of small Latin letters.Hacker went home and started preparin...
256 megabytes
import java.io.*; import java.util.*; public class Main { private static FastReader f = new FastReader(); public static void main(String[] args) { int n = f.nextInt(); Dsu dsu = new Dsu(26); boolean[] vis = new boolean[26]; while (n-- > 0) { String s = f.next(); ...
Java
["4\na\nb\nab\nd", "3\nab\nbc\nabc", "1\ncodeforces"]
1 second
["2", "1", "1"]
NoteIn the second example hacker need to use any of the passwords to access the system.
Java 11
standard input
[ "dsu", "dfs and similar", "graphs" ]
00db0111fd80ce1820da2af07a6cb8f1
The first line contain integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — number of passwords in the list. Next $$$n$$$ lines contains passwords from the list – non-empty strings $$$s_i$$$, with length at most $$$50$$$ letters. Some of the passwords may be equal. It is guaranteed that the total length of all passwords ...
1,500
In a single line print the minimal number of passwords, the use of which will allow guaranteed to access the system.
standard output
PASSED
75e93f6482922713f862ed2cca276260
train_003.jsonl
1575038100
One unknown hacker wants to get the admin's password of AtForces testing system, to get problems from the next contest. To achieve that, he sneaked into the administrator's office and stole a piece of paper with a list of $$$n$$$ passwords — strings, consists of small Latin letters.Hacker went home and started preparin...
256 megabytes
//package com.example.myPackage; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class SecretPasswords { private static Scanner fs = new Scanner(System.in); private static List<Integer> graph[]; private static boolean isUsed[]; static void addEdge(int a,int b) {...
Java
["4\na\nb\nab\nd", "3\nab\nbc\nabc", "1\ncodeforces"]
1 second
["2", "1", "1"]
NoteIn the second example hacker need to use any of the passwords to access the system.
Java 11
standard input
[ "dsu", "dfs and similar", "graphs" ]
00db0111fd80ce1820da2af07a6cb8f1
The first line contain integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — number of passwords in the list. Next $$$n$$$ lines contains passwords from the list – non-empty strings $$$s_i$$$, with length at most $$$50$$$ letters. Some of the passwords may be equal. It is guaranteed that the total length of all passwords ...
1,500
In a single line print the minimal number of passwords, the use of which will allow guaranteed to access the system.
standard output
PASSED
900f728b53b17bf39ac94e68943808ac
train_003.jsonl
1575038100
One unknown hacker wants to get the admin's password of AtForces testing system, to get problems from the next contest. To achieve that, he sneaked into the administrator's office and stole a piece of paper with a list of $$$n$$$ passwords — strings, consists of small Latin letters.Hacker went home and started preparin...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; /************** * AUTHOR: AMAN KUMAR SINGH * * INSTITUITION: KALYANI GOVERNMENT ENGINEERING COLLEGE * **************/ public class lets_do { InputReader in; PrintWriter out; final long mod=1000000007; final int N=200005; ...
Java
["4\na\nb\nab\nd", "3\nab\nbc\nabc", "1\ncodeforces"]
1 second
["2", "1", "1"]
NoteIn the second example hacker need to use any of the passwords to access the system.
Java 11
standard input
[ "dsu", "dfs and similar", "graphs" ]
00db0111fd80ce1820da2af07a6cb8f1
The first line contain integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — number of passwords in the list. Next $$$n$$$ lines contains passwords from the list – non-empty strings $$$s_i$$$, with length at most $$$50$$$ letters. Some of the passwords may be equal. It is guaranteed that the total length of all passwords ...
1,500
In a single line print the minimal number of passwords, the use of which will allow guaranteed to access the system.
standard output
PASSED
23683f1f1d9ec996471759d0f8231dfe
train_003.jsonl
1575038100
One unknown hacker wants to get the admin's password of AtForces testing system, to get problems from the next contest. To achieve that, he sneaked into the administrator's office and stole a piece of paper with a list of $$$n$$$ passwords — strings, consists of small Latin letters.Hacker went home and started preparin...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; @SuppressWarnings("Duplicates") // author @mdazmat9 public class Main{ static Scanner sc = new Scanner(System.in); static PrintWriter out = new PrintWriter(System.out); public static void main(String[] args) throws IOException { int test = ...
Java
["4\na\nb\nab\nd", "3\nab\nbc\nabc", "1\ncodeforces"]
1 second
["2", "1", "1"]
NoteIn the second example hacker need to use any of the passwords to access the system.
Java 11
standard input
[ "dsu", "dfs and similar", "graphs" ]
00db0111fd80ce1820da2af07a6cb8f1
The first line contain integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — number of passwords in the list. Next $$$n$$$ lines contains passwords from the list – non-empty strings $$$s_i$$$, with length at most $$$50$$$ letters. Some of the passwords may be equal. It is guaranteed that the total length of all passwords ...
1,500
In a single line print the minimal number of passwords, the use of which will allow guaranteed to access the system.
standard output
PASSED
fc85808ad9fc7f708edac0008fe30c7a
train_003.jsonl
1575038100
One unknown hacker wants to get the admin's password of AtForces testing system, to get problems from the next contest. To achieve that, he sneaked into the administrator's office and stole a piece of paper with a list of $$$n$$$ passwords — strings, consists of small Latin letters.Hacker went home and started preparin...
256 megabytes
import java.io.*; import java.util.*; /* */ public class A { static FastReader sc=null; static boolean leaf[]; public static void main(String[] args) { sc=new FastReader(); int n=sc.nextInt(); Set<Integer> set=new HashSet<>(); DU du=new DU(26); for(int i=0;i<n;i++) { char line[]=sc.nextLine().to...
Java
["4\na\nb\nab\nd", "3\nab\nbc\nabc", "1\ncodeforces"]
1 second
["2", "1", "1"]
NoteIn the second example hacker need to use any of the passwords to access the system.
Java 11
standard input
[ "dsu", "dfs and similar", "graphs" ]
00db0111fd80ce1820da2af07a6cb8f1
The first line contain integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — number of passwords in the list. Next $$$n$$$ lines contains passwords from the list – non-empty strings $$$s_i$$$, with length at most $$$50$$$ letters. Some of the passwords may be equal. It is guaranteed that the total length of all passwords ...
1,500
In a single line print the minimal number of passwords, the use of which will allow guaranteed to access the system.
standard output
PASSED
1b5011f28f624f6aa0d95dd70567d3f2
train_003.jsonl
1575038100
One unknown hacker wants to get the admin's password of AtForces testing system, to get problems from the next contest. To achieve that, he sneaked into the administrator's office and stole a piece of paper with a list of $$$n$$$ passwords — strings, consists of small Latin letters.Hacker went home and started preparin...
256 megabytes
import java.util.*; public class SecretPasswords2 { int n; String[] strs; int[] fa; boolean[][] contains; Map<Character, Set<Character>> map = new HashMap<Character, Set<Character>>(); public SecretPasswords2(int n, String[] strs) { this.n = n; this.strs = strs; this.fa...
Java
["4\na\nb\nab\nd", "3\nab\nbc\nabc", "1\ncodeforces"]
1 second
["2", "1", "1"]
NoteIn the second example hacker need to use any of the passwords to access the system.
Java 11
standard input
[ "dsu", "dfs and similar", "graphs" ]
00db0111fd80ce1820da2af07a6cb8f1
The first line contain integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — number of passwords in the list. Next $$$n$$$ lines contains passwords from the list – non-empty strings $$$s_i$$$, with length at most $$$50$$$ letters. Some of the passwords may be equal. It is guaranteed that the total length of all passwords ...
1,500
In a single line print the minimal number of passwords, the use of which will allow guaranteed to access the system.
standard output
PASSED
db8a1fee65e753bbcfe315bb14fbb109
train_003.jsonl
1575038100
One unknown hacker wants to get the admin's password of AtForces testing system, to get problems from the next contest. To achieve that, he sneaked into the administrator's office and stole a piece of paper with a list of $$$n$$$ passwords — strings, consists of small Latin letters.Hacker went home and started preparin...
256 megabytes
import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.Scanner; import java.util.TreeSet; import com.sun.source.tree.Tree; import java.io.*; public class Main { static int fa[]; public static void main(String args[]) { Scanner sc= new S...
Java
["4\na\nb\nab\nd", "3\nab\nbc\nabc", "1\ncodeforces"]
1 second
["2", "1", "1"]
NoteIn the second example hacker need to use any of the passwords to access the system.
Java 11
standard input
[ "dsu", "dfs and similar", "graphs" ]
00db0111fd80ce1820da2af07a6cb8f1
The first line contain integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — number of passwords in the list. Next $$$n$$$ lines contains passwords from the list – non-empty strings $$$s_i$$$, with length at most $$$50$$$ letters. Some of the passwords may be equal. It is guaranteed that the total length of all passwords ...
1,500
In a single line print the minimal number of passwords, the use of which will allow guaranteed to access the system.
standard output
PASSED
8b495099b5aef88e51db066e2e540e2b
train_003.jsonl
1575038100
One unknown hacker wants to get the admin's password of AtForces testing system, to get problems from the next contest. To achieve that, he sneaked into the administrator's office and stole a piece of paper with a list of $$$n$$$ passwords — strings, consists of small Latin letters.Hacker went home and started preparin...
256 megabytes
import java.util.Scanner; //import java.util.Arrays; public class D { public static int[] l = new int[] {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; public static boolean[] unique = new boolean[] {false, false, false, false, false, false, false, fals...
Java
["4\na\nb\nab\nd", "3\nab\nbc\nabc", "1\ncodeforces"]
1 second
["2", "1", "1"]
NoteIn the second example hacker need to use any of the passwords to access the system.
Java 11
standard input
[ "dsu", "dfs and similar", "graphs" ]
00db0111fd80ce1820da2af07a6cb8f1
The first line contain integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — number of passwords in the list. Next $$$n$$$ lines contains passwords from the list – non-empty strings $$$s_i$$$, with length at most $$$50$$$ letters. Some of the passwords may be equal. It is guaranteed that the total length of all passwords ...
1,500
In a single line print the minimal number of passwords, the use of which will allow guaranteed to access the system.
standard output
PASSED
195db00575f9836c5ae0f8adfb94fb01
train_003.jsonl
1575038100
One unknown hacker wants to get the admin's password of AtForces testing system, to get problems from the next contest. To achieve that, he sneaked into the administrator's office and stole a piece of paper with a list of $$$n$$$ passwords — strings, consists of small Latin letters.Hacker went home and started preparin...
256 megabytes
import java.util.Scanner; import java.util.ArrayList; import java.util.Vector; public class Prog1263D { static Scanner sc = new Scanner(System.in); private static void solve(){ int n = sc.nextInt(); ArrayList<Integer> graphs = new ArrayList<Integer>(); graphs.ensureCapacity(n); f...
Java
["4\na\nb\nab\nd", "3\nab\nbc\nabc", "1\ncodeforces"]
1 second
["2", "1", "1"]
NoteIn the second example hacker need to use any of the passwords to access the system.
Java 11
standard input
[ "dsu", "dfs and similar", "graphs" ]
00db0111fd80ce1820da2af07a6cb8f1
The first line contain integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — number of passwords in the list. Next $$$n$$$ lines contains passwords from the list – non-empty strings $$$s_i$$$, with length at most $$$50$$$ letters. Some of the passwords may be equal. It is guaranteed that the total length of all passwords ...
1,500
In a single line print the minimal number of passwords, the use of which will allow guaranteed to access the system.
standard output
PASSED
3cade5d9faacc3e92d1af985bbcd9a7e
train_003.jsonl
1575038100
One unknown hacker wants to get the admin's password of AtForces testing system, to get problems from the next contest. To achieve that, he sneaked into the administrator's office and stole a piece of paper with a list of $$$n$$$ passwords — strings, consists of small Latin letters.Hacker went home and started preparin...
256 megabytes
import java.util.*;import java.io.*; public class Main { public static void process()throws IOException { int n=ni(); Graph g=new Graph(26); while(n-- > 0){ String s=nln(); char u=s.charAt(0); g.flag[u-'a']=true; for(int i=1;i<s.length();i++){ char c=s.charAt(i); ...
Java
["4\na\nb\nab\nd", "3\nab\nbc\nabc", "1\ncodeforces"]
1 second
["2", "1", "1"]
NoteIn the second example hacker need to use any of the passwords to access the system.
Java 11
standard input
[ "dsu", "dfs and similar", "graphs" ]
00db0111fd80ce1820da2af07a6cb8f1
The first line contain integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — number of passwords in the list. Next $$$n$$$ lines contains passwords from the list – non-empty strings $$$s_i$$$, with length at most $$$50$$$ letters. Some of the passwords may be equal. It is guaranteed that the total length of all passwords ...
1,500
In a single line print the minimal number of passwords, the use of which will allow guaranteed to access the system.
standard output
PASSED
4c9ff69cd73c2126623ff85781860d09
train_003.jsonl
1575038100
One unknown hacker wants to get the admin's password of AtForces testing system, to get problems from the next contest. To achieve that, he sneaked into the administrator's office and stole a piece of paper with a list of $$$n$$$ passwords — strings, consists of small Latin letters.Hacker went home and started preparin...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Indrajit Sinha */ public class Main { pub...
Java
["4\na\nb\nab\nd", "3\nab\nbc\nabc", "1\ncodeforces"]
1 second
["2", "1", "1"]
NoteIn the second example hacker need to use any of the passwords to access the system.
Java 11
standard input
[ "dsu", "dfs and similar", "graphs" ]
00db0111fd80ce1820da2af07a6cb8f1
The first line contain integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — number of passwords in the list. Next $$$n$$$ lines contains passwords from the list – non-empty strings $$$s_i$$$, with length at most $$$50$$$ letters. Some of the passwords may be equal. It is guaranteed that the total length of all passwords ...
1,500
In a single line print the minimal number of passwords, the use of which will allow guaranteed to access the system.
standard output
PASSED
63fa786f9cfa54a6cd9342a0681e70c1
train_003.jsonl
1575038100
One unknown hacker wants to get the admin's password of AtForces testing system, to get problems from the next contest. To achieve that, he sneaked into the administrator's office and stole a piece of paper with a list of $$$n$$$ passwords — strings, consists of small Latin letters.Hacker went home and started preparin...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; import static java.lang.Math.*; public class Main { int[] parent; int[] size; int ans; int get(int a) { if (a == parent[a]) return a; return parent[a] = get(parent[a]); } void unite(int a, int b) { ...
Java
["4\na\nb\nab\nd", "3\nab\nbc\nabc", "1\ncodeforces"]
1 second
["2", "1", "1"]
NoteIn the second example hacker need to use any of the passwords to access the system.
Java 11
standard input
[ "dsu", "dfs and similar", "graphs" ]
00db0111fd80ce1820da2af07a6cb8f1
The first line contain integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — number of passwords in the list. Next $$$n$$$ lines contains passwords from the list – non-empty strings $$$s_i$$$, with length at most $$$50$$$ letters. Some of the passwords may be equal. It is guaranteed that the total length of all passwords ...
1,500
In a single line print the minimal number of passwords, the use of which will allow guaranteed to access the system.
standard output
PASSED
f387e1003421abf0520c5cc6d7ea8ca7
train_003.jsonl
1575038100
One unknown hacker wants to get the admin's password of AtForces testing system, to get problems from the next contest. To achieve that, he sneaked into the administrator's office and stole a piece of paper with a list of $$$n$$$ passwords — strings, consists of small Latin letters.Hacker went home and started preparin...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; public class GFG { static class edge{ int s,d,w; public edge(int s,int d,int w) { this.s=s; this.d=d; this.w=w; } } static class graph{ int v; LinkedLis...
Java
["4\na\nb\nab\nd", "3\nab\nbc\nabc", "1\ncodeforces"]
1 second
["2", "1", "1"]
NoteIn the second example hacker need to use any of the passwords to access the system.
Java 11
standard input
[ "dsu", "dfs and similar", "graphs" ]
00db0111fd80ce1820da2af07a6cb8f1
The first line contain integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — number of passwords in the list. Next $$$n$$$ lines contains passwords from the list – non-empty strings $$$s_i$$$, with length at most $$$50$$$ letters. Some of the passwords may be equal. It is guaranteed that the total length of all passwords ...
1,500
In a single line print the minimal number of passwords, the use of which will allow guaranteed to access the system.
standard output
PASSED
c19c7bf39fdfeabab12462941b3c09d0
train_003.jsonl
1575038100
One unknown hacker wants to get the admin's password of AtForces testing system, to get problems from the next contest. To achieve that, he sneaked into the administrator's office and stole a piece of paper with a list of $$$n$$$ passwords — strings, consists of small Latin letters.Hacker went home and started preparin...
256 megabytes
import java.io.*; import java.util.ArrayList; public class competetive { static ArrayList<ArrayList<Integer>>l=new ArrayList<>(); static boolean[]vis=new boolean[100001]; static int[]dis=new int[100001]; static int[]fdis=new int[100001]; static int ans=0; static void dfs(int node){ ...
Java
["4\na\nb\nab\nd", "3\nab\nbc\nabc", "1\ncodeforces"]
1 second
["2", "1", "1"]
NoteIn the second example hacker need to use any of the passwords to access the system.
Java 11
standard input
[ "dsu", "dfs and similar", "graphs" ]
00db0111fd80ce1820da2af07a6cb8f1
The first line contain integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — number of passwords in the list. Next $$$n$$$ lines contains passwords from the list – non-empty strings $$$s_i$$$, with length at most $$$50$$$ letters. Some of the passwords may be equal. It is guaranteed that the total length of all passwords ...
1,500
In a single line print the minimal number of passwords, the use of which will allow guaranteed to access the system.
standard output
PASSED
e0046be00cada91d8cf6bfeac683ce7b
train_003.jsonl
1575038100
One unknown hacker wants to get the admin's password of AtForces testing system, to get problems from the next contest. To achieve that, he sneaked into the administrator's office and stole a piece of paper with a list of $$$n$$$ passwords — strings, consists of small Latin letters.Hacker went home and started preparin...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.HashSet; import java.util.Iterator; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is...
Java
["4\na\nb\nab\nd", "3\nab\nbc\nabc", "1\ncodeforces"]
1 second
["2", "1", "1"]
NoteIn the second example hacker need to use any of the passwords to access the system.
Java 11
standard input
[ "dsu", "dfs and similar", "graphs" ]
00db0111fd80ce1820da2af07a6cb8f1
The first line contain integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — number of passwords in the list. Next $$$n$$$ lines contains passwords from the list – non-empty strings $$$s_i$$$, with length at most $$$50$$$ letters. Some of the passwords may be equal. It is guaranteed that the total length of all passwords ...
1,500
In a single line print the minimal number of passwords, the use of which will allow guaranteed to access the system.
standard output
PASSED
7246fd5f3cc7ee74b1164a16ba2671eb
train_003.jsonl
1349105400
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.
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 code{ public static void main (String[] args) throws java.lang.Exception { int[] arr = new int[1000100]; int[] fail = new int[1000100]; // System.out.println(fail[...
Java
["3\n4 5 6"]
2 seconds
["YES\nNO\nNO"]
NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".
Java 11
standard input
[ "binary search", "number theory", "implementation", "math" ]
6cebf9af5cfbb949f22e8b336bf07044
The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec...
1,300
Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.
standard output
PASSED
ac0a6b1eef997bb68131dc4e5fa98590
train_003.jsonl
1349105400
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.
256 megabytes
//package codes; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Tprimes { public static void main(String[] args) { // TODO Auto-generated method stub long t; BufferedReader b = new BufferedReader(new InputStreamReader(System...
Java
["3\n4 5 6"]
2 seconds
["YES\nNO\nNO"]
NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".
Java 11
standard input
[ "binary search", "number theory", "implementation", "math" ]
6cebf9af5cfbb949f22e8b336bf07044
The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec...
1,300
Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.
standard output
PASSED
0cd47f95497147f5ee14b31e5ee971fb
train_003.jsonl
1349105400
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.
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
["3\n4 5 6"]
2 seconds
["YES\nNO\nNO"]
NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".
Java 11
standard input
[ "binary search", "number theory", "implementation", "math" ]
6cebf9af5cfbb949f22e8b336bf07044
The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec...
1,300
Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.
standard output
PASSED
b99e5783ecba0fd3ddaf7bdd47551f0c
train_003.jsonl
1349105400
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.
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
["3\n4 5 6"]
2 seconds
["YES\nNO\nNO"]
NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".
Java 11
standard input
[ "binary search", "number theory", "implementation", "math" ]
6cebf9af5cfbb949f22e8b336bf07044
The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec...
1,300
Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.
standard output
PASSED
ee4072beddcc9b07435b94b289850a75
train_003.jsonl
1349105400
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.
256 megabytes
//Written by Shagoto import java.util.*; public class Main { static boolean [] sieve() { boolean [] prime = new boolean[1000000+1]; for(int i=0; i<1000000; i++) { prime[i] = true; } for(int p = 2; p*p<=1000000; p++) { if(prime[p] == true) { for(int i = p*p; i<=...
Java
["3\n4 5 6"]
2 seconds
["YES\nNO\nNO"]
NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".
Java 11
standard input
[ "binary search", "number theory", "implementation", "math" ]
6cebf9af5cfbb949f22e8b336bf07044
The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec...
1,300
Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.
standard output
PASSED
342342e81b3909bdfe06f64696233a1a
train_003.jsonl
1349105400
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.
256 megabytes
import java.io.*; import java.util.*; public class Main{ static int mod=(int)1e9+7; public static void main(String[] args) throws IOException { Writer out=new Writer(System.out); Reader in=new Reader(System.in); int ts=1; outer: while(ts-->0) { int n=in.nextInt(); long a[]=in.readLongArray(n);...
Java
["3\n4 5 6"]
2 seconds
["YES\nNO\nNO"]
NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".
Java 11
standard input
[ "binary search", "number theory", "implementation", "math" ]
6cebf9af5cfbb949f22e8b336bf07044
The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec...
1,300
Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.
standard output
PASSED
85708396f452d4c7c1826174e8e3ae9e
train_003.jsonl
1349105400
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class CodeForces { public static void main(String[] args) throws IOException,NumberFormatException{ try { FastScanner sc=new FastScanner(); PrintWriter out=new PrintWriter(System.out); int n=sc.nextInt(); Set<Long> list=new Hash...
Java
["3\n4 5 6"]
2 seconds
["YES\nNO\nNO"]
NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".
Java 11
standard input
[ "binary search", "number theory", "implementation", "math" ]
6cebf9af5cfbb949f22e8b336bf07044
The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec...
1,300
Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.
standard output
PASSED
9b934104248675c861324dfbfc68a471
train_003.jsonl
1349105400
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; import java.util.StringTokenizer; public class TPrimes { public static void main(String[] args) { Reader1 s1=new Reader1(); long t=s1.nextLong(); do...
Java
["3\n4 5 6"]
2 seconds
["YES\nNO\nNO"]
NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".
Java 11
standard input
[ "binary search", "number theory", "implementation", "math" ]
6cebf9af5cfbb949f22e8b336bf07044
The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec...
1,300
Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.
standard output
PASSED
a58b1935ec2bd0a848bef2044a856991
train_003.jsonl
1349105400
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.
256 megabytes
import java.io.*; import java.util.*; public class Sample { static int k; static boolean sieve[]; static int MAX = (int)1e7+1; static int kk = 0; static HashMap<Long,Boolean>map = new HashMap<>(); static ArrayList<Integer>list = new ArrayList<>(); public static void main(String[] args) throws Excepti...
Java
["3\n4 5 6"]
2 seconds
["YES\nNO\nNO"]
NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".
Java 11
standard input
[ "binary search", "number theory", "implementation", "math" ]
6cebf9af5cfbb949f22e8b336bf07044
The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec...
1,300
Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.
standard output
PASSED
a2f7f61251c93a7c1e4bfe5b66e7cfae
train_003.jsonl
1349105400
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.
256 megabytes
import java.io.*; import java.util.*; public class Sample { static int k; static boolean sieve[]; static int MAX = (int)1e7+1; static int kk = 0; static HashMap<Long,Boolean>map = new HashMap<>(); static ArrayList<Integer>list = new ArrayList<>(); public static void main(String[] args) throws Excepti...
Java
["3\n4 5 6"]
2 seconds
["YES\nNO\nNO"]
NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".
Java 11
standard input
[ "binary search", "number theory", "implementation", "math" ]
6cebf9af5cfbb949f22e8b336bf07044
The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec...
1,300
Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.
standard output
PASSED
38dba814becebda6d3a8132051b62ada
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; public class stairs{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); if(m!=0){ int[] dirty = new int[m]; int i = 0; for(i=0;i<m;i++){ dirty[i]=sc.nextInt(); } ...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
37a1c5269855906da9eebe6848b8e855
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.util.Arrays; import java.util.InputMismatchException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using CHelper plug-in * Act...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
2fd8da6ed43624cc0edcd6d48621112f
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class contest_B_13_noy { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int m=sc.nextInt(); if (m==0) { System.out.println("YES"); return; } int [] s=new int [m]; ...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
cef11cbd7ee632df84047e160447d60b
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
import java.util.*; public class PetyaAndStaircases { static boolean can(int[] dirty, int n) { if (dirty.length == 0) return true; Arrays.sort(dirty); if (dirty[0] == 1 || dirty[dirty.length - 1] == n) return false; // look for three consecutive dirty stairs for (int i = 1; i < dirty.length - 1; ...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
d592d49e693314c760736a50659913d2
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
import java.util.*; import java.io.*; public class TaskB { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n=in.nextInt(); int m=in.nextInt(); int[] dirty = new int[m]; for (int i=0;i<m;...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
c28caa82706f0621d6d74432647e8b3d
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class Task1 { public static void solve() throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
b1c733f2e88cbc188b3152a7fadf08d8
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); OutputWriter out = new OutputWriter(outputStream); ...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
b9e9ba5dc83695eade80571c3750d894
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
import java.io.IOException; import java.io.PrintStream; import java.io.PrintWriter; import java.io.StreamCorruptedException; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.InputMismatchException; import java.util.LinkedList; import java.util.PriorityQueue; import java...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
49ed720874cf49d718d94a2b196d9ef7
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class PetyaStaricase { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(Sy...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
2fba7bc64e781bf34fdf7e75ff7f7dd9
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class PetyaAndStaircases { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(), m = in.nextInt(); int[] a = new int[m]; for (int i = 0; i < m; i++) a[i] = in.nex...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
c430b4b82d724f0b645a5a5ec1085eff
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
import java.util.*; public class Main { public static void main(String args[]) { Scanner sc=new Scanner(System.in); long n; int d,i,flag=0,flag1=0; n=sc.nextLong(); d=sc.nextInt(); int a[]=new int[d]; for(i=0;i<d;i++) { a[i]=sc.nextInt(...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
506d265b81355598f307a91802a35a06
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Arrays; import java.util.Scanner; import java.util.TreeSet; public class Main { int a[][]; boolean b[][]; boolean ans = false; void r(int x, int y, int len){ if (a[x][y] == 1) { if (len % 2 == 0 && a[x][y]...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
3741f930d51597e50a1cbdb332bae8ab
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
import java.util.*; public class B { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), m = sc.nextInt(); int a[] = new int[m]; for(int i = 0; i < m; ++i) { a[i] = sc.nextInt(); } Arrays.sort(a); if(...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
d6cff5f02e2c8494ea206bf1975deef4
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
import java.util.*; public class probB { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); boolean answer = true; int arr[] = new int [k]; for (int i = 0; i < k; i++) { int z =in.nextInt()-1; ...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
953805866620bf3b7ca949d683c8240a
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.util.Arrays; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public cla...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
030717053315eb35d980a6616c7e5241
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
import java.util.*; import java.io.*; public class Main { static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); static StringBuilder out = new StringBuilder(); public static void main(String[] args){ int[] inp = nextIntArray(); int n = inp[0]; ...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
86b3d264e3e90ff09648dcdc5d3594cb
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
/* Date : Problem Name : Location : Algorithm : Status : CodingTime : ReadingTime : */ import java.util.*; import java.io.*; public class Main { static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); public static void...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
face2e389da124441a3b723826bc20c2
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main{ public static void main(String args[]) { Scanner in = new Scanner(System.in); int N = in.nextInt(); int m = in.nextInt(); // boolean isDirty[] = new boolean[m + 1]; int dirty[] = new int[m + 1]; boolean flag = false; int i, stair; ...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
2e4676f1c65e3dd8896f57528b42a925
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Hashtable; import java.util.InputMismatchException; import java.util.PriorityQueue; import java.util.Stack; import java.util.TreeSet; public class Q1 { static int count=0; static char[] a; ...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
e69773b4a5b63a444de232a5edf7473a
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
import java.io.*; import java.util.*; public class cf362b { static FastIO in = new FastIO(), out = in; public static void main(String[] args) { int n = in.nextInt(); int m = in.nextInt(); int[] v = new int[m]; for(int i=0; i<m; i++) v[i] = in.nextInt(); Arrays.sort(v); boolean ok = true; ...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
530c12a25f9ded27e14cbbd0dc258939
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class JavaApplication52 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int k = s.nextInt(); if(k == 0){ System.out.println("YES"); return; ...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
3e1810a326cd58c0f50af750d2a3e427
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
import static java.lang.Math.*; import static java.lang.System.currentTimeMillis; import static java.lang.System.exit; import static java.lang.System.arraycopy; import static java.util.Arrays.sort; import static java.util.Arrays.binarySearch; import static java.util.Arrays.fill; import java.util.*; import java.io.*; p...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
2acd3e4135eaf8df7de9c611a70fb09b
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.StringTokenizer; public class Main { static BufferedReader reader; static StringTokenizer tokenizer; ...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
6c6ca6641d389d710cc66d5b6720f770
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
import java.io.*; import java.util.*; import java.lang.StringBuilder; public class Solution362B { public static void main(String[] args) { //Scanner sc = new Scanner(System.in); MyScanner sc = new MyScanner(); int n = sc.nextInt(); int m = sc.nextInt(); int[] dirtyStairs = new int[m]; for (int i = 0 ...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
2980d0b562d3b46f1255d4f5c3434ba7
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Scanner ; import java.util.StringTokenizer; import sun.util.locale.StringTokenIterator; public class JavaApplication96 { /** * @param args the command line arguments */ public static void main(...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
02cac33fb32ba7b9a1aad14c9769129e
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
import java.util.Arrays; import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class CF362B { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); Set<Integer> dirty = new HashSet<Integer>(); int[] dirtyArr = ne...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
af4b07743a6d9dd122466e1bdb116a30
train_003.jsonl
1384443000
Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.Now ...
256 megabytes
import java.io.*; import java.util.*; import java.*; import java.math.BigInteger; import java.util.Random; import javax.naming.BinaryRefAddr; import java.io.*; import java.util.*; import java.lang.*; public class zad { private static BufferedReader in; private static StringTokenizer tok; private static PrintWri...
Java
["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9"]
1 second
["NO", "YES"]
null
Java 7
standard input
[ "implementation", "sortings" ]
422cbf106fac3216d58bdc8411c0bf9f
The first line contains two integers n and m (1 ≤ n ≤ 109, 0 ≤ m ≤ 3000) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains m different space-separated integers d1, d2, ..., dm (1 ≤ di ≤ n) — the numbers of the dirty stairs (in an arbitrary order).
1,100
Print "YES" if Petya can reach stair number n, stepping only on the clean stairs. Otherwise print "NO".
standard output
PASSED
62ab2b730f71f9ba6a1706ebd616eeae
train_003.jsonl
1581257100
Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class codeforces { public static void main(String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Scanner sc = new Scanner(System.in); int t = sc.nextInt(); ...
Java
["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"]
1 second
["1\n2\n0\n2"]
NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array...
Java 8
standard input
[ "implementation", "math" ]
1ffb08fe61cdf90099c82162b8353b1f
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ...
800
For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero.
standard output
PASSED
346ed7d27dafcf73a27f09d26bd677f4
train_003.jsonl
1581257100
Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i...
256 megabytes
import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.InputMismatchException; ...
Java
["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"]
1 second
["1\n2\n0\n2"]
NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array...
Java 8
standard input
[ "implementation", "math" ]
1ffb08fe61cdf90099c82162b8353b1f
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ...
800
For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero.
standard output
PASSED
1e4c66968ff63805fcf8ba734d216062
train_003.jsonl
1581257100
Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; public class A { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); //StringBuilder sb=new S...
Java
["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"]
1 second
["1\n2\n0\n2"]
NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array...
Java 8
standard input
[ "implementation", "math" ]
1ffb08fe61cdf90099c82162b8353b1f
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ...
800
For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero.
standard output
PASSED
563015379cca9af73d2795219cf24e10
train_003.jsonl
1581257100
Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i...
256 megabytes
import java.io.*; import java.util.*; import java.io.IOException; public class Main { public static void main(String args[])throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int t=Integer.parseInt(br.readLine()); while(t--!=0) { ...
Java
["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"]
1 second
["1\n2\n0\n2"]
NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array...
Java 8
standard input
[ "implementation", "math" ]
1ffb08fe61cdf90099c82162b8353b1f
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ...
800
For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero.
standard output
PASSED
3d9795dc8dd64502b793755499ce7d9c
train_003.jsonl
1581257100
Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class GHGG { public static void main(String args[]) { Scanner cin = new Scanner(System.in); int t= cin.nextInt(); ArrayList<Integer> list = new ArrayList<>(); for (int i = 0; i <t; i++) { int n=cin.nextInt(); int sum=0; ArrayList<Inte...
Java
["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"]
1 second
["1\n2\n0\n2"]
NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array...
Java 8
standard input
[ "implementation", "math" ]
1ffb08fe61cdf90099c82162b8353b1f
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ...
800
For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero.
standard output
PASSED
7a9f60b5869caf6beeb8b1d558669b88
train_003.jsonl
1581257100
Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i...
256 megabytes
import java.util.*; public class temp { public static void main(String[] args) { int t; Scanner in = new Scanner(System.in); t=in.nextInt(); for(int j=0;j<t;j++) { int n; n=in.nextInt(); ...
Java
["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"]
1 second
["1\n2\n0\n2"]
NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array...
Java 8
standard input
[ "implementation", "math" ]
1ffb08fe61cdf90099c82162b8353b1f
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ...
800
For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero.
standard output
PASSED
1663eb5fa7bc534cb23646f9bbd1b59d
train_003.jsonl
1581257100
Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i...
256 megabytes
import java.util.Scanner; public class NonZero { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); while(n>0){ int t = s.nextInt(), sum = 0, prd = 1, nsum = 0, sumr = 0, psum = 0; int a[] = new int[t]; for(i...
Java
["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"]
1 second
["1\n2\n0\n2"]
NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array...
Java 8
standard input
[ "implementation", "math" ]
1ffb08fe61cdf90099c82162b8353b1f
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ...
800
For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero.
standard output
PASSED
86b258190766eba578492f76a27fa1b7
train_003.jsonl
1581257100
Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i...
256 megabytes
import java.io.*; import java.util.*; public class Main{ 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(); int[] array = n...
Java
["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"]
1 second
["1\n2\n0\n2"]
NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array...
Java 8
standard input
[ "implementation", "math" ]
1ffb08fe61cdf90099c82162b8353b1f
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ...
800
For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero.
standard output
PASSED
94b83663895b61912de33ba70eb9da90
train_003.jsonl
1581257100
Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i...
256 megabytes
import java.io.*; import java.util.*; public final class Main{ public static void main(String [] args){ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int k=0;k<t;k++){ int n=sc.nextInt(); int [] arr=new int[n]; long sum=0,prod=1,count=0; ...
Java
["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"]
1 second
["1\n2\n0\n2"]
NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array...
Java 8
standard input
[ "implementation", "math" ]
1ffb08fe61cdf90099c82162b8353b1f
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ...
800
For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero.
standard output
PASSED
55312853e1e01ad84975f0ca97007e37
train_003.jsonl
1581257100
Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i...
256 megabytes
import java.util.*; public class Solution { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); StringBuilder result = new StringBuilder(); for(int i = 0; i < t; i++) { int n = scan.nextInt(); int[] a = new ...
Java
["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"]
1 second
["1\n2\n0\n2"]
NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array...
Java 8
standard input
[ "implementation", "math" ]
1ffb08fe61cdf90099c82162b8353b1f
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ...
800
For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero.
standard output
PASSED
d6b11d85de98cbed81357da0c54d8e27
train_003.jsonl
1581257100
Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i...
256 megabytes
import java.util.*; public final class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); int sum = 0, z = 0; for (int i = 0; i < n; i++) { ...
Java
["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"]
1 second
["1\n2\n0\n2"]
NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array...
Java 8
standard input
[ "implementation", "math" ]
1ffb08fe61cdf90099c82162b8353b1f
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ...
800
For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero.
standard output
PASSED
39f2cce724ae4f7ee0ad7db59f68ebb2
train_003.jsonl
1581257100
Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int tcase = sc.nextInt(); for(int t = 0 ; t < tcase ; t++){ int size = sc.nextInt(); int[] arr = new int[size]; ...
Java
["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"]
1 second
["1\n2\n0\n2"]
NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array...
Java 8
standard input
[ "implementation", "math" ]
1ffb08fe61cdf90099c82162b8353b1f
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ...
800
For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero.
standard output
PASSED
b317bd78fa57ee9ec04f5b5c786c7fbc
train_003.jsonl
1581257100
Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i...
256 megabytes
import java.util.Scanner; public class NonZero { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t=scan.nextInt(); for(int j=0;j<t;j++) { int n=scan.nextInt(); int[] a=new int[n]; for(int i=0;i<n;i++) { a[i]=scan.nextInt(); } int sum=0,count=0,t1=0; ...
Java
["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"]
1 second
["1\n2\n0\n2"]
NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array...
Java 8
standard input
[ "implementation", "math" ]
1ffb08fe61cdf90099c82162b8353b1f
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ...
800
For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero.
standard output
PASSED
0fcd611df35578af1df666032fd73453
train_003.jsonl
1581257100
Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i...
256 megabytes
/*package whatever //do not write package name here */ import java.io.*; import java.util.*; public class A { 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]; int nz=0; int sum=0...
Java
["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"]
1 second
["1\n2\n0\n2"]
NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array...
Java 8
standard input
[ "implementation", "math" ]
1ffb08fe61cdf90099c82162b8353b1f
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ...
800
For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero.
standard output
PASSED
a6bc235c3d7435615b5dcdfa94a060b1
train_003.jsonl
1581257100
Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class q1 { public static void main(String[] args) { FastReader s = new FastReader(); int t = s.nextInt(); while(t-- > 0) { int n = s.nextInt(); int[] inp = new...
Java
["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"]
1 second
["1\n2\n0\n2"]
NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array...
Java 8
standard input
[ "implementation", "math" ]
1ffb08fe61cdf90099c82162b8353b1f
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ...
800
For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero.
standard output
PASSED
6c71c9fc26393bccff6778c2ca547547
train_003.jsonl
1581257100
Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i...
256 megabytes
import java.util.Scanner; public class Homework2 { public static void main(String[] args) { Scanner in=new Scanner(System.in); int t=in.nextInt();int sum=0;int countZ=0; for(int i=0;i<t;i++){ int n=in.nextInt();sum=0;countZ=0; for(int j=0;j<n;j++){ ...
Java
["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"]
1 second
["1\n2\n0\n2"]
NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array...
Java 8
standard input
[ "implementation", "math" ]
1ffb08fe61cdf90099c82162b8353b1f
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ...
800
For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero.
standard output
PASSED
e45200a6140343f76225e29616a955b9
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 org.omg.PortableInterceptor.SYSTEM_EXCEPTION; import java.io.*; import java.lang.reflect.Array; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class TaskB implements Runnable { boolean prime[] = new boolean[100001]; void sieveOfEratosthenes(int n) { ...
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
54515810efa97c456bb226bcd4620674
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.Scanner; public class ex7 { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int array1[][] = new int[n][m]; int array2[][] = new int[n][m]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j+...
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
05423a13406ab1930c402b2f5e9addc4
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
// Change Of Plans BABY.... Change Of Plans // import java.io.*; import java.util.*; import static java.lang.Math.*; public class doublematrix { static void MainSolution() { n = ni(); m = ni(); int a[][] = new int[n][m]; int b[][] = new int[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
288cb204bd3d9e18c582dfc52df286d2
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
/*Author: Satyajeet Singh, Delhi Technological University*/ import java.io.*; import java.util.*; import java.text.*; import java.lang.*; import java.math.*; public class Main{ /*********************************************Constants******************************************/ static PrintWriter...
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
670ecfc45098e3ccf412650d6d527dad
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.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashSet; public class Main { static int inf = 1000000000; static int mod = (int) 10e9 + 7; static long gcd(long a, long b) { return (a == 0) ? b : gcd(b % a, a); } static int righ...
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
83124675bef7a2e69015602a12d46027
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.io.*; import static java.lang.Math.*; public class MainS { static final long MOD = 1_000_000_007, INF = 1_000_000_000_000_000_000L; static final int INf = 1_000_000_000; static FastReader reader; static PrintWriter writer; public static void main(String[] args) { ...
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
05cad942067119d3952a6c6ebd4327d0
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.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class First { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new St...
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
adba09b3902b3e963e50d237e7ac1ab4
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.io.*; import static java.lang.Math.*; import java.math.BigInteger; public class B { public static void main(String[] args) throws Exception { FastScanner scanner = new FastScanner(); int[] tmp = scanner.nextIntArray(); int n = tmp[0]; int m = tmp[1]; ...
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
219085745f7018877804fe09bec9ed8c
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.BufferedReader; 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) throws Exception{ // TODO Auto-generated met...
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
88739161a02854c6946956bccededd6f
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.BufferedOutputStream; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.math.BigInteger; import jav...
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
adee944a2ba11fd9bec35b2f605159f6
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
// Created by Whiplash99 import java.io.*; import java.util.*; public class B { public static void main(String[] args) throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int i,N,j,tmp,flag=0; String s[]=br.readLine().trim().split(" "); ...
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
d7262928695e9632af5fe110af3687d1
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.*; import java.math.*; import java.awt.Point; public class Code { //static final long MOD = 998244353L; //static final long INF = -1000000000000000007L; static final long MOD = 1000000007L; //static final int INF = 1000000007; public static void main(String[] args) { FastScann...
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
07d68c185c715e376e8be81431d32c5d
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.io.*; /** * * @author alanl */ public class Main{ static BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); public stat...
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
a4a12bbc72b8fe8e40c6d970b44b48c5
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
/* roses are red memes are neat all my test cases time out lmao yeet golions pls no hack me */ import java.util.*; import java.io.*; public class B { public static void main(String args[]) throws Exception { BufferedReader infile = new BufferedReader(new InputStreamReader(System.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
1eaffa80348788d9dee4dff37c157f0d
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
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Main { public static void main (String[] args) throws java.lang.Exception { // your code goes here Scanner s=new Scann...
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
6983def7e856f23aa316564ca16ceb96
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
// A Computer is Like a mischievous genie. // It will give you exactly what you ask for, // but not always what you want // A code by Rahul Verma import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; imp...
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
449937a6226a426f580e3da96b0be0c9
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 Main { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); public static void main(String[] args) throws IOException { Main m = new Main(); m.solve(); m.close();...
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
18df366aba3c7b36a08b8f528c70a53e
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
//package com.karancp; import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; import java.io.IOException; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.InputStream; public class karan { public static vo...
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
ec7a99d4363630d1d92e66f4339e36ba
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.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.FilterInputStream; import java.io.BufferedInputStream; import java.io.InputStream; /** * @author khokharnikunj8 */ public class Main { public static void main(String[] args) { ...
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
1f495223a35d2c7cf1a6e94d14774d33
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 Solution { PrintWriter out = new PrintWriter(System.out); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer tok = new StringTokenizer(""); String next() throws IOException { if (!tok.hasMore...
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
1c06820cc014b178dbc4804eda7ce94a
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.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class fast implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChar...
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
1dcf6529e730f126bcdc1d09d618f338
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 javax.print.attribute.HashAttributeSet; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; import java.util.stream.IntStream; import java.awt.geom.Line2D; public class Solutiona { InputStream is; PrintWriter out; ...
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
5906f845d1e76ea7f979466c7fadc997
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.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; /* * 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. */ /** ...
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
a4f196be95c8da4658136efda67f1e9b
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
//package competitive; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; import java.util.*; public class B1162 { static class FastReader { BufferedReader br; StringTokenizer st; ...
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
696bcda96fb4178a80ebf64fe0b0fcc3
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 org.omg.PortableInterceptor.INACTIVE; import java.io.*; import java.math.*; import java.util.*; @SuppressWarnings("Duplicates") // author @mdazmat9 public class codeforces{ static long abs=1000000007; public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.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
1d396532867450cf3a142814c2ca485b
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.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class CF1162B { public static void main(String[] args) { FastReader input = new FastReader(); int n = input.nextInt(); int m = input.nextInt(); int[]...
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
ccf9e0345da1f2b0b6237657a0fed8c5
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.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; public class Doublee { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br ...
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
028cb1f4093057395310fecfa3a414bb
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.*; public class Main { public static void swap(int i, int j, int[][] a, int[][] b) { int temp = a[i][j]; a[i][j]=b[i][j]; b[i][j]=temp; } public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int m = s.nextInt(); int[][] 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
6fb278579bf0d578ae2bc80dd6fe3519
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.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class B { final int INF = 1_000_000_000; void solve() { int n = readInt(); int m = readInt(); int[][][] a = new int[2][n][m]; ...
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
08e2361e2dff26e5d4400d92f47f4c78
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.FileInputStream; import java.util.Arrays; import java.util.Scanner; import static java.lang.Math.min; public class TaskB { int n,m; int[][] m1, m2; void solve() throws Exception{ //Scanner sc = new Scanner(new FileInputStream("inputs/b.in")); Scanner sc = new Scanner(System...
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