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
d91c431631d85443f426719bd4799645
train_003.jsonl
1496837700
The crowdedness of the discotheque would never stop our friends from having fun, but a bit more spaciousness won't hurt, will it?The discotheque can be seen as an infinite xy-plane, in which there are a total of n dancers. Once someone starts moving around, they will move only inside their own movement range, which is ...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; import java.text.*; public class A{ //public static PrintWriter pw; public static PrintWriter pw=new PrintWriter(System.out); public static void solve() throws IOException{ // pw=new PrintWriter(new FileWriter("C:\\Users\\shree\\Downloads\\small_output_in"))...
Java
["5\n2 1 6\n0 4 1\n2 -1 3\n1 -2 1\n4 -1 1", "8\n0 0 1\n0 0 2\n0 0 3\n0 0 4\n0 0 5\n0 0 6\n0 0 7\n0 0 8"]
2 seconds
["138.23007676", "289.02652413"]
NoteThe first sample corresponds to the illustrations in the legend.
Java 8
standard input
[ "dp", "geometry", "greedy", "dfs and similar", "trees" ]
56a13208f0a9b2fad23756f39acd64af
The first line of input contains a positive integer n (1 ≀ n ≀ 1 000) β€” the number of dancers. The following n lines each describes a dancer: the i-th line among them contains three space-separated integers xi, yi and ri ( - 106 ≀ xi, yi ≀ 106, 1 ≀ ri ≀ 106), describing a circular movement range centered at (xi, yi) wi...
2,000
Output one decimal number β€” the largest achievable sum of spaciousness over two halves of the night. The output is considered correct if it has a relative or absolute error of at most 10 - 9. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
b19a6ce4f0d3e9f67a6d70899e16046f
train_003.jsonl
1487930700
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to make searching for a particular topic more comfortable. For the purpose of this problem we define hashta...
256 megabytes
//.....your program.... import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main { ////// static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() ...
Java
["3\n#book\n#bigtown\n#big", "3\n#book\n#cool\n#cold", "4\n#car\n#cart\n#art\n#at", "3\n#apple\n#apple\n#fruit"]
2 seconds
["#b\n#big\n#big", "#book\n#co\n#cold", "#\n#\n#art\n#at", "#apple\n#apple\n#fruit"]
NoteWord a1, a2, ..., am of length m is lexicographically not greater than word b1, b2, ..., bk of length k, if one of two conditions hold: at first position i, such that ai ≠ bi, the character ai goes earlier in the alphabet than character bi, i.e. a has smaller character than b in the first position where they diff...
Java 8
standard input
[ "binary search", "implementation", "greedy", "strings" ]
27baf9b1241c0f8e3a2037b18f39fe34
The first line of the input contains a single integer n (1 ≀ n ≀ 500 000)Β β€” the number of hashtags being edited now. Each of the next n lines contains exactly one hashtag of positive length. It is guaranteed that the total length of all hashtags (i.e. the total length of the string except for characters '#') won't exce...
1,800
Print the resulting hashtags in any of the optimal solutions.
standard output
PASSED
8941f7b8f5fe4144f4f2367752f2b5b2
train_003.jsonl
1487930700
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to make searching for a particular topic more comfortable. For the purpose of this problem we define hashta...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class D401 { public static void main...
Java
["3\n#book\n#bigtown\n#big", "3\n#book\n#cool\n#cold", "4\n#car\n#cart\n#art\n#at", "3\n#apple\n#apple\n#fruit"]
2 seconds
["#b\n#big\n#big", "#book\n#co\n#cold", "#\n#\n#art\n#at", "#apple\n#apple\n#fruit"]
NoteWord a1, a2, ..., am of length m is lexicographically not greater than word b1, b2, ..., bk of length k, if one of two conditions hold: at first position i, such that ai ≠ bi, the character ai goes earlier in the alphabet than character bi, i.e. a has smaller character than b in the first position where they diff...
Java 8
standard input
[ "binary search", "implementation", "greedy", "strings" ]
27baf9b1241c0f8e3a2037b18f39fe34
The first line of the input contains a single integer n (1 ≀ n ≀ 500 000)Β β€” the number of hashtags being edited now. Each of the next n lines contains exactly one hashtag of positive length. It is guaranteed that the total length of all hashtags (i.e. the total length of the string except for characters '#') won't exce...
1,800
Print the resulting hashtags in any of the optimal solutions.
standard output
PASSED
1e206284ccc7e74b6fdcfb077ec1a7ab
train_003.jsonl
1487930700
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to make searching for a particular topic more comfortable. For the purpose of this problem we define hashta...
256 megabytes
import java.io.*; import java.util.Arrays; public class D401 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); int n = Integer.pars...
Java
["3\n#book\n#bigtown\n#big", "3\n#book\n#cool\n#cold", "4\n#car\n#cart\n#art\n#at", "3\n#apple\n#apple\n#fruit"]
2 seconds
["#b\n#big\n#big", "#book\n#co\n#cold", "#\n#\n#art\n#at", "#apple\n#apple\n#fruit"]
NoteWord a1, a2, ..., am of length m is lexicographically not greater than word b1, b2, ..., bk of length k, if one of two conditions hold: at first position i, such that ai ≠ bi, the character ai goes earlier in the alphabet than character bi, i.e. a has smaller character than b in the first position where they diff...
Java 8
standard input
[ "binary search", "implementation", "greedy", "strings" ]
27baf9b1241c0f8e3a2037b18f39fe34
The first line of the input contains a single integer n (1 ≀ n ≀ 500 000)Β β€” the number of hashtags being edited now. Each of the next n lines contains exactly one hashtag of positive length. It is guaranteed that the total length of all hashtags (i.e. the total length of the string except for characters '#') won't exce...
1,800
Print the resulting hashtags in any of the optimal solutions.
standard output
PASSED
46f4f49dd556e022c633ef8240208325
train_003.jsonl
1487930700
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to make searching for a particular topic more comfortable. For the purpose of this problem we define hashta...
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 codeforces implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[...
Java
["3\n#book\n#bigtown\n#big", "3\n#book\n#cool\n#cold", "4\n#car\n#cart\n#art\n#at", "3\n#apple\n#apple\n#fruit"]
2 seconds
["#b\n#big\n#big", "#book\n#co\n#cold", "#\n#\n#art\n#at", "#apple\n#apple\n#fruit"]
NoteWord a1, a2, ..., am of length m is lexicographically not greater than word b1, b2, ..., bk of length k, if one of two conditions hold: at first position i, such that ai ≠ bi, the character ai goes earlier in the alphabet than character bi, i.e. a has smaller character than b in the first position where they diff...
Java 8
standard input
[ "binary search", "implementation", "greedy", "strings" ]
27baf9b1241c0f8e3a2037b18f39fe34
The first line of the input contains a single integer n (1 ≀ n ≀ 500 000)Β β€” the number of hashtags being edited now. Each of the next n lines contains exactly one hashtag of positive length. It is guaranteed that the total length of all hashtags (i.e. the total length of the string except for characters '#') won't exce...
1,800
Print the resulting hashtags in any of the optimal solutions.
standard output
PASSED
b32eaa9cb598d98c15dfed7b481e8d6e
train_003.jsonl
1487930700
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to make searching for a particular topic more comfortable. For the purpose of this problem we define hashta...
256 megabytes
import java.util.*; import java.io.*; public class A{ static boolean visited[]; public static void main(String[] args) { MyScanner scan = new MyScanner(); int n = scan.nextInt(); String arr[] = new String[n]; for(int i = 0;i < n;i++) arr[i] = scan.next(); String ot[] = new String[n]; for(int i = n-2;i ...
Java
["3\n#book\n#bigtown\n#big", "3\n#book\n#cool\n#cold", "4\n#car\n#cart\n#art\n#at", "3\n#apple\n#apple\n#fruit"]
2 seconds
["#b\n#big\n#big", "#book\n#co\n#cold", "#\n#\n#art\n#at", "#apple\n#apple\n#fruit"]
NoteWord a1, a2, ..., am of length m is lexicographically not greater than word b1, b2, ..., bk of length k, if one of two conditions hold: at first position i, such that ai ≠ bi, the character ai goes earlier in the alphabet than character bi, i.e. a has smaller character than b in the first position where they diff...
Java 8
standard input
[ "binary search", "implementation", "greedy", "strings" ]
27baf9b1241c0f8e3a2037b18f39fe34
The first line of the input contains a single integer n (1 ≀ n ≀ 500 000)Β β€” the number of hashtags being edited now. Each of the next n lines contains exactly one hashtag of positive length. It is guaranteed that the total length of all hashtags (i.e. the total length of the string except for characters '#') won't exce...
1,800
Print the resulting hashtags in any of the optimal solutions.
standard output
PASSED
24e2762c4f53e3377154598c07258abf
train_003.jsonl
1487930700
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to make searching for a particular topic more comfortable. For the purpose of this problem we define hashta...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Cf401D { static MyScanner in = new MyScanner(); static PrintWriter out = new PrintWriter(new BufferedOutputStrea...
Java
["3\n#book\n#bigtown\n#big", "3\n#book\n#cool\n#cold", "4\n#car\n#cart\n#art\n#at", "3\n#apple\n#apple\n#fruit"]
2 seconds
["#b\n#big\n#big", "#book\n#co\n#cold", "#\n#\n#art\n#at", "#apple\n#apple\n#fruit"]
NoteWord a1, a2, ..., am of length m is lexicographically not greater than word b1, b2, ..., bk of length k, if one of two conditions hold: at first position i, such that ai ≠ bi, the character ai goes earlier in the alphabet than character bi, i.e. a has smaller character than b in the first position where they diff...
Java 8
standard input
[ "binary search", "implementation", "greedy", "strings" ]
27baf9b1241c0f8e3a2037b18f39fe34
The first line of the input contains a single integer n (1 ≀ n ≀ 500 000)Β β€” the number of hashtags being edited now. Each of the next n lines contains exactly one hashtag of positive length. It is guaranteed that the total length of all hashtags (i.e. the total length of the string except for characters '#') won't exce...
1,800
Print the resulting hashtags in any of the optimal solutions.
standard output
PASSED
fe088a81a630046d4c8adac799ac79bb
train_003.jsonl
1487930700
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to make searching for a particular topic more comfortable. For the purpose of this problem we define hashta...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; import java.util.concurrent.ArrayBlockingQueue; public class D { String line; StringTokenizer inputParser; BufferedReader is; FileInputStream fstream; DataInputStream in; void openInput(String file) { if(file==null)is = new BufferedReader(n...
Java
["3\n#book\n#bigtown\n#big", "3\n#book\n#cool\n#cold", "4\n#car\n#cart\n#art\n#at", "3\n#apple\n#apple\n#fruit"]
2 seconds
["#b\n#big\n#big", "#book\n#co\n#cold", "#\n#\n#art\n#at", "#apple\n#apple\n#fruit"]
NoteWord a1, a2, ..., am of length m is lexicographically not greater than word b1, b2, ..., bk of length k, if one of two conditions hold: at first position i, such that ai ≠ bi, the character ai goes earlier in the alphabet than character bi, i.e. a has smaller character than b in the first position where they diff...
Java 8
standard input
[ "binary search", "implementation", "greedy", "strings" ]
27baf9b1241c0f8e3a2037b18f39fe34
The first line of the input contains a single integer n (1 ≀ n ≀ 500 000)Β β€” the number of hashtags being edited now. Each of the next n lines contains exactly one hashtag of positive length. It is guaranteed that the total length of all hashtags (i.e. the total length of the string except for characters '#') won't exce...
1,800
Print the resulting hashtags in any of the optimal solutions.
standard output
PASSED
0a324ded1fbcf7ea21bba7a09880e796
train_003.jsonl
1487930700
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to make searching for a particular topic more comfortable. For the purpose of this problem we define hashta...
256 megabytes
import java.util.*; import java.io.*; public class d{ static InputReader in = new InputReader(System.in); static PrintWriter out = new PrintWriter(System.out); String str(char[] s){ return new String(s); } char[] ta(String s){ return s.toCharArray(); } void solve(){ int n = in.nextInt(); char[][] a = n...
Java
["3\n#book\n#bigtown\n#big", "3\n#book\n#cool\n#cold", "4\n#car\n#cart\n#art\n#at", "3\n#apple\n#apple\n#fruit"]
2 seconds
["#b\n#big\n#big", "#book\n#co\n#cold", "#\n#\n#art\n#at", "#apple\n#apple\n#fruit"]
NoteWord a1, a2, ..., am of length m is lexicographically not greater than word b1, b2, ..., bk of length k, if one of two conditions hold: at first position i, such that ai ≠ bi, the character ai goes earlier in the alphabet than character bi, i.e. a has smaller character than b in the first position where they diff...
Java 8
standard input
[ "binary search", "implementation", "greedy", "strings" ]
27baf9b1241c0f8e3a2037b18f39fe34
The first line of the input contains a single integer n (1 ≀ n ≀ 500 000)Β β€” the number of hashtags being edited now. Each of the next n lines contains exactly one hashtag of positive length. It is guaranteed that the total length of all hashtags (i.e. the total length of the string except for characters '#') won't exce...
1,800
Print the resulting hashtags in any of the optimal solutions.
standard output
PASSED
61ac9d5335fa19dbb43837dfa1403cd4
train_003.jsonl
1487930700
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to make searching for a particular topic more comfortable. For the purpose of this problem we define hashta...
256 megabytes
import java.util.*; import java.io.*; public class d{ static InputReader in = new InputReader(System.in); static PrintWriter out = new PrintWriter(System.out); char[] ta(String s){ return s.toCharArray(); } void solve(){ int n = in.nextInt();; String[] s = new String[n]; for(int i=0; i<n; i++) s[i] = in.n...
Java
["3\n#book\n#bigtown\n#big", "3\n#book\n#cool\n#cold", "4\n#car\n#cart\n#art\n#at", "3\n#apple\n#apple\n#fruit"]
2 seconds
["#b\n#big\n#big", "#book\n#co\n#cold", "#\n#\n#art\n#at", "#apple\n#apple\n#fruit"]
NoteWord a1, a2, ..., am of length m is lexicographically not greater than word b1, b2, ..., bk of length k, if one of two conditions hold: at first position i, such that ai ≠ bi, the character ai goes earlier in the alphabet than character bi, i.e. a has smaller character than b in the first position where they diff...
Java 8
standard input
[ "binary search", "implementation", "greedy", "strings" ]
27baf9b1241c0f8e3a2037b18f39fe34
The first line of the input contains a single integer n (1 ≀ n ≀ 500 000)Β β€” the number of hashtags being edited now. Each of the next n lines contains exactly one hashtag of positive length. It is guaranteed that the total length of all hashtags (i.e. the total length of the string except for characters '#') won't exce...
1,800
Print the resulting hashtags in any of the optimal solutions.
standard output
PASSED
f29b657de18eda0b5dc4c1e2f9430d62
train_003.jsonl
1487930700
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to make searching for a particular topic more comfortable. For the purpose of this problem we define hashta...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); PrintWriter pw=new PrintWriter(System.out); while(sc.hasNext()){ int n=sc.nextInt(); String[]s=new String [n]; ...
Java
["3\n#book\n#bigtown\n#big", "3\n#book\n#cool\n#cold", "4\n#car\n#cart\n#art\n#at", "3\n#apple\n#apple\n#fruit"]
2 seconds
["#b\n#big\n#big", "#book\n#co\n#cold", "#\n#\n#art\n#at", "#apple\n#apple\n#fruit"]
NoteWord a1, a2, ..., am of length m is lexicographically not greater than word b1, b2, ..., bk of length k, if one of two conditions hold: at first position i, such that ai ≠ bi, the character ai goes earlier in the alphabet than character bi, i.e. a has smaller character than b in the first position where they diff...
Java 8
standard input
[ "binary search", "implementation", "greedy", "strings" ]
27baf9b1241c0f8e3a2037b18f39fe34
The first line of the input contains a single integer n (1 ≀ n ≀ 500 000)Β β€” the number of hashtags being edited now. Each of the next n lines contains exactly one hashtag of positive length. It is guaranteed that the total length of all hashtags (i.e. the total length of the string except for characters '#') won't exce...
1,800
Print the resulting hashtags in any of the optimal solutions.
standard output
PASSED
1302a2535dc6877d6f90c2393d505651
train_003.jsonl
1487930700
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to make searching for a particular topic more comfortable. For the purpose of this problem we define hashta...
256 megabytes
import java.util.*; import java.io.*; public class main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); while(sc.hasNext()){ int n = sc.nextInt(); String[] s = new String [n]; for(int i = ...
Java
["3\n#book\n#bigtown\n#big", "3\n#book\n#cool\n#cold", "4\n#car\n#cart\n#art\n#at", "3\n#apple\n#apple\n#fruit"]
2 seconds
["#b\n#big\n#big", "#book\n#co\n#cold", "#\n#\n#art\n#at", "#apple\n#apple\n#fruit"]
NoteWord a1, a2, ..., am of length m is lexicographically not greater than word b1, b2, ..., bk of length k, if one of two conditions hold: at first position i, such that ai ≠ bi, the character ai goes earlier in the alphabet than character bi, i.e. a has smaller character than b in the first position where they diff...
Java 8
standard input
[ "binary search", "implementation", "greedy", "strings" ]
27baf9b1241c0f8e3a2037b18f39fe34
The first line of the input contains a single integer n (1 ≀ n ≀ 500 000)Β β€” the number of hashtags being edited now. Each of the next n lines contains exactly one hashtag of positive length. It is guaranteed that the total length of all hashtags (i.e. the total length of the string except for characters '#') won't exce...
1,800
Print the resulting hashtags in any of the optimal solutions.
standard output
PASSED
5bb0b95c87ee301b58aec55a26bb22e2
train_003.jsonl
1487930700
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to make searching for a particular topic more comfortable. For the purpose of this problem we define hashta...
256 megabytes
//package codeforces.round401; import java.io.*; import java.util.StringTokenizer; /** * Created by shirsh.bansal on 24/02/17. */ public class Main { public static void main(String[] args) throws IOException { FastScanner scanner = new FastScanner(); OutputWriter outputWriter = new OutputWriter(...
Java
["3\n#book\n#bigtown\n#big", "3\n#book\n#cool\n#cold", "4\n#car\n#cart\n#art\n#at", "3\n#apple\n#apple\n#fruit"]
2 seconds
["#b\n#big\n#big", "#book\n#co\n#cold", "#\n#\n#art\n#at", "#apple\n#apple\n#fruit"]
NoteWord a1, a2, ..., am of length m is lexicographically not greater than word b1, b2, ..., bk of length k, if one of two conditions hold: at first position i, such that ai ≠ bi, the character ai goes earlier in the alphabet than character bi, i.e. a has smaller character than b in the first position where they diff...
Java 8
standard input
[ "binary search", "implementation", "greedy", "strings" ]
27baf9b1241c0f8e3a2037b18f39fe34
The first line of the input contains a single integer n (1 ≀ n ≀ 500 000)Β β€” the number of hashtags being edited now. Each of the next n lines contains exactly one hashtag of positive length. It is guaranteed that the total length of all hashtags (i.e. the total length of the string except for characters '#') won't exce...
1,800
Print the resulting hashtags in any of the optimal solutions.
standard output
PASSED
b6464ba8e2887756d95f5717a3e42d30
train_003.jsonl
1487930700
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to make searching for a particular topic more comfortable. For the purpose of this problem we define hashta...
256 megabytes
// nice question I Like it import java.util.*; import java.io.*; public class lp1{ static int count(String s1,String s2,int l2) // s2>=s1 // it will give length of string s1 which needs to be removed { int i1=0,i2=0; while(i1<s1.length()&&i2<l2) { if(s1.charAt(i1)<s2.charA...
Java
["3\n#book\n#bigtown\n#big", "3\n#book\n#cool\n#cold", "4\n#car\n#cart\n#art\n#at", "3\n#apple\n#apple\n#fruit"]
2 seconds
["#b\n#big\n#big", "#book\n#co\n#cold", "#\n#\n#art\n#at", "#apple\n#apple\n#fruit"]
NoteWord a1, a2, ..., am of length m is lexicographically not greater than word b1, b2, ..., bk of length k, if one of two conditions hold: at first position i, such that ai ≠ bi, the character ai goes earlier in the alphabet than character bi, i.e. a has smaller character than b in the first position where they diff...
Java 8
standard input
[ "binary search", "implementation", "greedy", "strings" ]
27baf9b1241c0f8e3a2037b18f39fe34
The first line of the input contains a single integer n (1 ≀ n ≀ 500 000)Β β€” the number of hashtags being edited now. Each of the next n lines contains exactly one hashtag of positive length. It is guaranteed that the total length of all hashtags (i.e. the total length of the string except for characters '#') won't exce...
1,800
Print the resulting hashtags in any of the optimal solutions.
standard output
PASSED
2938e102a25b16eb2263dbde235ef27f
train_003.jsonl
1487930700
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to make searching for a particular topic more comfortable. For the purpose of this problem we define hashta...
256 megabytes
import java.util.*; import java.io.*; public class lp1{ static int count(String s1,String s2,int l2) // s2>=s1 { int i1=0,i2=0; while(i1<s1.length()&&i2<l2) { if(s1.charAt(i1)<s2.charAt(i2)) return 0; if(s1.charAt(i1)>s2.charAt(i2)) ...
Java
["3\n#book\n#bigtown\n#big", "3\n#book\n#cool\n#cold", "4\n#car\n#cart\n#art\n#at", "3\n#apple\n#apple\n#fruit"]
2 seconds
["#b\n#big\n#big", "#book\n#co\n#cold", "#\n#\n#art\n#at", "#apple\n#apple\n#fruit"]
NoteWord a1, a2, ..., am of length m is lexicographically not greater than word b1, b2, ..., bk of length k, if one of two conditions hold: at first position i, such that ai ≠ bi, the character ai goes earlier in the alphabet than character bi, i.e. a has smaller character than b in the first position where they diff...
Java 8
standard input
[ "binary search", "implementation", "greedy", "strings" ]
27baf9b1241c0f8e3a2037b18f39fe34
The first line of the input contains a single integer n (1 ≀ n ≀ 500 000)Β β€” the number of hashtags being edited now. Each of the next n lines contains exactly one hashtag of positive length. It is guaranteed that the total length of all hashtags (i.e. the total length of the string except for characters '#') won't exce...
1,800
Print the resulting hashtags in any of the optimal solutions.
standard output
PASSED
52e7b1876f69f4daa0b09041fba7d80a
train_003.jsonl
1487930700
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to make searching for a particular topic more comfortable. For the purpose of this problem we define hashta...
256 megabytes
import java.io.*; import java.util.*; public class SolveD { public static Reader in; public static PrintWriter out; public static long mod = 1000000007; public static long inf = 100000000000000000l; public static long fac[],inv[]; public static int union[]; public static void solve(){ ...
Java
["3\n#book\n#bigtown\n#big", "3\n#book\n#cool\n#cold", "4\n#car\n#cart\n#art\n#at", "3\n#apple\n#apple\n#fruit"]
2 seconds
["#b\n#big\n#big", "#book\n#co\n#cold", "#\n#\n#art\n#at", "#apple\n#apple\n#fruit"]
NoteWord a1, a2, ..., am of length m is lexicographically not greater than word b1, b2, ..., bk of length k, if one of two conditions hold: at first position i, such that ai ≠ bi, the character ai goes earlier in the alphabet than character bi, i.e. a has smaller character than b in the first position where they diff...
Java 8
standard input
[ "binary search", "implementation", "greedy", "strings" ]
27baf9b1241c0f8e3a2037b18f39fe34
The first line of the input contains a single integer n (1 ≀ n ≀ 500 000)Β β€” the number of hashtags being edited now. Each of the next n lines contains exactly one hashtag of positive length. It is guaranteed that the total length of all hashtags (i.e. the total length of the string except for characters '#') won't exce...
1,800
Print the resulting hashtags in any of the optimal solutions.
standard output
PASSED
96ca6ad8f79fea21cafb8342cfe27383
train_003.jsonl
1487930700
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to make searching for a particular topic more comfortable. For the purpose of this problem we define hashta...
256 megabytes
import java.io.*; import java.util.*; public class CFB { BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof; private static final long MOD = 1000L * 1000L * 1000L + 7; private static final int[] dx = {0, -1, 0, 1}; private static final int[] dy = {1, 0, -1, 0}; private...
Java
["3\n#book\n#bigtown\n#big", "3\n#book\n#cool\n#cold", "4\n#car\n#cart\n#art\n#at", "3\n#apple\n#apple\n#fruit"]
2 seconds
["#b\n#big\n#big", "#book\n#co\n#cold", "#\n#\n#art\n#at", "#apple\n#apple\n#fruit"]
NoteWord a1, a2, ..., am of length m is lexicographically not greater than word b1, b2, ..., bk of length k, if one of two conditions hold: at first position i, such that ai ≠ bi, the character ai goes earlier in the alphabet than character bi, i.e. a has smaller character than b in the first position where they diff...
Java 8
standard input
[ "binary search", "implementation", "greedy", "strings" ]
27baf9b1241c0f8e3a2037b18f39fe34
The first line of the input contains a single integer n (1 ≀ n ≀ 500 000)Β β€” the number of hashtags being edited now. Each of the next n lines contains exactly one hashtag of positive length. It is guaranteed that the total length of all hashtags (i.e. the total length of the string except for characters '#') won't exce...
1,800
Print the resulting hashtags in any of the optimal solutions.
standard output
PASSED
395efba2d7a3b86ad71cf3e0f1bcee48
train_003.jsonl
1487930700
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to make searching for a particular topic more comfortable. For the purpose of this problem we define hashta...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Task777D { public static void main(String[] args) throws IOException { InputScanner is = new InputScanner(); int n = is.nextInt(); char[][] tags = new...
Java
["3\n#book\n#bigtown\n#big", "3\n#book\n#cool\n#cold", "4\n#car\n#cart\n#art\n#at", "3\n#apple\n#apple\n#fruit"]
2 seconds
["#b\n#big\n#big", "#book\n#co\n#cold", "#\n#\n#art\n#at", "#apple\n#apple\n#fruit"]
NoteWord a1, a2, ..., am of length m is lexicographically not greater than word b1, b2, ..., bk of length k, if one of two conditions hold: at first position i, such that ai ≠ bi, the character ai goes earlier in the alphabet than character bi, i.e. a has smaller character than b in the first position where they diff...
Java 8
standard input
[ "binary search", "implementation", "greedy", "strings" ]
27baf9b1241c0f8e3a2037b18f39fe34
The first line of the input contains a single integer n (1 ≀ n ≀ 500 000)Β β€” the number of hashtags being edited now. Each of the next n lines contains exactly one hashtag of positive length. It is guaranteed that the total length of all hashtags (i.e. the total length of the string except for characters '#') won't exce...
1,800
Print the resulting hashtags in any of the optimal solutions.
standard output
PASSED
7bc7053f24a616a3cfc12b7233f9c068
train_003.jsonl
1487930700
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to make searching for a particular topic more comfortable. For the purpose of this problem we define hashta...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(); String[] strings = new String[n]; for (int i...
Java
["3\n#book\n#bigtown\n#big", "3\n#book\n#cool\n#cold", "4\n#car\n#cart\n#art\n#at", "3\n#apple\n#apple\n#fruit"]
2 seconds
["#b\n#big\n#big", "#book\n#co\n#cold", "#\n#\n#art\n#at", "#apple\n#apple\n#fruit"]
NoteWord a1, a2, ..., am of length m is lexicographically not greater than word b1, b2, ..., bk of length k, if one of two conditions hold: at first position i, such that ai ≠ bi, the character ai goes earlier in the alphabet than character bi, i.e. a has smaller character than b in the first position where they diff...
Java 8
standard input
[ "binary search", "implementation", "greedy", "strings" ]
27baf9b1241c0f8e3a2037b18f39fe34
The first line of the input contains a single integer n (1 ≀ n ≀ 500 000)Β β€” the number of hashtags being edited now. Each of the next n lines contains exactly one hashtag of positive length. It is guaranteed that the total length of all hashtags (i.e. the total length of the string except for characters '#') won't exce...
1,800
Print the resulting hashtags in any of the optimal solutions.
standard output
PASSED
bfdb54c1b4997934fa7ec7501b9c35bf
train_003.jsonl
1487930700
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to make searching for a particular topic more comfortable. For the purpose of this problem we define hashta...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; /** * 777D * <p> * A greedy solution. * ΞΈ(Ξ£(|s_i|)) time * ΞΈ(Ξ£(|s_i|)) space * * @author artyom */ public class _777D implements Runnable { private BufferedReader ...
Java
["3\n#book\n#bigtown\n#big", "3\n#book\n#cool\n#cold", "4\n#car\n#cart\n#art\n#at", "3\n#apple\n#apple\n#fruit"]
2 seconds
["#b\n#big\n#big", "#book\n#co\n#cold", "#\n#\n#art\n#at", "#apple\n#apple\n#fruit"]
NoteWord a1, a2, ..., am of length m is lexicographically not greater than word b1, b2, ..., bk of length k, if one of two conditions hold: at first position i, such that ai ≠ bi, the character ai goes earlier in the alphabet than character bi, i.e. a has smaller character than b in the first position where they diff...
Java 8
standard input
[ "binary search", "implementation", "greedy", "strings" ]
27baf9b1241c0f8e3a2037b18f39fe34
The first line of the input contains a single integer n (1 ≀ n ≀ 500 000)Β β€” the number of hashtags being edited now. Each of the next n lines contains exactly one hashtag of positive length. It is guaranteed that the total length of all hashtags (i.e. the total length of the string except for characters '#') won't exce...
1,800
Print the resulting hashtags in any of the optimal solutions.
standard output
PASSED
1f1b0ae072a9216d9a94dfc3e948c406
train_003.jsonl
1487930700
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to make searching for a particular topic more comfortable. For the purpose of this problem we define hashta...
256 megabytes
import java.util.*; import java.io.*; public class cf { static String arr[]; static int n; public static void main(String[] args)throws IOException { PrintWriter out= new PrintWriter(System.out); Scanner sc = new Scanner(System.in); BufferedReader br = new BufferedReader(new Inpu...
Java
["3\n#book\n#bigtown\n#big", "3\n#book\n#cool\n#cold", "4\n#car\n#cart\n#art\n#at", "3\n#apple\n#apple\n#fruit"]
2 seconds
["#b\n#big\n#big", "#book\n#co\n#cold", "#\n#\n#art\n#at", "#apple\n#apple\n#fruit"]
NoteWord a1, a2, ..., am of length m is lexicographically not greater than word b1, b2, ..., bk of length k, if one of two conditions hold: at first position i, such that ai ≠ bi, the character ai goes earlier in the alphabet than character bi, i.e. a has smaller character than b in the first position where they diff...
Java 8
standard input
[ "binary search", "implementation", "greedy", "strings" ]
27baf9b1241c0f8e3a2037b18f39fe34
The first line of the input contains a single integer n (1 ≀ n ≀ 500 000)Β β€” the number of hashtags being edited now. Each of the next n lines contains exactly one hashtag of positive length. It is guaranteed that the total length of all hashtags (i.e. the total length of the string except for characters '#') won't exce...
1,800
Print the resulting hashtags in any of the optimal solutions.
standard output
PASSED
5805e3ee09a76f05325760f373447da0
train_003.jsonl
1487930700
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to make searching for a particular topic more comfortable. For the purpose of this problem we define hashta...
256 megabytes
import java.util.*; public class Task777D { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); StringBuffer sb[] = new StringBuffer[n], ans = new StringBuffer(); for (int i = 0; i < n; i++) { sb[i] = new StringBuffer(sc....
Java
["3\n#book\n#bigtown\n#big", "3\n#book\n#cool\n#cold", "4\n#car\n#cart\n#art\n#at", "3\n#apple\n#apple\n#fruit"]
2 seconds
["#b\n#big\n#big", "#book\n#co\n#cold", "#\n#\n#art\n#at", "#apple\n#apple\n#fruit"]
NoteWord a1, a2, ..., am of length m is lexicographically not greater than word b1, b2, ..., bk of length k, if one of two conditions hold: at first position i, such that ai ≠ bi, the character ai goes earlier in the alphabet than character bi, i.e. a has smaller character than b in the first position where they diff...
Java 8
standard input
[ "binary search", "implementation", "greedy", "strings" ]
27baf9b1241c0f8e3a2037b18f39fe34
The first line of the input contains a single integer n (1 ≀ n ≀ 500 000)Β β€” the number of hashtags being edited now. Each of the next n lines contains exactly one hashtag of positive length. It is guaranteed that the total length of all hashtags (i.e. the total length of the string except for characters '#') won't exce...
1,800
Print the resulting hashtags in any of the optimal solutions.
standard output
PASSED
a68e36ef9e37ac550744248f38c1d4dd
train_003.jsonl
1487930700
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to make searching for a particular topic more comfortable. For the purpose of this problem we define hashta...
256 megabytes
import java.io.*; import java.util.*; public class D777 { public static void main(String args[])throws IOException { Scanner sc=new Scanner(System.in); PrintWriter pw=new PrintWriter(System.out); int n=sc.nextInt(); String s[]=new String[n]; for(int i=0;i<n;i++) ...
Java
["3\n#book\n#bigtown\n#big", "3\n#book\n#cool\n#cold", "4\n#car\n#cart\n#art\n#at", "3\n#apple\n#apple\n#fruit"]
2 seconds
["#b\n#big\n#big", "#book\n#co\n#cold", "#\n#\n#art\n#at", "#apple\n#apple\n#fruit"]
NoteWord a1, a2, ..., am of length m is lexicographically not greater than word b1, b2, ..., bk of length k, if one of two conditions hold: at first position i, such that ai ≠ bi, the character ai goes earlier in the alphabet than character bi, i.e. a has smaller character than b in the first position where they diff...
Java 8
standard input
[ "binary search", "implementation", "greedy", "strings" ]
27baf9b1241c0f8e3a2037b18f39fe34
The first line of the input contains a single integer n (1 ≀ n ≀ 500 000)Β β€” the number of hashtags being edited now. Each of the next n lines contains exactly one hashtag of positive length. It is guaranteed that the total length of all hashtags (i.e. the total length of the string except for characters '#') won't exce...
1,800
Print the resulting hashtags in any of the optimal solutions.
standard output
PASSED
29bca5e513f01db63a42ca6cd9256e92
train_003.jsonl
1487930700
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to make searching for a particular topic more comfortable. For the purpose of this problem we define hashta...
256 megabytes
import java.util.*; public class D { public static void main(String args[]){ Scanner sc = new Scanner(System.in); int n= sc.nextInt(); StringBuffer sb[] = new StringBuffer[n],ans = new StringBuffer(); for(int i=0 ; i<n ;i++){ sb[i] = new StringBuffer(sc.next()); } for(int i=n-2; i>=0 ;i--){ ...
Java
["3\n#book\n#bigtown\n#big", "3\n#book\n#cool\n#cold", "4\n#car\n#cart\n#art\n#at", "3\n#apple\n#apple\n#fruit"]
2 seconds
["#b\n#big\n#big", "#book\n#co\n#cold", "#\n#\n#art\n#at", "#apple\n#apple\n#fruit"]
NoteWord a1, a2, ..., am of length m is lexicographically not greater than word b1, b2, ..., bk of length k, if one of two conditions hold: at first position i, such that ai ≠ bi, the character ai goes earlier in the alphabet than character bi, i.e. a has smaller character than b in the first position where they diff...
Java 8
standard input
[ "binary search", "implementation", "greedy", "strings" ]
27baf9b1241c0f8e3a2037b18f39fe34
The first line of the input contains a single integer n (1 ≀ n ≀ 500 000)Β β€” the number of hashtags being edited now. Each of the next n lines contains exactly one hashtag of positive length. It is guaranteed that the total length of all hashtags (i.e. the total length of the string except for characters '#') won't exce...
1,800
Print the resulting hashtags in any of the optimal solutions.
standard output
PASSED
dae2dc6cf6320c614cbf59a412dc10c5
train_003.jsonl
1487930700
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to make searching for a particular topic more comfortable. For the purpose of this problem we define hashta...
256 megabytes
import java.util.Scanner; import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class TestClass implements Runnable { public static void main(String args[]) { new Thread(null, new TestClass(),"TESTCLASS",1<<26).start(); } public void r...
Java
["3\n#book\n#bigtown\n#big", "3\n#book\n#cool\n#cold", "4\n#car\n#cart\n#art\n#at", "3\n#apple\n#apple\n#fruit"]
2 seconds
["#b\n#big\n#big", "#book\n#co\n#cold", "#\n#\n#art\n#at", "#apple\n#apple\n#fruit"]
NoteWord a1, a2, ..., am of length m is lexicographically not greater than word b1, b2, ..., bk of length k, if one of two conditions hold: at first position i, such that ai ≠ bi, the character ai goes earlier in the alphabet than character bi, i.e. a has smaller character than b in the first position where they diff...
Java 8
standard input
[ "binary search", "implementation", "greedy", "strings" ]
27baf9b1241c0f8e3a2037b18f39fe34
The first line of the input contains a single integer n (1 ≀ n ≀ 500 000)Β β€” the number of hashtags being edited now. Each of the next n lines contains exactly one hashtag of positive length. It is guaranteed that the total length of all hashtags (i.e. the total length of the string except for characters '#') won't exce...
1,800
Print the resulting hashtags in any of the optimal solutions.
standard output
PASSED
1b6f09a4b1b19f3194e1a29bd849ec61
train_003.jsonl
1487930700
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to make searching for a particular topic more comfortable. For the purpose of this problem we define hashta...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); StringTokeniz...
Java
["3\n#book\n#bigtown\n#big", "3\n#book\n#cool\n#cold", "4\n#car\n#cart\n#art\n#at", "3\n#apple\n#apple\n#fruit"]
2 seconds
["#b\n#big\n#big", "#book\n#co\n#cold", "#\n#\n#art\n#at", "#apple\n#apple\n#fruit"]
NoteWord a1, a2, ..., am of length m is lexicographically not greater than word b1, b2, ..., bk of length k, if one of two conditions hold: at first position i, such that ai ≠ bi, the character ai goes earlier in the alphabet than character bi, i.e. a has smaller character than b in the first position where they diff...
Java 8
standard input
[ "binary search", "implementation", "greedy", "strings" ]
27baf9b1241c0f8e3a2037b18f39fe34
The first line of the input contains a single integer n (1 ≀ n ≀ 500 000)Β β€” the number of hashtags being edited now. Each of the next n lines contains exactly one hashtag of positive length. It is guaranteed that the total length of all hashtags (i.e. the total length of the string except for characters '#') won't exce...
1,800
Print the resulting hashtags in any of the optimal solutions.
standard output
PASSED
7bbf6b8efa8c917225a183ff80ce27ed
train_003.jsonl
1487930700
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to make searching for a particular topic more comfortable. For the purpose of this problem we define hashta...
256 megabytes
import java.util.Scanner; public class CloudOfHashtags { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String[] s = new String[n]; for(int i = 0; i < n; i++) { s[i] = sc.next(); } for(int i = n-2; i >= 0; i--) { //compare with n...
Java
["3\n#book\n#bigtown\n#big", "3\n#book\n#cool\n#cold", "4\n#car\n#cart\n#art\n#at", "3\n#apple\n#apple\n#fruit"]
2 seconds
["#b\n#big\n#big", "#book\n#co\n#cold", "#\n#\n#art\n#at", "#apple\n#apple\n#fruit"]
NoteWord a1, a2, ..., am of length m is lexicographically not greater than word b1, b2, ..., bk of length k, if one of two conditions hold: at first position i, such that ai ≠ bi, the character ai goes earlier in the alphabet than character bi, i.e. a has smaller character than b in the first position where they diff...
Java 8
standard input
[ "binary search", "implementation", "greedy", "strings" ]
27baf9b1241c0f8e3a2037b18f39fe34
The first line of the input contains a single integer n (1 ≀ n ≀ 500 000)Β β€” the number of hashtags being edited now. Each of the next n lines contains exactly one hashtag of positive length. It is guaranteed that the total length of all hashtags (i.e. the total length of the string except for characters '#') won't exce...
1,800
Print the resulting hashtags in any of the optimal solutions.
standard output
PASSED
460d1f65e168d012fd1a4b323bc65df9
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import j...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
09874de9bfa8dcde2af006d29862899c
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.*; public class ACMIND { static FastReader scan; static PrintWriter pw; static long MOD = 1_000_000_007; static long INF = 2_000_000_000_000_000_000L; static long inf = 2_000_000_000; public static void main(String[] args) { ...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
2c4a309ac4862fd2c54346147bc070b6
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.util.Scanner; public class qwerty7 { public static void qwer(int...q) { int n = q.length; int c[] = new int[n]; for(int d = 0; d<n; d++) { c[q[d]-1]++; } int we = c[0]; int as = 1; int ans =0; int qw =0; f...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
ff35a9393840422fa7b7cf1e6111d83b
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class a { static final int mod = 1000000007; public static void main (String[] args) throws java.lang.Exception { FastReader sc = new FastReader(); PrintWriter out = new PrintWriter(System.out); i...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
23411a5b7d8c0e7805d03929879aefba
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.io.*; import java.text.DecimalFormat; import java.util.*; public class B { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); int a[] = new int[n + 1]; for (int i = 0; i < n; i++) { ...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
3c32cb2406ffd14f9813fc68249d3b36
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.io.*; import java.util.*; /* * */ public class _662C implements Runnable{ public static void main(String[] args) { new Thread(null, new _662C(),"Main",1<<27).start(); } @Override public void run() { FastReader fd = new FastReader(System.in); PrintWriter out = new PrintW...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
5b7edb66f6ebe7256292a5b002647c18
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.io.*; import java.util.*; /* * */ public class _662C implements Runnable{ public static void main(String[] args) { new Thread(null, new _662C(),"Main",1<<27).start(); } @Override public void run() { FastReader fd = new FastReader(System.in); PrintWriter out = new PrintW...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
8b0d1c7b5b39d3fe4894a6630bff639a
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(),n; int a[] = new int[200005]; while( t-- != 0) { n = scan.nextInt(); int num = 0, max1 = 0; for ...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
ac9fc9c8d3586d19e2afcc1efeca7384
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br =new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); int t = Integer.parseInt(br.readLine()); for (int i = 0; i < t; i++) { ...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
627324b1923e2aae0bbf94e6ee61ba4c
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.util.*; public class Simple { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int i=0,j=0,k=0; int t=0; t=sc.nextInt(); while (t-->0) { int n=sc.nextInt(); int arr[]=new int[n+1]; for (i=0;i<n;i++) ...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
c7057278ed1ac563e112d4d096d030c7
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.util.*; import java.io.*; public class cf { public static void main(String[] args) throws IOException, InterruptedException { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); int[] arr = new int[n]; int[] freq = new int[n + 1]; for (int ...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
f898f044021d83c5d73dcdd24746f244
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class C { public static void main(String[] args) { try { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
837662c6131ccba4d85812460af5634e
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
// package Round662; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.*; public class typeC { public static void main(String[] args) { FastReader s = new FastReader(); int T = s.nextInt(); for(int t=0;t<T;t++) { in...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
51d6469f7d076c9d1e8f0cdf081f0ea7
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
// package Round662; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.*; public class typeC { public static void main(String[] args) { FastReader s = new FastReader(); int T = s.nextInt(); for(int t=0;t<T;t++) { in...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
4f8d2dd1365baf7ca4074fd6b1addb1c
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.io.*; import java.util.*; public class Main{ static void main() throws Exception{ int n=sc.nextInt(); int maxn=(int)1e5+1; int[]occ=new int[maxn]; int maxOcc=0,freq=0; for(int i=0;i<n;i++) { int x=sc.nextInt(); occ[x]++; if(occ[x]>maxOcc) { maxOcc=occ[x]; freq=1; } else { ...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
5c5896ca0f31205b4b2987e247b5bf4c
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.io.*; import java.util.*; public class Main { static BufferedReader br; static int cin() throws Exception { return Integer.valueOf(br.readLine()); } static int[] split() throws Exception { String[] cmd=br.readLine().split(" "); int[] ans=new int[cmd.length]; for(int i=0;i<cmd.length;i++) { ...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
05d0a10cf3c90aaf23cf77ce740c1527
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
// package Quarantine; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Collections; import java.util.StringTokenizer; import java.util.TreeSet; public class PinkyPatty { public static void main(String[] args)throws IOException { BufferedReader ...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
24f192a57afd5e47f124ec0f531ada60
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.io.*; import java.util.*; public class Main { static ArrayList<ArrayList<Integer>> adj=new ArrayList<ArrayList<Integer>>(); public static void main(String[] args) throws IOException { FastScanner fs=new FastScanner(); PrintWriter out = new PrintWriter(System.out); int t=1; t=fs.nextIn...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
b314d376d8945c6ce53c252a90cf1dcb
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.util.*; import java.io.*; public class PinkiePiePattyCakes { public static int MAXN = 100001; public static void main(String[] args) throws IOException{ BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(new OutputStreamWriter(...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
8556606589b498ee0d489cfdb01d07de
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.io.*; import java.util.*; public class TaskC { static class Pair { int x; int y; Pair(int a, int b) { x = a; y = b; } } public static void main(String[] args) throws Exception { Reader sc = new Reader(); PrintWriter pw = ...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
38f2890dc48750680d58b26f558a04a2
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
/** * BaZ :D */ import java.util.*; import java.io.*; import static java.lang.Math.*; public class ACMIND { static FastReader scan; static PrintWriter pw; static long MOD = 1_000_000_007; static long INF = 2_000_000_000_000_000_000L; static long inf = 2_000_000_000; public static void main(S...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
c3345575e7796389548df8edd90c7d5e
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { FastReader in = new FastReader(System.i...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
f8b8ba1f4d6de901342898083af9f23f
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import com.sun.org.apache.xpath.internal.SourceTree; import com.sun.org.apache.xpath.internal.functions.FuncFalse; import javafx.util.Pair; import java.io.*; import java.util.*; import static java.lang.Math.*; public class Contest { public static class pair implements Comparable<pair> { long l; l...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
a023358ec91181836d130fb84b81edbf
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Pr...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
f8107e1bbbf3f38d427c1c3ee818dd79
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Pr...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
0ed72f16800122743eb09e540e3a51c7
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.util.*; import java.io.*; public class C662C{ static class FastReader { BufferedReader br; StringTokenizer st; private FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.has...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
64aed858f82cc2601020247da7ef634b
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
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(); ...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
f9e7198dc41df1312ecf700f95a9c3d6
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Solution { public static void main(String[] args) { FastReader in = new FastReader(); int t = in.nextInt(); for (int x = 0; x < t; x++) { int n = in.nex...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
c461cff37a1aa9d37613cb3740eda057
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
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 code4{ static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() ...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
d46b816b6323883c9defaabe83d47db7
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; Out...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
0d0d435fddf524079dc39e7f0a096ffb
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class C { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuild...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
8f9d484b6e0b44f4c85f6804a8cce2ed
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; public class Rextester{ static boolean possible(int[] array,int dist,int n){ boolean[] result = new boolean[n]; for(int i=array.length-1;i>=0;i--){ if(array[i]==1){ return true; } int z = a...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
e6310e0f9d3e01f9021afb1fc9d6986d
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.util.*; import java.io.*; 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().trim()); StringBuffer result=new StringBuffer(); while(t-->0...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
50ca7c6557e99ad380674d63ca1e6e56
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class r662c { public static void main(String[] args) { FastScanner scan=new FastScanner(); int t=scan.nextInt(); for(int tt=0;tt<t;tt++) { int n=scan.nextInt(); int[] f=new...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
4aa3d349775dd72bd4ece19b542861aa
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.util.*; public class Solution { public static int mod=1000000007; int N; public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int a=1;a<=t;a++) { int n=sc.nextInt(); int arr[]=new int[n]; int max=0; int maxCount=0; Map<Integer,Int...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
90dfd182919673c14d048996adcda044
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
//package codeforces.div2; import java.util.*; public class PinkiePieEatsPattyCakes { static public class Custom { int val; int count; public Custom(int val, int count) { this.val = val; this.count = count; } public int getVal() { retu...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
4d5baf76bd5fdb2f4d4a87525fd9661d
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Main { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); StringTokenizer tokenizer=null; public static void main(String[] args) throws IOException { new Main().execute(); } void debug(Object.....
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
77f7a197a7d9392243762bc56d5163a6
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
// Main Code at the Bottom import java.util.*; import java.lang.*; import java.io.*; import java.math.BigInteger; public class Main{ //Fast IO class static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { boolean env=System.getProperty("ONLINE_JUDG...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
aec3a8b3ef3b8894f2e400e1dc69c11e
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
// Main Code at the Bottom import java.util.*; import java.lang.*; import java.io.*; import java.math.BigInteger; public class Main{ //Fast IO class static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { boolean env=System.getProperty("ONLINE_JUDG...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
9e6407c4669d1065c8db5ffbe501d546
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.util.HashMap; import java.util.Map; import java.util.Scanner; import java.util.Set; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); for (int i=0;i<T;i++){ int n = sc.nextInt(); int[...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
9b004001fb0b8fb69b16f7eeb248966a
train_003.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[])throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw=new PrintWriter(System.out); int t=Integer.parseInt(br.readLine()); int mx=(in...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
616048ee5bf783533103554c375defc9
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
//package HackerEarthA; import java.io.*; import java.util.*; import java.util.Map.Entry; import java.text.*; import java.math.*; import java.util.regex.*; import javafx.scene.layout.Priority; import java.awt.Point; /** * * @author prabhat // use stringbuilder, priorityQueue */ public class easy18{ public st...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
89873c7729edbc6dd8d92e760779c479
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] line = br.readLine().split(" ")...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
b07a9a5a767944914e247871807b7712
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
import java.util.ArrayList; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Queue; import java.util.Scanner; import java.util.Set; import java.util.stream.Collectors; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); i...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
8970bff4c2a5ad3d8712ccd3a2a487b0
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { FastScanner in = new FastScanner(); PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out), true); int numApps = in.nextInt(); int numEvents = in.nextInt(); int unreadNotifications = 0; ...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
63a67e2b36a7234ff22bfc4be52d56ed
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
import java.io.*; import java.util.*; public class A { @SuppressWarnings("unchecked") public static void solution(BufferedReader reader, PrintWriter out) throws IOException { In in = new In(reader); int n = in.nextInt(), q = in.nextInt(); LinkedList<Integer>[] notif = new Li...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
7ee9bbebd464c56e7744184190a5298d
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; import java.math.MathContext; import java.text.DecimalFormat; import java.text.Format; import static java.lang.Math.*; import static java.util.Arrays.*; import static java.util.Collections.*; import java.awt.List; public class Main { public stati...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
e86ebea211c28cfb66acec8feef96a41
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
import java.io.*; import java.util.*; public class Testes { static BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); static BufferedWriter output = new BufferedWriter(new OutputStreamWriter(System.out)); static class Notification { boolean beenRead =...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
dadf028674800b6b01c5be824901a935
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; import java.security.KeyStore.Entry; public class Q2 { static ArrayList<Integer> adj[]; static int color[],red[],black[],previs[]; static boolean b[],visited[],possible; static Map<Long,Long> dict; static int totalnodes,colored,time,v[],l[],r[]; //stat...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
2fbc0b9996d103e99b604a4329f2ee64
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.TreeSet; public class temp1 { public static class MyScanner { BufferedReader bf; StringTokenizer st; MyScanner() { bf = new BufferedRea...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
f03bbef9719b4c1b9a999be873e88b41
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
import java.io.File; import java.util.LinkedList; import java.util.Scanner; import java.util.StringTokenizer; import java.util.TreeSet; public class p011 { public static void main(String args[]) throws Exception { StringTokenizer stok = new StringTokenizer(new Scanner(System.in).useDelimiter("\\A").next()); Strin...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
09dae359db294f07a708c8036c8cad07
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
import java.util.*; public class SlideWindow1 { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int q = sc.nextInt(); int mark[] = new int[q+1]; Queue<Integer>[] apps = new Queue[n]; StringBuilder sb = new StringBuilder(); for(int i=0; i<n; i++) { ap...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
f5b54fbd1f21fb4a3da9f9f9336cb621
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
import java.util.*; import java.io.*; public class Main { static class IntegerPair { Integer first; Integer second; IntegerPair(Integer f, Integer s) { first = f; second = s; } } private static InputReader br = new InputReader(System.in); privat...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
0ddb301c7fa6a7fbaa8d1410c9fc4487
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; import java.util.stream.*; @SuppressWarnings("unchecked") public class P704A { class Event { int idx, x; Event prev, next, prevX, nextX; public Event(int idx, int x) { this.idx = idx; this.x = x; } } ...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
8e70096f951ca2c81987ad07ecbf4f3b
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
import org.omg.PortableInterceptor.INACTIVE; import java.io.*; import java.util.*; public class Solution{ class LazyPropSegmentTree { int[] tree, lazy, orig; int len; LazyPropSegmentTree(int n) { len = n * 33; tree = new int[len]; lazy = new int[len]; } /** ...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
bf1f1496d20906fed4bc4f983bf2b51a
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
import java.util.*; import java.io.*; public class A { public static void main(String ar[]) throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String s1[]=br.readLine().split(" "); int n=Integer.parseInt(s1[0]); int m=In...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
7088dbe9ff594ed187784fa48f681ad5
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
import java.util.*; import java.io.*; public class A { public static void main(String ar[]) throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String s1[]=br.readLine().split(" "); int n=Integer.parseInt(s1[0]); int t=In...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
f1e7dbf7599670ee4841132ecafee644
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
/** https://codeforces.com/problemset/problem/704/A * idea: just use queue */ import java.util.Deque; import java.util.LinkedList; import java.util.StringTokenizer; import java.io.IOException; import java.io.InputStream; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.*; public clas...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
4969bf0fea67349d37ac5001f59b2ab5
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
import java.io.*; import java.util.*; import java.util.function.*; public class Main{ int N; int Q; HashMap<Integer, ArrayDeque<Integer>> count; public void solve(){ N = nextInt(); Q = nextInt(); count = new HashMap<>(); int[] note = new int[Q]; int ni = 0; int max = 0; int ans = 0; for(int i = 0;...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
50774d8fde3649fd86416d4540ef0614
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.ArrayList; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Rene */ public class Main { public ...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
e5f586c26ddcddbf21346609d74a2288
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
import java.util.*; import java.io.*; @SuppressWarnings("unchecked") public class CF_A { static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static void newST() throws IOException {st = new StringTokenizer(in.readLine());} static int stInt() {return Integer.p...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
f9f168045006bd6737055e5f09daa87d
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.Arr...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
e70a9e2e8f2fef25f1dc132b8b239afc
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
import java.awt.Point; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Comparator; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Scanner; import java.util.Set; import java.util.TreeSet; public class Flab { // author...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
850c232cf19e1da0304dde161914e236
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
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.Iterator; import java.util.LinkedHashSet; public class Main { public static void main(String[] args) throws Exception { BufferedReader in = ...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
7b8a213998eb842401a078de1eea6d6a
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.InputStream; ...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
25b533329ba36bdabcd09cdc6a49c094
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Arrays; import java.io.IOException; import java.io.UncheckedIOException; import java.io.Closeable; import java.io.Writer; import java.io.OutputStreamWriter; import java.io.InputStream; /**...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
96a22c4417519f4fc1503e80145032a8
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.BitSet; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.InputMismatchException; impor...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
e8f0e26b92ed506b7ba753fa8d6d5a76
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
import java.awt.geom.*; import java.io.*; import java.math.*; import java.text.*; import java.util.*; import java.util.regex.*; /* br = new BufferedReader(new FileReader("input.txt")); pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt"))); br = new BufferedReader(new InputStreamReader(Sys...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
24a647148cee6a5041e64dbf497c3c6f
train_003.jsonl
1470578700
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't).q events are about ...
256 megabytes
import java.awt.geom.*; import java.io.*; import java.math.*; import java.text.*; import java.util.*; import java.util.regex.*; /* br = new BufferedReader(new FileReader("input.txt")); pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt"))); br = new BufferedReader(new InputStreamReader(Sys...
Java
["3 4\n1 3\n1 1\n1 2\n2 3", "4 6\n1 2\n1 4\n1 2\n3 3\n1 3\n1 3"]
2 seconds
["1\n2\n3\n2", "1\n2\n3\n0\n1\n2"]
NoteIn the first sample: Application 3 generates a notification (there is 1 unread notification). Application 1 generates a notification (there are 2 unread notifications). Application 2 generates a notification (there are 3 unread notifications). Thor reads the notification generated by application 3, there are 2 ...
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
a5e724081ad84f88813bb4de23a8230e
The first line of input contains two integers n and q (1 ≀ n, q ≀ 300 000)Β β€” the number of applications and the number of events to happen. The next q lines contain the events. The i-th of these lines starts with an integer typeiΒ β€” type of the i-th event. If typei = 1 or typei = 2 then it is followed by an integer xi. ...
1,600
Print the number of unread notifications after each event.
standard output
PASSED
4e0c86fe7c45fd685e7d64736e00cc4a
train_003.jsonl
1314633600
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.One day Petya encountered a tree with n vertexes. Besides, the tree was weighted, i. e. each edge of t...
256 megabytes
import java.util.Arrays; import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; /** * Built using CHelper plug-in * Actual solution is at the top */ public cla...
Java
["4\n1 2 4\n3 1 2\n1 4 7", "4\n1 2 4\n1 3 47\n1 4 7447"]
2 seconds
["16", "24"]
NoteThe 16 triples of vertexes from the first sample are: (1, 2, 4), (1, 4, 2), (2, 1, 3), (2, 1, 4), (2, 3, 1), (2, 3, 4), (2, 4, 1), (2, 4, 3), (3, 2, 4), (3, 4, 2), (4, 1, 2), (4, 1, 3), (4, 2, 1), (4, 2, 3), (4, 3, 1), (4, 3, 2).In the second sample all the triples should be counted: 4Β·3Β·2 = 24.
Java 8
standard input
[ "combinatorics", "dfs and similar", "trees" ]
6992db71923a01211b5073ee0f8a193a
The first line contains the single integer n (1 ≀ n ≀ 105) β€” the number of tree vertexes. Next n - 1 lines contain three integers each: ui vi wi (1 ≀ ui, vi ≀ n, 1 ≀ wi ≀ 109) β€” the pair of vertexes connected by the edge and the edge's weight.
1,900
On the single line print the single number β€” the answer. Please do not use the %lld specificator to read or write 64-bit numbers in Π‘++. It is recommended to use the cin, cout streams or the %I64d specificator.
standard output
PASSED
c050e2f319044250c6e7d14a4642a288
train_003.jsonl
1314633600
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.One day Petya encountered a tree with n vertexes. Besides, the tree was weighted, i. e. each edge of t...
256 megabytes
import java.util.ArrayList; import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; /** * Built using CHelper plug-in * Actual solution is at the top */ public ...
Java
["4\n1 2 4\n3 1 2\n1 4 7", "4\n1 2 4\n1 3 47\n1 4 7447"]
2 seconds
["16", "24"]
NoteThe 16 triples of vertexes from the first sample are: (1, 2, 4), (1, 4, 2), (2, 1, 3), (2, 1, 4), (2, 3, 1), (2, 3, 4), (2, 4, 1), (2, 4, 3), (3, 2, 4), (3, 4, 2), (4, 1, 2), (4, 1, 3), (4, 2, 1), (4, 2, 3), (4, 3, 1), (4, 3, 2).In the second sample all the triples should be counted: 4Β·3Β·2 = 24.
Java 8
standard input
[ "combinatorics", "dfs and similar", "trees" ]
6992db71923a01211b5073ee0f8a193a
The first line contains the single integer n (1 ≀ n ≀ 105) β€” the number of tree vertexes. Next n - 1 lines contain three integers each: ui vi wi (1 ≀ ui, vi ≀ n, 1 ≀ wi ≀ 109) β€” the pair of vertexes connected by the edge and the edge's weight.
1,900
On the single line print the single number β€” the answer. Please do not use the %lld specificator to read or write 64-bit numbers in Π‘++. It is recommended to use the cin, cout streams or the %I64d specificator.
standard output
PASSED
4ee55875547a1f603ab388ee2433c64d
train_003.jsonl
1314633600
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.One day Petya encountered a tree with n vertexes. Besides, the tree was weighted, i. e. each edge of t...
256 megabytes
import java.awt.Point; 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.Collections; import java.util.HashSet; import java.util.StringTokenizer; import java.util.TreeSet; public ...
Java
["4\n1 2 4\n3 1 2\n1 4 7", "4\n1 2 4\n1 3 47\n1 4 7447"]
2 seconds
["16", "24"]
NoteThe 16 triples of vertexes from the first sample are: (1, 2, 4), (1, 4, 2), (2, 1, 3), (2, 1, 4), (2, 3, 1), (2, 3, 4), (2, 4, 1), (2, 4, 3), (3, 2, 4), (3, 4, 2), (4, 1, 2), (4, 1, 3), (4, 2, 1), (4, 2, 3), (4, 3, 1), (4, 3, 2).In the second sample all the triples should be counted: 4Β·3Β·2 = 24.
Java 8
standard input
[ "combinatorics", "dfs and similar", "trees" ]
6992db71923a01211b5073ee0f8a193a
The first line contains the single integer n (1 ≀ n ≀ 105) β€” the number of tree vertexes. Next n - 1 lines contain three integers each: ui vi wi (1 ≀ ui, vi ≀ n, 1 ≀ wi ≀ 109) β€” the pair of vertexes connected by the edge and the edge's weight.
1,900
On the single line print the single number β€” the answer. Please do not use the %lld specificator to read or write 64-bit numbers in Π‘++. It is recommended to use the cin, cout streams or the %I64d specificator.
standard output
PASSED
54be9f9580206a74e7de6ba271343953
train_003.jsonl
1314633600
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.One day Petya encountered a tree with n vertexes. Besides, the tree was weighted, i. e. each edge of t...
256 megabytes
import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class P110E { public static void main(String[] args) { Scanner inScanner = new Scanner(System.in); int n = inScanner.nextInt(); Node[] nodes = new Node[n]; for (int i = 0; i < n; i++) nodes...
Java
["4\n1 2 4\n3 1 2\n1 4 7", "4\n1 2 4\n1 3 47\n1 4 7447"]
2 seconds
["16", "24"]
NoteThe 16 triples of vertexes from the first sample are: (1, 2, 4), (1, 4, 2), (2, 1, 3), (2, 1, 4), (2, 3, 1), (2, 3, 4), (2, 4, 1), (2, 4, 3), (3, 2, 4), (3, 4, 2), (4, 1, 2), (4, 1, 3), (4, 2, 1), (4, 2, 3), (4, 3, 1), (4, 3, 2).In the second sample all the triples should be counted: 4Β·3Β·2 = 24.
Java 6
standard input
[ "combinatorics", "dfs and similar", "trees" ]
6992db71923a01211b5073ee0f8a193a
The first line contains the single integer n (1 ≀ n ≀ 105) β€” the number of tree vertexes. Next n - 1 lines contain three integers each: ui vi wi (1 ≀ ui, vi ≀ n, 1 ≀ wi ≀ 109) β€” the pair of vertexes connected by the edge and the edge's weight.
1,900
On the single line print the single number β€” the answer. Please do not use the %lld specificator to read or write 64-bit numbers in Π‘++. It is recommended to use the cin, cout streams or the %I64d specificator.
standard output