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
332e5802de65de3ec03ea45790419170
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; // @author : Dinosparton public class test { static class Pair{ long x; long y; Pair(long x,long y){ this.x = x; this.y = y; } } static class Triplet{ long...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
4e87d681a921a36314c9ee68732d78a5
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
import java.io.*; import java.util.*; public class Main { private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private FastWriter wr; private Reader rd; public final int MOD = 1000000007; /************************************************** FAST INPUT IMPLEMENTATION ***********...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
b26d35b4bd99afa128df9f7ea1dcbb80
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
import java.io.*; import java.util.*; public class D { public static void main (String[] args) throws IOException { Kattio io = new Kattio(); int t = io.nextInt(); outer: for (int ii=0; ii<t; ii++) { int n = io.nextInt(); int[] arr = new int[n]; for (int i=0; i<n; i++) { arr[i] = io.nextInt(); }...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
98c774589572c7b2ebb35d21e2140ddd
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
import java.io.*; import java.util.*; public class B { static long TIME_START, TIME_END; public static class Task { public void solve(Scanner sc, PrintWriter pw) throws IOException { int n = sc.nextInt(); int[] arr = new int[n]; for (int i = 0; i < n; i++) arr[i] = sc.nextInt(); in...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
d6ad2a2244291e92f1db5715f76dbe94
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
//package MyPackage; import java.util.*; import java.io.*; public class A{ static class FastReader{ BufferedReader br; StringTokenizer st; public FastReader(){ br=new BufferedReader(new InputStreamReader(System.in)); } String next(){ whi...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
0326efc639e36bd15837743271bd9032
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
import java.io.*;import java.lang.*;import java.util.*; //* --> number of prime numbers less then or equal to x are --> x/ln(x) //* --> String concatenation using the + operator within a loop should be avoided. Since the String object is immutable, each call for concatenation will // result in a new String object ...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
519debe1da06d6341089b78ea43c87f0
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Main { static BufferedReader br; static PrintWriter out; static StringTokenizer st; public static void main (String[] args) throws java.lang.Exception { ...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
0abd21202089d401fd8c7f24024c64ca
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import java.lang.*; public class Solution{ static int mod=(int)1e9+7; static int mod1=998244353; static FastScanner sc = new FastScanner(); public static void solve(){ int n=sc.nextInt(); ...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
d35337ed59d40ca443b1a1b92a6e6102
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
import java.io.BufferedReader; import java.math.BigInteger; import java.util.*; import static java.lang.System.out; // Name: Tastan Yernar && Email: 210103376@stu.sdu.edu.kz// public class Round_780_Div_3 { static Scanner str = new Scanner(System.in); static ArrayList<Integer> list; final int mod = ...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
85a5b8acdc5836423bee76f321532cdb
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
import java.util.*; import java.io.*; public class A{ public static void main(String[] args) throws IOException,NumberFormatException{ try { FastScanner sc=new FastScanner(); PrintWriter out=new PrintWriter(System.out); int t=sc.nextInt(); outer:while(t-->0) { int n=sc.nextInt(...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
f770c0585fbe73a0020f4cbf38954d2c
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class ABCSort { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); pls: while (t-- > 0) { int n = sc.nextInt(); int[] a = new int[n]; ...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
1b923d037d9ec5c8728fb747030d47fc
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
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 Main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new Buf...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
3e919edbfb32b4994f49066928d05080
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
import java.util.*; import java.io.*; public class Main { static FastReader in=new FastReader(); static final Random random=new Random(); static long mod=1000000007L; static HashMap<String,Integer>map=new HashMap<>(); public static void main(String args[]) throws IOException { int...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
56f4ef3e84569ef487e6155581a78ae2
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
/* AUTHOR-> HARSHIT AGGARWAL CODEFORCES HANDLE-> @harshit_agg FROM-> MAHARAJA AGRASEN INSTITUE OF TECHNOLOGY >> YOU CAN DO THIS << */ import java.util.*; import java.io.*; public class ABCsort { public static void main(String[] args) throws Exception { int t = scn.nextInt(); while (t-- ...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
fb8c121ea03195512cbe48a0898a76be
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
import java.io.*; import java.util.Arrays; public class CodeJam { public static void main(String[] args) throws IOException{ // TODO Auto-generated method stub BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); while(t-- > 0) { ...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
ec22181dcda00be0a6c2c86187530ce0
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
/* Rating: 1378 Date: 02-05-2022 Time: 20-34-35 Author: Kartik Papney Linkedin: https://www.linkedin.com/in/kartik-papney-4951161a6/ Leetcode: https://leetcode.com/kartikpapney/ Codechef: https://www.codechef.com/users/kartikpapney ----------------------------Jai Shree Ram---------...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
f9855accceb3b69a2b6fd3b59e99a05b
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
import java.lang.*; import java.io.*; import java.util.*; public class codeforces { static int max = Integer.MAX_VALUE, min = Integer.MIN_VALUE; long maxl = Long.MAX_VALUE, minl = Long.MIN_VALUE; static PrintWriter pw = new PrintWriter(System.out); static StringBuilder sb = new StringBuilder();...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
3b9f2801969b4fabe3909ec8dce2cdf0
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
import java.io.*; import java.util.*; import java.io.IOException; import java.io.InputStream; public class Main { public static void main(String[] args) throws FileNotFoundException { InputStream inputStream = System.in; OutputStream outputStream = System.out; // inputStream = new F...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
7a15971e0913fd196bfce3743e772bd8
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
/*----------- ---------------* Author : Ryan Ranaut __Hope is a big word, never lose it__ ------------- --------------*/ import java.io.*; import java.util.*; public class Codeforces1 { static PrintWriter out ...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
cfa17df13de34406ce96f4d1382c9bb0
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[]) throws IOException{ BufferedReader bf=new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw=new PrintWriter(System.out); Scanner sc=new Scanner(System.in); int n=sc....
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
0257f372d9228675f93a5d423497e6c3
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
//some updates in import stuff import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import java.util.*; import java.io.*; import java.math.*; //key points learned //max space ever that could be alloted in a program to pass in cf //int[][] prefixSum = new int[...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
2886815e4301ec46956f7d8b690d2e59
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
import java.util.*; import java.io.*; import java.time.*; import static java.lang.Math.*; @SuppressWarnings("unused") public class D { static boolean DEBUG = false; static Reader fs; static PrintWriter pw; static void solve() { int n = fs.nextInt(); int a[] = fs.readArray(n); int b[...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
67d3fade087427738d61110544255052
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
import java.io.*; import java.util.*; import java.util.concurrent.ThreadLocalRandom; public class D { //java -Xss515m Solution.java < input.txt private static final String SPACE = "\\s+"; private static final int MOD = 1_000_000_007; private static final Reader in = new Reader(); publi...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
43e33c86ed8afcb72764a1db88161ae4
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
import java.io.*; import java.util.*; import java.util.concurrent.ThreadLocalRandom; import java.math.*; /** _ _ ( _) ( _) / / \\ / /\_\_ / / \\ / / | \ \ / / \\ / / |\ \ \ / / , \ , / / /| \ \ / / |\_ /| /...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
9e40a750c48d6ed6ab42ef590ee99c46
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
import java.util.*; public class MergeSort { static int[][] moveInEight = {{1, 1}, {1, 0}, {1, -1}, {0, 1}, {-1, 1}, {0, -1}, {-1, -1}, {-1, 0}}; static int[][] moveInFour = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}}; public static void main(String[] args) throws java.lang.Exception { Scanner sc ...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
48cf163636ab126827e8d9e43c1cb0fb
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
import java.util.*; public class Problem1674D { public static void main(String[] args) { var sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { boolean flag = true; int n = sc.nextInt(); int[] a = new int[n]; for (int...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
b9b45699e6c16c1e485aa66baf6e5744
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; import java.util.*; import java.io.UncheckedIOException; import java.io.Closeable; import java.io.Writer; import java.io.OutputStreamWriter; /* @au...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
56d9bafe2b403aeb1e59a8c256d9a996
train_107.jsonl
1651502100
You are given three arrays $$$a$$$, $$$b$$$ and $$$c$$$. Initially, array $$$a$$$ consists of $$$n$$$ elements, arrays $$$b$$$ and $$$c$$$ are empty.You are performing the following algorithm that consists of two steps: Step $$$1$$$: while $$$a$$$ is not empty, you take the last element from $$$a$$$ and move it in th...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class pb2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0){ int n = sc.nextInt(); int[] arr = new int[n]; int[] c = ne...
Java
["3\n\n4\n\n3 1 5 3\n\n3\n\n3 2 1\n\n1\n\n7331"]
2 seconds
["YES\nNO\nYES"]
NoteIn the first test case, we can do the following for $$$a = [3, 1, 5, 3]$$$:Step $$$1$$$: $$$a$$$$$$[3, 1, 5, 3]$$$$$$\Rightarrow$$$$$$[3, 1, 5]$$$$$$\Rightarrow$$$$$$[3, 1]$$$$$$\Rightarrow$$$$$$[3]$$$$$$\Rightarrow$$$$$$[]$$$$$$b$$$$$$[]$$$$$$[\underline{3}]$$$$$$[3, \underline{5}]$$$$$$[3, \underline{1}, 5]$$$$$$...
Java 11
standard input
[ "constructive algorithms", "implementation", "sortings" ]
95b35c53028ed0565684713a93910860
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Next $$$t$$$ cases follow. The first line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$...
1,200
For each test, print YES (case-insensitive), if you can make array $$$c$$$ sorted in non-decreasing order. Otherwise, print NO (case-insensitive).
standard output
PASSED
baeb54c80a8f8f873d6f35125ad5c310
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.*; import java.util.*; public class DesktopRearrangement { private static final char ICON = '*'; private static final char EMPTY = '.'; public static void solve(FastIO io) { final int N = io.nextInt(); final int M = io.nextInt(); final int Q = io.nextInt(); IntFenwickTreeRangeS...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
0eb8306c40dca82d3910426f459a2ba6
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class DesktopRearrangement { private static final char ICON = '*'; private static final char EMPTY = '.'; public static void solve(FastIO io) { final int N = io.nextInt(); final int M = io.nextInt(); final int Q = io.nextInt(); ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
37f65184368e567e03512270caf01a07
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class DesktopRearrangement { private static final char ICON = '*'; private static final char EMPTY = '.'; public static void solve(FastIO io) { final int N = io.nextInt(); final int M = io.nextInt(); final int Q = io.nextInt(); ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
3149b15ceef70ea567534e786025a484
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class DesktopRearrangement { private static final char ICON = '*'; private static final char EMPTY = '.'; public static void solve(FastIO io) { final int N = io.nextInt(); final int M = io.nextInt(); final int Q = io.nextInt(); ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
7c78d9765e996cf563208c2f7b84c70c
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.util.*; public class ACM { private static int pre = 0, icon = 0; private static int rows, cols; private static char[][] desktop; public static void main(String[] args) { Scanner in = new Scanner(System.in); rows = in.nextInt(); cols = in.next...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
b474f8b1a01641e79f0319a65da48e8c
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class A { public static void main(String[] args) { FastScanner sc = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int n = s...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
fae8b2db1d12fd08b8252775bf4a0cae
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import static java.lang.System.out; import java.util.*; import java.io.*; import java.math.*; public class HelloWorld{ public static void main(String []args) throws Exception { BufferedR...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
2341f2d5e3601890624a14603d608597
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import static java.lang.System.out; import java.util.*; import java.io.*; import java.math.*; public class HelloWorld{ static int[] arr; //static int[] tr; public static void main(String []args) throws...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
8e104ffe15fb5d36dfc1d6ded16928dc
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import static java.lang.System.out; import java.util.*; import java.io.*; import java.math.*; public class HelloWorld{ static int[] arr; static int[] tr; public static void main(String []args) throws E...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
6f31d345f6ba4e4e098484212461ccd4
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
/** * help code : https://www.geeksforgeeks.org/segment-tree-efficient-implementation/ * * @author vivek * programming is thinking, not typing */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import jav...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
d98610c10f829a73cbb1ab18f6e47a8f
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import static java.lang.Math.*; import java.util.*; import java.io.*; public class x1674F { public static void main(String args[]) throws Exception { BufferedReader infile = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(infile.readLine()); ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
afe144c484e5a89758a91019eb3359ea
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.*; import java.util.*; public class Main { static class SegmentTree { int bound; int[] a; int[] f; public SegmentTree(int bound){ this.bound = bound; a = new int[bound+1]; f = new int[4*bound+1]; } ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
dc0d0ff144482c7c273b4a7ca3e56b38
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.util.Scanner; public class Solution { public static void print(char[] arr) { for(char c: arr) { System.out.print(c + " "); } System.out.println(); } public static void main(String args[]) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int m = scan.nextIn...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
b9812cfaa24dd5ee6a57afeaed920f36
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.*; import java.util.*; public class F_Desktop_Rearrangement { public static void main(String[] args) { FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); // try { // out = new PrintWriter("output.txt"); // } catch (Ex...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
0ad44ae20293ba4a1ced150ef90eba0f
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.*; import java.util.*; public final class Main { //int 2e9 - long 9e18 static PrintWriter out = new PrintWriter(System.out); static FastReader in = new FastReader(); static Pair[] moves = new Pair[]{new Pair(-1, 0), new Pair(0, 1), new Pair(1, 0), new Pair(0, -1)}; static...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
f6a75bfb17a38fe59fbb4cda88332a69
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.util.*; public class Main { public static final int MAXN = 1000; public static final int COMPONENT_SIZE = (int) (Math.sqrt(MAXN * MAXN) + 10); public static int fastResult[] = new int[COMPONENT_SIZE]; public static int slowResult[] = new int[MAXN * MAXN]; ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
856695785b6db29a642461c6ab1db3ab
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.util.*; public class Main { public static boolean[][] a = new boolean[1000 + 10][1000 + 10]; public static int[][] t = new int[1000 + 10][1000 + 10]; public static int sum(int x, int y) { int result = 0; for (int i = x; i >= 0; i = (i & (i + 1)) - 1) for ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
c0bf813023e6ac75ad63a7ecfe7efc5f
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.util.*; import java.io.*; import java.lang.reflect.Array; public class tr0 { static PrintWriter out; static StringBuilder sb; static long mod = (long) 1e9 + 7; static long inf = (long) 1e16; static ArrayList<Integer>[] ad, ad1; static int[][] remove, add; static long[] inv, f, ncr[]; ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
d115e3b00a152817abde49a6e99ace0b
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.*; import java.util.*; import java.util.function.DoubleToLongFunction; public class Codeforces786{ static long mod = 1000000007L; static MyScanner sc = new MyScanner(); static void solve() { int x = sc.nextInt(); int y = sc.nextInt(); if(y%x!=0){ ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
397f150c1954d11d1125dee92ff0c67d
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
//package codeforce.div3.r786; // import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.uti...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
e38d705d5630e931cd219f09f602418d
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
//package codeforce.div3.r786; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util....
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
4b304685512a8dd1e144047293a23bee
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static Scanner sc = new Scanner(System.in); public static PrintWriter pw = new PrintWriter(System.out); public static void main(String[] args) { solve(); pw.flush(); } st...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
dbbcfe04ee46c4a8534658011dfe75a4
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.util.Scanner; public class F { public static void main(String[] args) { new F().solve(); } public void solve() { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int m = scanner.nextInt(); int q = scanner.nextInt(); boolean[][] flag = new boolean[n][m]; ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
0c37304187a61c58c8186388b37517d6
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.*; public class CF1{ public static void main(String[] args) { FastScanner sc=new FastScanner(); // int T=sc.nextInt(); int T=1; for (i...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
9518087448ce77b536f35d5c70182546
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main { static int t; static int n, m; static int[] a; static String s; static FastReader fr = new FastReader(); static PrintWri...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
bad0a0e69085f0b25cfd097fde785f54
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.*; import java.util.*; public class Main { //--------------------------INPUT READER---------------------------------// static class fs { public BufferedReader br; StringTokenizer st = new StringTokenizer(""); public fs() { this(System.in); } public fs(I...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
4b106d6caecc2f22d73e6bf4e6c13b94
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.util.*; // import java.lang.invoke.ConstantBootstraps; // import java.math.BigInteger; // import java.beans.IndexedPropertyChangeEvent; import java.io.*; @SuppressWarnings("unchecked") public class Main implements Runnable { static FastReader in; static PrintWriter out; static int b...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
7813632b2c461362eb00b55b4568f1e2
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.StringTokenizer; public class DesktopRearrangement { static int mod = 1000000007; public static void main(String[] args) throws IOException { FastReader reader = new FastReader(); FastWriter writer = new FastWriter()...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
20f8a26611addbc9c108757e65e04c86
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
//package kg.my_algorithms.Codeforces; /* 1) If you can't Calculate, then Stimulate 2) Don't show it unless you find it */ import java.util.*; import java.io.*; public class Solution { public static void main(String[] args) throws IOException { FastReader fr = new FastReader(); ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
55ebbe17cf6d0ae9246edcd2065cf165
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
//https://codeforces.com/contest/1674/problem/F //Evan Billingsley 6/21/22 import java.io.*; import java.util.*; import java.util.StringTokenizer; public class Desktop implements Runnable { public static void main(String [] args) { new Thread(null, new Desktop(), "whatever", 1<<26).start(); } ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
e80d0d0efbe23e61ae3c7d1e3cc63a94
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.util.*; import java.io.*; public class codeforces1674F { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int n = Integer.parseInt(s...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
797531cb9ff8286f51e59f46fbf96b18
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.util.*; public class DesktopRearrangment { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); int q = in.nextInt(); String[] a = new String[n]; for (int i=0; i<n; i++){ ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
ef0f4f26ed8a23969120788b7aa57d1c
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.text.DecimalFormat; import java.util.*; public class Codeforces { static long mod= 10000_0000_7; static int dp[]; static int fake[]; static int in[]; static List<I...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
cc54d412e349a441d5d8da2127bde875
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Priorit...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
4b6600c70f6ee05ed3e4d74140e1c0eb
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.*; import java.util.*; //import org.graalvm.compiler.core.common.Fields.ObjectTransformer; import java.math.*; import java.math.BigInteger; public final class A { static PrintWriter out = new PrintWriter(System.out); static StringBuilder ans=new StringBuilder(); static FastReader...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
13cd951840bb1ee55ac8afc2c5a47b9f
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int m=sc.nextInt(); int q=sc.nextInt(); char[][] map=new char[n+1][m+1]; boolean[][] flag=new boolean[n+1][m+1]; int cnt=...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
4dff11371ac692523876e1391058c7e8
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int m=sc.nextInt(); int q=sc.nextInt(); char[][] map=new char[n+1][m+1]; boolean[][] flag=new boolean[n+1][m+1]; ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
23149d9af840bb94f02b2c08e09f8785
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class F { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int q = sc.nextInt(); char[] arr = new char[n * m]; int totalCoun...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
44b0010ea4ad013bef4ca1e2a5f6f150
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args) { Scanner in = new Scanner(System.in); int row = in.nextInt(); int col = in.nextInt(); int n = in.nextInt(); int[] sTree = new int[row * col * 4]; int limit = limit(row * col...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
556719eb6eeefedcf05c09f308569ac3
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import javax.swing.*; import java.lang.reflect.Array; import java.text.DecimalFormat; import java.util.*; import java.lang.*; import java.io.*; import java.math.*; import java.util.stream.Stream; // Please name your class Main public class Main { static FastScanner fs=new FastScanner(); ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
8a4fca3a137cef6c82b1abd6436a7b46
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.*; import java.util.*; public class Main { static int R, C, Q, N, bit[]; static void update(int i, int k) { for(;i<=N; i+=-i&i) bit[i] += k; } static int sum(int i) { int ret = 0; for(; i>0; i-=-i&i) ret += bit[i]; return ret; } public static void main(String[] args) thr...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
6dbc51adb2b434dce308658ea7d6bc76
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import java.util.*; import java.io.*; import java.math.*; /** * * @Har_Har_Mahadev */ /** * Main , Solution , Remove Public */ public class F { public static void process() throws IOException ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
892f69a8fd0f3f75b780d5318ab80f10
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
//package codeforces.round786div3; import java.io.*; import java.util.*; import static java.lang.Math.*; public class F { static InputReader in; static PrintWriter out; public static void main(String[] args) { //initReaderPrinter(true); initReaderPrinter(false); //solve(in.nextIn...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
0c41c6bcd9369ef824996905371cd695
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.Random; import java.util.StringTokenizer; public class Main { public static int n, m, q, in, tot; public static char[][] s; public static int[] get(int count) { int j = count / n, i = count % n; return new int[]{i, j}; ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
3cdbcf425d24c13bbd4700bcb9e7ab8b
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.*; import java.util.*; public class CodeForces { /*-------------------------------------------EDITING CODE STARTS HERE-------------------------------------------*/ public static void solve(int tCase) throws IOException { int n = sc.nextInt(); int m = sc.nextInt(); int q ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
dae6782ee45ac7be4ef7006b57f73896
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.*; import java.util.*; public class Main{ static void main() throws Exception{ int n=sc.nextInt(),m=sc.nextInt(),q=sc.nextInt(); int[]in=new int[n*m]; for(int i=0;i<n;i++){ char[]x=sc.nextLine().toCharArray(); for(int j=0;j<m;j++){ ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
d7b2fb56a7650c69a351122cf5bbbf86
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.util.*; import java.io.*; public class Main { static long mod=(long)1e18+7; static long[]fac=new long[1002]; static int n, x=0,me,op; static int[]pe,a,aa, prime=new int[(int)1e7+1]; static int[][]perm; static long[][]memo; static Integer[]ps; static TreeSet<Long>p=new TreeSet<Long>(); ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
713ee4240bc80ae7e4f90f97927d2003
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import javax.swing.*; import java.lang.reflect.Array; import java.text.DecimalFormat; import java.util.*; import java.lang.*; import java.io.*; import java.math.*; import java.util.stream.Stream; // Please name your class Main public class Main { static FastScanner fs=new FastScanner(); ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
70670754c66476d48b316c07ab6e4027
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.Comparator; import java.util.StringTokenizer; public class F { static FastScanner sc = new FastScanner(System.in); static FastPrintStream out = new FastPrintStream(System.out); public static void main(String[] args) { int...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 8
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
d7b168de16985d34b25ae331a9e704ad
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.sql.Array; import java.util.*; import java.io.*; import java.math.BigInteger; public class Main { public static FastReader cin; public static PrintWriter out; public static void main(String[] args) throws Exception { out = new PrintWriter(new BufferedOutputStream(System.out)); ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 17
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
63c30b5c1387c97ce5ad0347bb3a7028
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.*; import java.util.*; public class DesktopRearrangement { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); StringBuilder sb = new StringBuilder(); int n = sc.nextInt(); int m = sc.nextInt(); int q =...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 17
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
7cbf3583116ef011dbbd45e2d66c2c5a
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.Arrays; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws NumberFormatException, IO...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 11
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
1528500031e65d0c3451c1da202f028d
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.StreamTokenizer; import java.math.BigInteger; import static java.lang.System.in; import static java.lang.System.out; import static java.lang.Math.*; import java.util.*; ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 11
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
f24e5b3ea60877b506c72d5f4cff0b18
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.*; import java.util.*; import java.util.concurrent.ThreadLocalRandom; public class F { //java -Xss515m Solution.java < input.txt private static final String SPACE = "\\s+"; private static final int MOD = 1_000_000_007; private static final Reader in = new Reader(); publi...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 11
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
69bf65e2047ca6709c43129f19241f9a
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
/* 4 4 8 ..** .*.. *... ...* 1 3 2 3 3 1 2 3 3 4 4 3 2 3 2 2 */ import java.util.*; import java.io.*; public class Main{ public static int n; public static int m; public static char[][] grid; //n by m desktop public static boolean[][] inPlace; //true if an asterisk is in place, false if...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 11
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
ab57b6278a89a124bc5dfb4fe918df16
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.util.StringTokenizer; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.lang.reflect.Array; import java.io.IOException; import java.io.BufferedReader; import java.io.BufferedWriter; import java.math.BigInteger; import java.util.Arrays; import java.util.Collections; i...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 11
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
cf27b4b7b77ddc27addcdf69f69a8245
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.util.StringTokenizer; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.lang.reflect.Array; import java.io.IOException; import java.io.BufferedReader; import java.io.BufferedWriter; import java.math.BigInteger; import java.util.Arrays; import java.util.Collections; i...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 11
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
b411f089c3286428a88526f62eed3756
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.util.*; import java.io.*; public class Main { static int n, m, q, ha, test, N = 1001; static int[] g = new int[N*N]; static int[] tr = new int[N*N]; static String io[], s; static void add(int x, int w){ for (int i = x;i <= n+(m-1)*n;i += i&-i) tr[i] += w; } st...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 11
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
5a0157760b2921a7fe549964eb640966
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; import java.util.stream.IntStream; import java.util.stream.Stream; public class Main { public static void main(String[] args) { in = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); try { // ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 11
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
7b5941fc185792b301ed2faaa9e816db
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.*; import java.util.*; public class F { void go() { int m = Reader.nextInt(); int n = Reader.nextInt(); int q = Reader.nextInt(); char[][] g = new char[m][n]; int[][] qs = new int[q][2]; int tot = 0; //Queue<Integer> in = new Priorit...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 11
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
520a98400216736dcc7dd9d77a8e9001
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.util.*; import java.io.*; public class F { static class Scan { private byte[] buf=new byte[1024]; private int index; private InputStream in; private int total; public Scan() { in=System.in; } public int scan()throws ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 11
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
2361fbc58c043009a7e382977a93d26c
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main{ public static void main(String[]args){ long s = System.currentTimeMillis(); new Solver().run(); System.err.println(System.currentTimeMillis()-s+"ms"); } } class Solver{ final long...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 11
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
375b7e303363a7e492a277affaebe43b
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.util.*; import java.io.*; // you can compare with output.txt and expected out public class Round786F { MyPrintWriter out; MyScanner in; final static String IMPOSSIBLE = "IMPOSSIBLE"; final static String POSSIBLE = "POSSIBLE"; final static String YES = "YES"; final static String NO = "NO"...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 11
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
9de001e9eb22363776a14dade0b89caf
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.lang.*; import java.util.*; import java.io.*; import java.awt.Point; public class A { static class SegTree { int size = 1; long[] tree; SegTree(int n) { while(size < n) size *= 2; tree = new long[size * 2 - 1]; } void u...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 11
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
537ead117f3c83d027ea324ede66f138
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.*; import java.util.*; import java.util.concurrent.ThreadLocalRandom; import java.math.*; /** _ _ ( _) ( _) / / \\ / /\_\_ / / \\ / / | \ \ / / \\ / / |\ \ \ / / , \ , / / /| \ \ / / |\_ /| /...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 11
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
8a2bd5c8bc16a7f356d054de94ebc87e
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.security.cert.X509CRL; import java.util.*; import java.lang.*; import java.util.stream.Collector; import java.util.stream.Co...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 11
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
eb14604457ad283b208fc5282b320316
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.*; import java.util.*; public class CF1674F extends PrintWriter { CF1674F() { super(System.out); } Scanner sc = new Scanner(System.in); public static void main(String[] $) { CF1674F o = new CF1674F(); o.main(); o.flush(); } int[] ft; void update(int i, int n, int x) { while (i < n...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 11
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
3349e11d187bf1ed141bf16d0c7dacae
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
//Utilities import java.io.*; import java.util.*; public class a { static int n, m, q; static char[][] a; static int cnt = 0; static int[][] BIT; static int r, c; public static void main(String[] args) throws IOException { n = in.iscan(); m = in.iscan(); q = in.iscan(); a = new char[n][m]; BIT...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 11
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
ca5938b3a8b9477f745aab6991b718af
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.util.*; import java.io.*; public class codeforce { static boolean multipleTC = false; final static int Mod = 1000000007; final static int Mod2 = 998244353; final double PI = 3.14159265358979323846; int MAX = 1000000007; void pre() throws Exception { } void solve(int t) throws ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 11
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
b76eb05f6e813dccbf28584877726187
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.text.DecimalFormat; import java.util.Arrays; import java.util.Random; import java.util.StringTokenizer; public class Solution { public static void main(String[] args) { ...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 11
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
222ad813bbdd0e7417f190bacc778024
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.*; import java.util.*; public class Solution { static int M = 1_000_000_007; static Random rng = new Random(); private static int[] testCase(int n, int m, int q, char[][] desktop, int[][] rc) { int[] ans = new int[q], arr = new int[n * m], segmentTree; int idx, numI...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 11
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output
PASSED
374c43a173889fd6673c783250c1338d
train_107.jsonl
1651502100
Your friend Ivan asked you to help him rearrange his desktop. The desktop can be represented as a rectangle matrix of size $$$n \times m$$$ consisting of characters '.' (empty cell of the desktop) and '*' (an icon).The desktop is called good if all its icons are occupying some prefix of full columns and, possibly, the ...
256 megabytes
import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; import java.util.Vector; public class JavaTest { private static final PrintWriter out = new PrintWriter(System.out); private static Scanner sc; public static void main(String[] args) throws Exception { InputStream is...
Java
["4 4 8\n..**\n.*..\n*...\n...*\n1 3\n2 3\n3 1\n2 3\n3 4\n4 3\n2 3\n2 2", "2 5 5\n*...*\n*****\n1 3\n2 2\n1 3\n1 5\n2 3"]
3 seconds
["3\n4\n4\n3\n4\n5\n5\n5", "2\n3\n3\n3\n2"]
null
Java 11
standard input
[ "data structures", "greedy", "implementation" ]
9afb205f542c0d8ba4f7fa03faa617ae
The first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \le n, m \le 1000; 1 \le q \le 2 \cdot 10^5$$$) — the number of rows in the desktop, the number of columns in the desktop and the number of queries, respectively. The next $$$n$$$ lines contain the description of the desktop. The $$$...
1,800
Print $$$q$$$ integers. The $$$i$$$-th of them should be the minimum number of moves required to make the desktop good after applying the first $$$i$$$ queries.
standard output