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 | 60ef2bd04f8f7e83b271c465c8db65be | train_002.jsonl | 1600958100 | This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikachu herd.But it has become known recently that infamous team R wan... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static InputReader scn = new InputReader(System.in);
static OutputWriter out = new OutputWriter(System.out);
public static void main(String[] args) {
int t = scn.nextInt();
while (t-- > 0)
solve();
... | Java | ["3\n3 0\n1 3 2\n2 0\n1 2\n7 0\n1 2 5 4 3 6 7"] | 2 seconds | ["3\n2\n9"] | NoteIn third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be $$$5−3+7=9$$$. | Java 11 | standard input | [
"dp",
"constructive algorithms",
"greedy"
] | 2d088e622863ab0d966862ec29588db1 | Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 3 \cdot 10^5, q = 0$$$) denoting the ... | 1,300 | For each test case, print $$$q+1$$$ integers: the maximal strength of army before the swaps and after each swap. | standard output | |
PASSED | ad3f4ccb076e77902563f2f6544ff014 | train_002.jsonl | 1600958100 | This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikachu herd.But it has become known recently that infamous team R wan... | 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.*;
public class zizo {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWri... | Java | ["3\n3 0\n1 3 2\n2 0\n1 2\n7 0\n1 2 5 4 3 6 7"] | 2 seconds | ["3\n2\n9"] | NoteIn third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be $$$5−3+7=9$$$. | Java 11 | standard input | [
"dp",
"constructive algorithms",
"greedy"
] | 2d088e622863ab0d966862ec29588db1 | Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 3 \cdot 10^5, q = 0$$$) denoting the ... | 1,300 | For each test case, print $$$q+1$$$ integers: the maximal strength of army before the swaps and after each swap. | standard output | |
PASSED | 2c47490637ac00cb8b9532c987d28c64 | train_002.jsonl | 1600958100 | This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikachu herd.But it has become known recently that infamous team R wan... | 256 megabytes | import java.util.Scanner;
public class T9 {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
int t=s.nextInt();
for(int k=0;k<t;k++) {
int n=s.nextInt();
int q=s.nextInt();
int a[]=new int[n];
for(int i=0;i<n;i++) {
... | Java | ["3\n3 0\n1 3 2\n2 0\n1 2\n7 0\n1 2 5 4 3 6 7"] | 2 seconds | ["3\n2\n9"] | NoteIn third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be $$$5−3+7=9$$$. | Java 11 | standard input | [
"dp",
"constructive algorithms",
"greedy"
] | 2d088e622863ab0d966862ec29588db1 | Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 3 \cdot 10^5, q = 0$$$) denoting the ... | 1,300 | For each test case, print $$$q+1$$$ integers: the maximal strength of army before the swaps and after each swap. | standard output | |
PASSED | bad6faadcde81b1310cd84b237130b4b | train_002.jsonl | 1600958100 | This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikachu herd.But it has become known recently that infamous team R wan... | 256 megabytes | import java.util.Scanner;
import java.util.Stack;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int t = sc.nextInt();
for (int zz = 0; zz < t; zz++) {
int len = sc.nextInt();
int q = sc.nextInt();
St... | Java | ["3\n3 0\n1 3 2\n2 0\n1 2\n7 0\n1 2 5 4 3 6 7"] | 2 seconds | ["3\n2\n9"] | NoteIn third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be $$$5−3+7=9$$$. | Java 11 | standard input | [
"dp",
"constructive algorithms",
"greedy"
] | 2d088e622863ab0d966862ec29588db1 | Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 3 \cdot 10^5, q = 0$$$) denoting the ... | 1,300 | For each test case, print $$$q+1$$$ integers: the maximal strength of army before the swaps and after each swap. | standard output | |
PASSED | d7fdfc0699b09578412e88c4ac17ca7d | train_002.jsonl | 1600958100 | This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikachu herd.But it has become known recently that infamous team R wan... | 256 megabytes |
// Problem: C1. Pokémon Army (easy version)
// Contest: Codeforces - Codeforces Round #672 (Div. 2)
// URL: http://codeforces.com/contest/1420/problem/C1
// Memory Limit: 256 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
import java.io.*;
import java.util.*;
public class Ma... | Java | ["3\n3 0\n1 3 2\n2 0\n1 2\n7 0\n1 2 5 4 3 6 7"] | 2 seconds | ["3\n2\n9"] | NoteIn third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be $$$5−3+7=9$$$. | Java 11 | standard input | [
"dp",
"constructive algorithms",
"greedy"
] | 2d088e622863ab0d966862ec29588db1 | Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 3 \cdot 10^5, q = 0$$$) denoting the ... | 1,300 | For each test case, print $$$q+1$$$ integers: the maximal strength of army before the swaps and after each swap. | standard output | |
PASSED | 59ef9f6b61620eddd89e925a5aa3b9c2 | train_002.jsonl | 1600958100 | This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikachu herd.But it has become known recently that infamous team R wan... | 256 megabytes |
// Problem: C1. Pokémon Army (easy version)
// Contest: Codeforces - Codeforces Round #672 (Div. 2)
// URL: http://codeforces.com/contest/1420/problem/C1
// Memory Limit: 256 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
import java.io.*;
import java.util.*;
public class Ma... | Java | ["3\n3 0\n1 3 2\n2 0\n1 2\n7 0\n1 2 5 4 3 6 7"] | 2 seconds | ["3\n2\n9"] | NoteIn third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be $$$5−3+7=9$$$. | Java 11 | standard input | [
"dp",
"constructive algorithms",
"greedy"
] | 2d088e622863ab0d966862ec29588db1 | Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 3 \cdot 10^5, q = 0$$$) denoting the ... | 1,300 | For each test case, print $$$q+1$$$ integers: the maximal strength of army before the swaps and after each swap. | standard output | |
PASSED | 7ee480f0f47e6d84fdb410f9671854bc | train_002.jsonl | 1600958100 | This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikachu herd.But it has become known recently that infamous team R wan... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scn=new Scanner(System.in);
int t=scn.nextInt();
while(t-->0){
int n=scn.nextInt();
int q =scn.nextInt();
int []arr =new int[n];
for(int i=0;i<n;i++){
arr[i]=scn.n... | Java | ["3\n3 0\n1 3 2\n2 0\n1 2\n7 0\n1 2 5 4 3 6 7"] | 2 seconds | ["3\n2\n9"] | NoteIn third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be $$$5−3+7=9$$$. | Java 11 | standard input | [
"dp",
"constructive algorithms",
"greedy"
] | 2d088e622863ab0d966862ec29588db1 | Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 3 \cdot 10^5, q = 0$$$) denoting the ... | 1,300 | For each test case, print $$$q+1$$$ integers: the maximal strength of army before the swaps and after each swap. | standard output | |
PASSED | 42bc8d511693def3e52a289b533fe95c | train_002.jsonl | 1600958100 | This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikachu herd.But it has become known recently that infamous team R wan... | 256 megabytes | import java.util.*;
import java.io.*;
public class C_PokemonArmy_HardVersion {
private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
private static final PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
private static StringT... | Java | ["3\n3 0\n1 3 2\n2 0\n1 2\n7 0\n1 2 5 4 3 6 7"] | 2 seconds | ["3\n2\n9"] | NoteIn third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be $$$5−3+7=9$$$. | Java 11 | standard input | [
"dp",
"constructive algorithms",
"greedy"
] | 2d088e622863ab0d966862ec29588db1 | Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 3 \cdot 10^5, q = 0$$$) denoting the ... | 1,300 | For each test case, print $$$q+1$$$ integers: the maximal strength of army before the swaps and after each swap. | standard output | |
PASSED | 139a152761ddddd175c235810160bb08 | train_002.jsonl | 1600958100 | This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikachu herd.But it has become known recently that infamous team R wan... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class C {
static long go(int i, long[][] dp, int pos, int[] arr) {
if(i == arr.length) {
return 0;
}
if(dp[i][pos] !=... | Java | ["3\n3 0\n1 3 2\n2 0\n1 2\n7 0\n1 2 5 4 3 6 7"] | 2 seconds | ["3\n2\n9"] | NoteIn third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be $$$5−3+7=9$$$. | Java 11 | standard input | [
"dp",
"constructive algorithms",
"greedy"
] | 2d088e622863ab0d966862ec29588db1 | Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 3 \cdot 10^5, q = 0$$$) denoting the ... | 1,300 | For each test case, print $$$q+1$$$ integers: the maximal strength of army before the swaps and after each swap. | standard output | |
PASSED | 5e7fa60333c43dc01da0bc0260f2e8e4 | train_002.jsonl | 1600958100 | This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikachu herd.But it has become known recently that infamous team R wan... | 256 megabytes | import java.util.*;
import java.io.*;
public class C {
public static void main(String[] args) throws IOException {
Reader sc=new Reader();
Print pr=new Print();
int t=sc.nextInt();
while(t-->0) {
int n=sc.nextInt();
int q=sc.nextInt();
int a[]=new int[n];
for(int i=0;i<n;i++)
a[i]=sc.nextIn... | Java | ["3\n3 0\n1 3 2\n2 0\n1 2\n7 0\n1 2 5 4 3 6 7"] | 2 seconds | ["3\n2\n9"] | NoteIn third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be $$$5−3+7=9$$$. | Java 11 | standard input | [
"dp",
"constructive algorithms",
"greedy"
] | 2d088e622863ab0d966862ec29588db1 | Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 3 \cdot 10^5, q = 0$$$) denoting the ... | 1,300 | For each test case, print $$$q+1$$$ integers: the maximal strength of army before the swaps and after each swap. | standard output | |
PASSED | 7c099cb492d93f38735879febc7591fe | train_002.jsonl | 1600958100 | This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikachu herd.But it has become known recently that infamous team R wan... | 256 megabytes | //package codeforces_464_div2;
import java.util.Scanner;
public class C_ {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-- > 0) {
int n = sc.nextInt();
int q = sc.nextInt();
int[] a = new int... | Java | ["3\n3 0\n1 3 2\n2 0\n1 2\n7 0\n1 2 5 4 3 6 7"] | 2 seconds | ["3\n2\n9"] | NoteIn third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be $$$5−3+7=9$$$. | Java 11 | standard input | [
"dp",
"constructive algorithms",
"greedy"
] | 2d088e622863ab0d966862ec29588db1 | Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 3 \cdot 10^5, q = 0$$$) denoting the ... | 1,300 | For each test case, print $$$q+1$$$ integers: the maximal strength of army before the swaps and after each swap. | standard output | |
PASSED | dc2e35b0767bcce3892139ca129ab1a7 | train_002.jsonl | 1600958100 | This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikachu herd.But it has become known recently that infamous team R wan... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
public static void main (String[] args) throws java.lang.Exception
{
// Scanner sc=new Scanner(System.in);
FastReader sc=new FastReader();
Writer w=new PrintWriter(System.out);
int t=sc.nextInt();
while(t-->0){
int n=sc.n... | Java | ["3\n3 0\n1 3 2\n2 0\n1 2\n7 0\n1 2 5 4 3 6 7"] | 2 seconds | ["3\n2\n9"] | NoteIn third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be $$$5−3+7=9$$$. | Java 11 | standard input | [
"dp",
"constructive algorithms",
"greedy"
] | 2d088e622863ab0d966862ec29588db1 | Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 3 \cdot 10^5, q = 0$$$) denoting the ... | 1,300 | For each test case, print $$$q+1$$$ integers: the maximal strength of army before the swaps and after each swap. | standard output | |
PASSED | 1331471e19cbabfadb3790ac98dc4876 | train_002.jsonl | 1600958100 | This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikachu herd.But it has become known recently that infamous team R wan... | 256 megabytes | import java.util.*;
import java.awt.image.BandedSampleModel;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.Scanner;
public class C {
public static void main(String args[])
{
//ArrayList<Integer> list=new Ar... | Java | ["3\n3 0\n1 3 2\n2 0\n1 2\n7 0\n1 2 5 4 3 6 7"] | 2 seconds | ["3\n2\n9"] | NoteIn third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be $$$5−3+7=9$$$. | Java 11 | standard input | [
"dp",
"constructive algorithms",
"greedy"
] | 2d088e622863ab0d966862ec29588db1 | Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 3 \cdot 10^5, q = 0$$$) denoting the ... | 1,300 | For each test case, print $$$q+1$$$ integers: the maximal strength of army before the swaps and after each swap. | standard output | |
PASSED | 13f41472b5f0dcfe586b5074cdb13d06 | train_002.jsonl | 1600958100 | This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikachu herd.But it has become known recently that infamous team R wan... | 256 megabytes | import java.io.*;
import java.util.*;
public class Pc{
public static void main(String[] args) throws IOException{
FastReader sc = new FastReader();
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out),"ASCII"),512);
int t = sc.nextInt();
while(t-- > 0)... | Java | ["3\n3 0\n1 3 2\n2 0\n1 2\n7 0\n1 2 5 4 3 6 7"] | 2 seconds | ["3\n2\n9"] | NoteIn third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be $$$5−3+7=9$$$. | Java 11 | standard input | [
"dp",
"constructive algorithms",
"greedy"
] | 2d088e622863ab0d966862ec29588db1 | Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 3 \cdot 10^5, q = 0$$$) denoting the ... | 1,300 | For each test case, print $$$q+1$$$ integers: the maximal strength of army before the swaps and after each swap. | standard output | |
PASSED | 1387ab23287086ec70fd187e06198444 | train_002.jsonl | 1600958100 | This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikachu herd.But it has become known recently that infamous team R wan... | 256 megabytes | /*
Modassir_Ali
algo.java
*/
import java.util.*;
import java.io.*;
import java.util.Stack ;
import java.util.HashSet;
import java.util.HashMap;
public class C_CF672D2
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
... | Java | ["3\n3 0\n1 3 2\n2 0\n1 2\n7 0\n1 2 5 4 3 6 7"] | 2 seconds | ["3\n2\n9"] | NoteIn third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be $$$5−3+7=9$$$. | Java 11 | standard input | [
"dp",
"constructive algorithms",
"greedy"
] | 2d088e622863ab0d966862ec29588db1 | Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 3 \cdot 10^5, q = 0$$$) denoting the ... | 1,300 | For each test case, print $$$q+1$$$ integers: the maximal strength of army before the swaps and after each swap. | standard output | |
PASSED | 5487bb8af4982bcd2bd8164734fd8eb7 | train_002.jsonl | 1600958100 | This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikachu herd.But it has become known recently that infamous team R wan... | 256 megabytes | import java.util.*;
public class MyClass {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int tests = sc.nextInt();
for(int t=0; t<tests; t++){
int size = sc.nextInt();
int q = sc.nextInt();
int[] arr = new... | Java | ["3\n3 0\n1 3 2\n2 0\n1 2\n7 0\n1 2 5 4 3 6 7"] | 2 seconds | ["3\n2\n9"] | NoteIn third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be $$$5−3+7=9$$$. | Java 11 | standard input | [
"dp",
"constructive algorithms",
"greedy"
] | 2d088e622863ab0d966862ec29588db1 | Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 3 \cdot 10^5, q = 0$$$) denoting the ... | 1,300 | For each test case, print $$$q+1$$$ integers: the maximal strength of army before the swaps and after each swap. | standard output | |
PASSED | 2e10ba6b25ab776b13bfb917c8b0f5c9 | train_002.jsonl | 1600958100 | This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikachu herd.But it has become known recently that infamous team R wan... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.*;
public class Rextester{
public static void main(String[] args)throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(br.readLine());
StringBuffer sb = new StringBuffer()... | Java | ["3\n3 0\n1 3 2\n2 0\n1 2\n7 0\n1 2 5 4 3 6 7"] | 2 seconds | ["3\n2\n9"] | NoteIn third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be $$$5−3+7=9$$$. | Java 11 | standard input | [
"dp",
"constructive algorithms",
"greedy"
] | 2d088e622863ab0d966862ec29588db1 | Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 3 \cdot 10^5, q = 0$$$) denoting the ... | 1,300 | For each test case, print $$$q+1$$$ integers: the maximal strength of army before the swaps and after each swap. | standard output | |
PASSED | 3ca9a001f5c6c9b77821b24fdb60da42 | train_002.jsonl | 1600958100 | This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikachu herd.But it has become known recently that infamous team R wan... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String args[]) {
FastScanner fs=new FastScanner();
PrintWriter out=new PrintWriter(System.out);
int t=fs.nextInt();
while(t-->0)
{
int n=fs.nextInt();
int q=fs.nextInt();
... | Java | ["3\n3 0\n1 3 2\n2 0\n1 2\n7 0\n1 2 5 4 3 6 7"] | 2 seconds | ["3\n2\n9"] | NoteIn third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be $$$5−3+7=9$$$. | Java 11 | standard input | [
"dp",
"constructive algorithms",
"greedy"
] | 2d088e622863ab0d966862ec29588db1 | Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 3 \cdot 10^5, q = 0$$$) denoting the ... | 1,300 | For each test case, print $$$q+1$$$ integers: the maximal strength of army before the swaps and after each swap. | standard output | |
PASSED | 9494f313f934030ffe0827f2e58537bf | train_002.jsonl | 1600958100 | This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikachu herd.But it has become known recently that infamous team R wan... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main{
static int mod=(int)1e9+7;
public static void main(String[] args) throws IOException {
Writer out=new Writer(System.out);
Reader in=new Reader(System.in);
int ts=in.nextInt();
outer: while(ts-->0) {
int n=in.nextInt();
int q=in.nextInt();
... | Java | ["3\n3 0\n1 3 2\n2 0\n1 2\n7 0\n1 2 5 4 3 6 7"] | 2 seconds | ["3\n2\n9"] | NoteIn third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be $$$5−3+7=9$$$. | Java 11 | standard input | [
"dp",
"constructive algorithms",
"greedy"
] | 2d088e622863ab0d966862ec29588db1 | Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 3 \cdot 10^5, q = 0$$$) denoting the ... | 1,300 | For each test case, print $$$q+1$$$ integers: the maximal strength of army before the swaps and after each swap. | standard output | |
PASSED | fbba0a7f8a429ca929fe6a4c06141d9b | train_002.jsonl | 1600958100 | This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikachu herd.But it has become known recently that infamous team R wan... | 256 megabytes | import java.io.PrintWriter;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
var sc = new Scanner(System.in);
var pw = new PrintWriter(System.out);
int T = Integer.parseInt(sc.next());
for(int t = 0; t < T; t++){
i... | Java | ["3\n3 0\n1 3 2\n2 0\n1 2\n7 0\n1 2 5 4 3 6 7"] | 2 seconds | ["3\n2\n9"] | NoteIn third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be $$$5−3+7=9$$$. | Java 11 | standard input | [
"dp",
"constructive algorithms",
"greedy"
] | 2d088e622863ab0d966862ec29588db1 | Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 3 \cdot 10^5, q = 0$$$) denoting the ... | 1,300 | For each test case, print $$$q+1$$$ integers: the maximal strength of army before the swaps and after each swap. | standard output | |
PASSED | 17d2fb07e04b6da192c0a10b0bd1e874 | train_002.jsonl | 1600958100 | This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikachu herd.But it has become known recently that infamous team R wan... | 256 megabytes | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
//package javaapplication1;
import java.util.*;
/**
*
* @author DELL
*/
public class JavaApplication1 {
/**
* @param args... | Java | ["3\n3 0\n1 3 2\n2 0\n1 2\n7 0\n1 2 5 4 3 6 7"] | 2 seconds | ["3\n2\n9"] | NoteIn third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be $$$5−3+7=9$$$. | Java 11 | standard input | [
"dp",
"constructive algorithms",
"greedy"
] | 2d088e622863ab0d966862ec29588db1 | Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 3 \cdot 10^5, q = 0$$$) denoting the ... | 1,300 | For each test case, print $$$q+1$$$ integers: the maximal strength of army before the swaps and after each swap. | standard output | |
PASSED | 8490daa5d04ffc83c6fd5d88757fdd27 | train_002.jsonl | 1600958100 | This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikachu herd.But it has become known recently that infamous team R wan... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class PokemonArmy {
static long getMin(int[]array,int n){
long[][]dp=new long[n][2];
for(long[]a:dp)
Arrays.fill(a, Integer.MIN_VALUE);
dp[0][0]=0;
... | Java | ["3\n3 0\n1 3 2\n2 0\n1 2\n7 0\n1 2 5 4 3 6 7"] | 2 seconds | ["3\n2\n9"] | NoteIn third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be $$$5−3+7=9$$$. | Java 11 | standard input | [
"dp",
"constructive algorithms",
"greedy"
] | 2d088e622863ab0d966862ec29588db1 | Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 3 \cdot 10^5, q = 0$$$) denoting the ... | 1,300 | For each test case, print $$$q+1$$$ integers: the maximal strength of army before the swaps and after each swap. | standard output | |
PASSED | 49a4057871061e44ac2efc0e9e8a95f4 | train_002.jsonl | 1600958100 | This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikachu herd.But it has become known recently that infamous team R wan... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int t=in.nextInt();
while(t-->0)
{
int n=in.nextInt();
int q=in.nextInt();
long a[]=new long[n];
long dp[][]=new long... | Java | ["3\n3 0\n1 3 2\n2 0\n1 2\n7 0\n1 2 5 4 3 6 7"] | 2 seconds | ["3\n2\n9"] | NoteIn third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be $$$5−3+7=9$$$. | Java 11 | standard input | [
"dp",
"constructive algorithms",
"greedy"
] | 2d088e622863ab0d966862ec29588db1 | Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 3 \cdot 10^5, q = 0$$$) denoting the ... | 1,300 | For each test case, print $$$q+1$$$ integers: the maximal strength of army before the swaps and after each swap. | standard output | |
PASSED | 4f568aaacfb4391138e31322326ed963 | train_002.jsonl | 1600958100 | This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikachu herd.But it has become known recently that infamous team R wan... | 256 megabytes | import java.util.Scanner;
public class C {
static Scanner sc = new Scanner(System.in);
static StringBuilder out = new StringBuilder();
public static void main(String[] args){
int t = sc.nextInt();
while (t-- >0){
int n = sc.nextInt();
int q = sc.nextInt();
... | Java | ["3\n3 0\n1 3 2\n2 0\n1 2\n7 0\n1 2 5 4 3 6 7"] | 2 seconds | ["3\n2\n9"] | NoteIn third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be $$$5−3+7=9$$$. | Java 11 | standard input | [
"dp",
"constructive algorithms",
"greedy"
] | 2d088e622863ab0d966862ec29588db1 | Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 3 \cdot 10^5, q = 0$$$) denoting the ... | 1,300 | For each test case, print $$$q+1$$$ integers: the maximal strength of army before the swaps and after each swap. | standard output | |
PASSED | 0cb5089293962905d20c22949383945e | train_002.jsonl | 1600958100 | This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikachu herd.But it has become known recently that infamous team R wan... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Timestamp;
import java.time.LocalDate;
import java.time.LocalDateTim... | Java | ["3\n3 0\n1 3 2\n2 0\n1 2\n7 0\n1 2 5 4 3 6 7"] | 2 seconds | ["3\n2\n9"] | NoteIn third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be $$$5−3+7=9$$$. | Java 11 | standard input | [
"dp",
"constructive algorithms",
"greedy"
] | 2d088e622863ab0d966862ec29588db1 | Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 3 \cdot 10^5, q = 0$$$) denoting the ... | 1,300 | For each test case, print $$$q+1$$$ integers: the maximal strength of army before the swaps and after each swap. | standard output | |
PASSED | f5e13281692bdb6c97a799f6f1ea77a6 | train_002.jsonl | 1538750100 | Vasya has recently got a job as a cashier at a local store. His day at work is $$$L$$$ minutes long. Vasya has already memorized $$$n$$$ regular customers, the $$$i$$$-th of which comes after $$$t_{i}$$$ minutes after the beginning of the day, and his service consumes $$$l_{i}$$$ minutes. It is guaranteed that no custo... | 256 megabytes | import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int n = sc.nextInt();
int sum = sc.nextInt();
int time = sc.nextInt();
// int[][] ii = new int[n][2];
int max = 0;
int s = 0;
f1:
for (int i = 0; i < n; i++) {
int t... | Java | ["2 11 3\n0 1\n1 1", "0 5 2", "1 3 2\n1 2"] | 2 seconds | ["3", "2", "0"] | NoteIn the first sample Vasya can take $$$3$$$ breaks starting after $$$2$$$, $$$5$$$ and $$$8$$$ minutes after the beginning of the day.In the second sample Vasya can take $$$2$$$ breaks starting after $$$0$$$ and $$$2$$$ minutes after the beginning of the day.In the third sample Vasya can't take any breaks. | Java 8 | standard input | [
"implementation"
] | 00acb3b54975820989a788b9389c7c0b | The first line contains three integers $$$n$$$, $$$L$$$ and $$$a$$$ ($$$0 \le n \le 10^{5}$$$, $$$1 \le L \le 10^{9}$$$, $$$1 \le a \le L$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$t_{i}$$$ and $$$l_{i}$$$ ($$$0 \le t_{i} \le L - 1$$$, $$$1 \le l_{i} \le L$$$). It is guaranteed that $$$t_{i}... | 1,000 | Output one integer — the maximum number of breaks. | standard output | |
PASSED | af53ef710453edd7ae49f9785f86b355 | train_002.jsonl | 1538750100 | Vasya has recently got a job as a cashier at a local store. His day at work is $$$L$$$ minutes long. Vasya has already memorized $$$n$$$ regular customers, the $$$i$$$-th of which comes after $$$t_{i}$$$ minutes after the beginning of the day, and his service consumes $$$l_{i}$$$ minutes. It is guaranteed that no custo... | 256 megabytes | /*
01001101 01000001 01000001 01001100 00100000 01000001 01000001 01010100
01001001 00100000 01001000 01000001 01001001 01001110 00100000 01011001
01000001 01000001 01000100 01000101 01001001 01001110 00100000 01000011
01001000 01001111 01000100 00100000 01001010 01000001 01000001 01010100
01001001 00100000 01001000 01... | Java | ["2 11 3\n0 1\n1 1", "0 5 2", "1 3 2\n1 2"] | 2 seconds | ["3", "2", "0"] | NoteIn the first sample Vasya can take $$$3$$$ breaks starting after $$$2$$$, $$$5$$$ and $$$8$$$ minutes after the beginning of the day.In the second sample Vasya can take $$$2$$$ breaks starting after $$$0$$$ and $$$2$$$ minutes after the beginning of the day.In the third sample Vasya can't take any breaks. | Java 8 | standard input | [
"implementation"
] | 00acb3b54975820989a788b9389c7c0b | The first line contains three integers $$$n$$$, $$$L$$$ and $$$a$$$ ($$$0 \le n \le 10^{5}$$$, $$$1 \le L \le 10^{9}$$$, $$$1 \le a \le L$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$t_{i}$$$ and $$$l_{i}$$$ ($$$0 \le t_{i} \le L - 1$$$, $$$1 \le l_{i} \le L$$$). It is guaranteed that $$$t_{i}... | 1,000 | Output one integer — the maximum number of breaks. | standard output | |
PASSED | 8c056910bb48a5ec9b9df3b5877d8092 | train_002.jsonl | 1538750100 | Vasya has recently got a job as a cashier at a local store. His day at work is $$$L$$$ minutes long. Vasya has already memorized $$$n$$$ regular customers, the $$$i$$$-th of which comes after $$$t_{i}$$$ minutes after the beginning of the day, and his service consumes $$$l_{i}$$$ minutes. It is guaranteed that no custo... | 256 megabytes | import java.io.*;
import java.lang.reflect.Array;
import java.nio.Buffer;
import java.util.*;
public class Pair {
static class FastReader {
private BufferedReader br;
private StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["2 11 3\n0 1\n1 1", "0 5 2", "1 3 2\n1 2"] | 2 seconds | ["3", "2", "0"] | NoteIn the first sample Vasya can take $$$3$$$ breaks starting after $$$2$$$, $$$5$$$ and $$$8$$$ minutes after the beginning of the day.In the second sample Vasya can take $$$2$$$ breaks starting after $$$0$$$ and $$$2$$$ minutes after the beginning of the day.In the third sample Vasya can't take any breaks. | Java 8 | standard input | [
"implementation"
] | 00acb3b54975820989a788b9389c7c0b | The first line contains three integers $$$n$$$, $$$L$$$ and $$$a$$$ ($$$0 \le n \le 10^{5}$$$, $$$1 \le L \le 10^{9}$$$, $$$1 \le a \le L$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$t_{i}$$$ and $$$l_{i}$$$ ($$$0 \le t_{i} \le L - 1$$$, $$$1 \le l_{i} \le L$$$). It is guaranteed that $$$t_{i}... | 1,000 | Output one integer — the maximum number of breaks. | standard output | |
PASSED | 8ac2b595793915872a611029f2037920 | train_002.jsonl | 1538750100 | Vasya has recently got a job as a cashier at a local store. His day at work is $$$L$$$ minutes long. Vasya has already memorized $$$n$$$ regular customers, the $$$i$$$-th of which comes after $$$t_{i}$$$ minutes after the beginning of the day, and his service consumes $$$l_{i}$$$ minutes. It is guaranteed that no custo... | 256 megabytes |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Codef{
public static void main ( String [] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n, l, a, i, ti, li, ans=0, ... | Java | ["2 11 3\n0 1\n1 1", "0 5 2", "1 3 2\n1 2"] | 2 seconds | ["3", "2", "0"] | NoteIn the first sample Vasya can take $$$3$$$ breaks starting after $$$2$$$, $$$5$$$ and $$$8$$$ minutes after the beginning of the day.In the second sample Vasya can take $$$2$$$ breaks starting after $$$0$$$ and $$$2$$$ minutes after the beginning of the day.In the third sample Vasya can't take any breaks. | Java 8 | standard input | [
"implementation"
] | 00acb3b54975820989a788b9389c7c0b | The first line contains three integers $$$n$$$, $$$L$$$ and $$$a$$$ ($$$0 \le n \le 10^{5}$$$, $$$1 \le L \le 10^{9}$$$, $$$1 \le a \le L$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$t_{i}$$$ and $$$l_{i}$$$ ($$$0 \le t_{i} \le L - 1$$$, $$$1 \le l_{i} \le L$$$). It is guaranteed that $$$t_{i}... | 1,000 | Output one integer — the maximum number of breaks. | standard output | |
PASSED | fd7c620b9fdf3d0c2200f4c8e0a2b8e2 | train_002.jsonl | 1538750100 | Vasya has recently got a job as a cashier at a local store. His day at work is $$$L$$$ minutes long. Vasya has already memorized $$$n$$$ regular customers, the $$$i$$$-th of which comes after $$$t_{i}$$$ minutes after the beginning of the day, and his service consumes $$$l_{i}$$$ minutes. It is guaranteed that no custo... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
public class ch {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
//sc.waitForInput();
int n = sc.nextInt();
... | Java | ["2 11 3\n0 1\n1 1", "0 5 2", "1 3 2\n1 2"] | 2 seconds | ["3", "2", "0"] | NoteIn the first sample Vasya can take $$$3$$$ breaks starting after $$$2$$$, $$$5$$$ and $$$8$$$ minutes after the beginning of the day.In the second sample Vasya can take $$$2$$$ breaks starting after $$$0$$$ and $$$2$$$ minutes after the beginning of the day.In the third sample Vasya can't take any breaks. | Java 8 | standard input | [
"implementation"
] | 00acb3b54975820989a788b9389c7c0b | The first line contains three integers $$$n$$$, $$$L$$$ and $$$a$$$ ($$$0 \le n \le 10^{5}$$$, $$$1 \le L \le 10^{9}$$$, $$$1 \le a \le L$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$t_{i}$$$ and $$$l_{i}$$$ ($$$0 \le t_{i} \le L - 1$$$, $$$1 \le l_{i} \le L$$$). It is guaranteed that $$$t_{i}... | 1,000 | Output one integer — the maximum number of breaks. | standard output | |
PASSED | d83352928c743c85c3c22dd4a0eeb91e | train_002.jsonl | 1538750100 | Vasya has recently got a job as a cashier at a local store. His day at work is $$$L$$$ minutes long. Vasya has already memorized $$$n$$$ regular customers, the $$$i$$$-th of which comes after $$$t_{i}$$$ minutes after the beginning of the day, and his service consumes $$$l_{i}$$$ minutes. It is guaranteed that no custo... | 256 megabytes | import java.io.*;
import java.util.*;
public class Cashier
{
public static void main(String[] f)
{
long n,L,a,i,prevxi=0,prevyi=0,xi,yi;
long sum=0;
Scanner sc=new Scanner(System.in);
n=sc.nextLong();
L=sc.nextLong();
a=sc.nextLong();
for(i=0;i<n;i++)
{
xi=sc.nextLong();
yi=sc.nextLong();
sum... | Java | ["2 11 3\n0 1\n1 1", "0 5 2", "1 3 2\n1 2"] | 2 seconds | ["3", "2", "0"] | NoteIn the first sample Vasya can take $$$3$$$ breaks starting after $$$2$$$, $$$5$$$ and $$$8$$$ minutes after the beginning of the day.In the second sample Vasya can take $$$2$$$ breaks starting after $$$0$$$ and $$$2$$$ minutes after the beginning of the day.In the third sample Vasya can't take any breaks. | Java 8 | standard input | [
"implementation"
] | 00acb3b54975820989a788b9389c7c0b | The first line contains three integers $$$n$$$, $$$L$$$ and $$$a$$$ ($$$0 \le n \le 10^{5}$$$, $$$1 \le L \le 10^{9}$$$, $$$1 \le a \le L$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$t_{i}$$$ and $$$l_{i}$$$ ($$$0 \le t_{i} \le L - 1$$$, $$$1 \le l_{i} \le L$$$). It is guaranteed that $$$t_{i}... | 1,000 | Output one integer — the maximum number of breaks. | standard output | |
PASSED | 3c864bdfd7366d2384f44d52c6981458 | train_002.jsonl | 1538750100 | Vasya has recently got a job as a cashier at a local store. His day at work is $$$L$$$ minutes long. Vasya has already memorized $$$n$$$ regular customers, the $$$i$$$-th of which comes after $$$t_{i}$$$ minutes after the beginning of the day, and his service consumes $$$l_{i}$$$ minutes. It is guaranteed that no custo... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
public class Cashier {
p... | Java | ["2 11 3\n0 1\n1 1", "0 5 2", "1 3 2\n1 2"] | 2 seconds | ["3", "2", "0"] | NoteIn the first sample Vasya can take $$$3$$$ breaks starting after $$$2$$$, $$$5$$$ and $$$8$$$ minutes after the beginning of the day.In the second sample Vasya can take $$$2$$$ breaks starting after $$$0$$$ and $$$2$$$ minutes after the beginning of the day.In the third sample Vasya can't take any breaks. | Java 8 | standard input | [
"implementation"
] | 00acb3b54975820989a788b9389c7c0b | The first line contains three integers $$$n$$$, $$$L$$$ and $$$a$$$ ($$$0 \le n \le 10^{5}$$$, $$$1 \le L \le 10^{9}$$$, $$$1 \le a \le L$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$t_{i}$$$ and $$$l_{i}$$$ ($$$0 \le t_{i} \le L - 1$$$, $$$1 \le l_{i} \le L$$$). It is guaranteed that $$$t_{i}... | 1,000 | Output one integer — the maximum number of breaks. | standard output | |
PASSED | fa597adaf798a42c96ade8902925e5f9 | train_002.jsonl | 1538750100 | Vasya has recently got a job as a cashier at a local store. His day at work is $$$L$$$ minutes long. Vasya has already memorized $$$n$$$ regular customers, the $$$i$$$-th of which comes after $$$t_{i}$$$ minutes after the beginning of the day, and his service consumes $$$l_{i}$$$ minutes. It is guaranteed that no custo... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
int L = scn.nextInt();
int a = scn.nextInt();
int[] t = new int[n];
int[] l = new int[n];
for(... | Java | ["2 11 3\n0 1\n1 1", "0 5 2", "1 3 2\n1 2"] | 2 seconds | ["3", "2", "0"] | NoteIn the first sample Vasya can take $$$3$$$ breaks starting after $$$2$$$, $$$5$$$ and $$$8$$$ minutes after the beginning of the day.In the second sample Vasya can take $$$2$$$ breaks starting after $$$0$$$ and $$$2$$$ minutes after the beginning of the day.In the third sample Vasya can't take any breaks. | Java 8 | standard input | [
"implementation"
] | 00acb3b54975820989a788b9389c7c0b | The first line contains three integers $$$n$$$, $$$L$$$ and $$$a$$$ ($$$0 \le n \le 10^{5}$$$, $$$1 \le L \le 10^{9}$$$, $$$1 \le a \le L$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$t_{i}$$$ and $$$l_{i}$$$ ($$$0 \le t_{i} \le L - 1$$$, $$$1 \le l_{i} \le L$$$). It is guaranteed that $$$t_{i}... | 1,000 | Output one integer — the maximum number of breaks. | standard output | |
PASSED | e95ee63b923aa576dbfe5b3b82a4f3df | train_002.jsonl | 1538750100 | Vasya has recently got a job as a cashier at a local store. His day at work is $$$L$$$ minutes long. Vasya has already memorized $$$n$$$ regular customers, the $$$i$$$-th of which comes after $$$t_{i}$$$ minutes after the beginning of the day, and his service consumes $$$l_{i}$$$ minutes. It is guaranteed that no custo... | 256 megabytes | import java.util.*;
import java.io.*;
public class Cashier {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
long n = sc.nextInt(); long l = sc.nextInt(); long a = sc.nextInt();
long curren... | Java | ["2 11 3\n0 1\n1 1", "0 5 2", "1 3 2\n1 2"] | 2 seconds | ["3", "2", "0"] | NoteIn the first sample Vasya can take $$$3$$$ breaks starting after $$$2$$$, $$$5$$$ and $$$8$$$ minutes after the beginning of the day.In the second sample Vasya can take $$$2$$$ breaks starting after $$$0$$$ and $$$2$$$ minutes after the beginning of the day.In the third sample Vasya can't take any breaks. | Java 8 | standard input | [
"implementation"
] | 00acb3b54975820989a788b9389c7c0b | The first line contains three integers $$$n$$$, $$$L$$$ and $$$a$$$ ($$$0 \le n \le 10^{5}$$$, $$$1 \le L \le 10^{9}$$$, $$$1 \le a \le L$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$t_{i}$$$ and $$$l_{i}$$$ ($$$0 \le t_{i} \le L - 1$$$, $$$1 \le l_{i} \le L$$$). It is guaranteed that $$$t_{i}... | 1,000 | Output one integer — the maximum number of breaks. | standard output | |
PASSED | e2fd9e0fc932affe12bd215c2aa4496f | train_002.jsonl | 1538750100 | Vasya has recently got a job as a cashier at a local store. His day at work is $$$L$$$ minutes long. Vasya has already memorized $$$n$$$ regular customers, the $$$i$$$-th of which comes after $$$t_{i}$$$ minutes after the beginning of the day, and his service consumes $$$l_{i}$$$ minutes. It is guaranteed that no custo... | 256 megabytes | import java.util.Scanner;
public class Cashier {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int L = s.nextInt();
int a = s.nextInt();
int[] t,l;
t = new int[n];
l = new int[n];
for(int i=0;i<n;i++) {
t[i] = s.nextInt();
l[i] = s.ne... | Java | ["2 11 3\n0 1\n1 1", "0 5 2", "1 3 2\n1 2"] | 2 seconds | ["3", "2", "0"] | NoteIn the first sample Vasya can take $$$3$$$ breaks starting after $$$2$$$, $$$5$$$ and $$$8$$$ minutes after the beginning of the day.In the second sample Vasya can take $$$2$$$ breaks starting after $$$0$$$ and $$$2$$$ minutes after the beginning of the day.In the third sample Vasya can't take any breaks. | Java 8 | standard input | [
"implementation"
] | 00acb3b54975820989a788b9389c7c0b | The first line contains three integers $$$n$$$, $$$L$$$ and $$$a$$$ ($$$0 \le n \le 10^{5}$$$, $$$1 \le L \le 10^{9}$$$, $$$1 \le a \le L$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$t_{i}$$$ and $$$l_{i}$$$ ($$$0 \le t_{i} \le L - 1$$$, $$$1 \le l_{i} \le L$$$). It is guaranteed that $$$t_{i}... | 1,000 | Output one integer — the maximum number of breaks. | standard output | |
PASSED | a4091b2f06e0b35e60f684244428b7ef | train_002.jsonl | 1538750100 | Vasya has recently got a job as a cashier at a local store. His day at work is $$$L$$$ minutes long. Vasya has already memorized $$$n$$$ regular customers, the $$$i$$$-th of which comes after $$$t_{i}$$$ minutes after the beginning of the day, and his service consumes $$$l_{i}$$$ minutes. It is guaranteed that no custo... | 256 megabytes | import java.io.*;
import java.util.*;
public class Contest {
static class Customer implements Comparable<Customer>{
int t, l;
Customer(int t, int l){
this.t = t;
this.l = l;
}
@Override
public int compareTo(Customer c) {
return this.t-c.t;
}
}
public static void main(String[] args) throw... | Java | ["2 11 3\n0 1\n1 1", "0 5 2", "1 3 2\n1 2"] | 2 seconds | ["3", "2", "0"] | NoteIn the first sample Vasya can take $$$3$$$ breaks starting after $$$2$$$, $$$5$$$ and $$$8$$$ minutes after the beginning of the day.In the second sample Vasya can take $$$2$$$ breaks starting after $$$0$$$ and $$$2$$$ minutes after the beginning of the day.In the third sample Vasya can't take any breaks. | Java 8 | standard input | [
"implementation"
] | 00acb3b54975820989a788b9389c7c0b | The first line contains three integers $$$n$$$, $$$L$$$ and $$$a$$$ ($$$0 \le n \le 10^{5}$$$, $$$1 \le L \le 10^{9}$$$, $$$1 \le a \le L$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$t_{i}$$$ and $$$l_{i}$$$ ($$$0 \le t_{i} \le L - 1$$$, $$$1 \le l_{i} \le L$$$). It is guaranteed that $$$t_{i}... | 1,000 | Output one integer — the maximum number of breaks. | standard output | |
PASSED | 2e03972ae0742bf81ce9875275b9c898 | train_002.jsonl | 1538750100 | Vasya has recently got a job as a cashier at a local store. His day at work is $$$L$$$ minutes long. Vasya has already memorized $$$n$$$ regular customers, the $$$i$$$-th of which comes after $$$t_{i}$$$ minutes after the beginning of the day, and his service consumes $$$l_{i}$$$ minutes. It is guaranteed that no custo... | 256 megabytes | import java.util.Scanner;
public class sdas {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt(), l = sc.nextInt(), a = sc.nextInt(), x=0, counter = 0;
for (int i = 0; i < n; i++){
int t = sc.nextInt(), k = sc.nextInt();
... | Java | ["2 11 3\n0 1\n1 1", "0 5 2", "1 3 2\n1 2"] | 2 seconds | ["3", "2", "0"] | NoteIn the first sample Vasya can take $$$3$$$ breaks starting after $$$2$$$, $$$5$$$ and $$$8$$$ minutes after the beginning of the day.In the second sample Vasya can take $$$2$$$ breaks starting after $$$0$$$ and $$$2$$$ minutes after the beginning of the day.In the third sample Vasya can't take any breaks. | Java 8 | standard input | [
"implementation"
] | 00acb3b54975820989a788b9389c7c0b | The first line contains three integers $$$n$$$, $$$L$$$ and $$$a$$$ ($$$0 \le n \le 10^{5}$$$, $$$1 \le L \le 10^{9}$$$, $$$1 \le a \le L$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$t_{i}$$$ and $$$l_{i}$$$ ($$$0 \le t_{i} \le L - 1$$$, $$$1 \le l_{i} \le L$$$). It is guaranteed that $$$t_{i}... | 1,000 | Output one integer — the maximum number of breaks. | standard output | |
PASSED | b7e385a5e9dfc67fbbad268ca5d112fb | train_002.jsonl | 1538750100 | Vasya has recently got a job as a cashier at a local store. His day at work is $$$L$$$ minutes long. Vasya has already memorized $$$n$$$ regular customers, the $$$i$$$-th of which comes after $$$t_{i}$$$ minutes after the beginning of the day, and his service consumes $$$l_{i}$$$ minutes. It is guaranteed that no custo... | 256 megabytes | import java.util.*;
public class GFG {
public static void main (String[] args) {
Scanner sc=new Scanner(System.in);
long n=sc.nextInt(),l=sc.nextInt(),a=sc.nextInt();
long t1=0,l1=0;
if(n>0)
{t1=sc.nextInt();l1=sc.nextInt();}
long sum1=0;
long sum=t1+l1;
long count=t1/a;
//long r=t1%a;
for(int i=0... | Java | ["2 11 3\n0 1\n1 1", "0 5 2", "1 3 2\n1 2"] | 2 seconds | ["3", "2", "0"] | NoteIn the first sample Vasya can take $$$3$$$ breaks starting after $$$2$$$, $$$5$$$ and $$$8$$$ minutes after the beginning of the day.In the second sample Vasya can take $$$2$$$ breaks starting after $$$0$$$ and $$$2$$$ minutes after the beginning of the day.In the third sample Vasya can't take any breaks. | Java 8 | standard input | [
"implementation"
] | 00acb3b54975820989a788b9389c7c0b | The first line contains three integers $$$n$$$, $$$L$$$ and $$$a$$$ ($$$0 \le n \le 10^{5}$$$, $$$1 \le L \le 10^{9}$$$, $$$1 \le a \le L$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$t_{i}$$$ and $$$l_{i}$$$ ($$$0 \le t_{i} \le L - 1$$$, $$$1 \le l_{i} \le L$$$). It is guaranteed that $$$t_{i}... | 1,000 | Output one integer — the maximum number of breaks. | standard output | |
PASSED | 0353442526ceee963e6ce1b9d388a819 | train_002.jsonl | 1538750100 | Vasya has recently got a job as a cashier at a local store. His day at work is $$$L$$$ minutes long. Vasya has already memorized $$$n$$$ regular customers, the $$$i$$$-th of which comes after $$$t_{i}$$$ minutes after the beginning of the day, and his service consumes $$$l_{i}$$$ minutes. It is guaranteed that no custo... | 256 megabytes | import java.util.Scanner;
public class NewTest {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int L = scanner.nextInt();
int a = scanner.nextInt();
int card = 0;
int ans = 0;
for (int i = 0; i < ... | Java | ["2 11 3\n0 1\n1 1", "0 5 2", "1 3 2\n1 2"] | 2 seconds | ["3", "2", "0"] | NoteIn the first sample Vasya can take $$$3$$$ breaks starting after $$$2$$$, $$$5$$$ and $$$8$$$ minutes after the beginning of the day.In the second sample Vasya can take $$$2$$$ breaks starting after $$$0$$$ and $$$2$$$ minutes after the beginning of the day.In the third sample Vasya can't take any breaks. | Java 8 | standard input | [
"implementation"
] | 00acb3b54975820989a788b9389c7c0b | The first line contains three integers $$$n$$$, $$$L$$$ and $$$a$$$ ($$$0 \le n \le 10^{5}$$$, $$$1 \le L \le 10^{9}$$$, $$$1 \le a \le L$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$t_{i}$$$ and $$$l_{i}$$$ ($$$0 \le t_{i} \le L - 1$$$, $$$1 \le l_{i} \le L$$$). It is guaranteed that $$$t_{i}... | 1,000 | Output one integer — the maximum number of breaks. | standard output | |
PASSED | aea0019ec20b93c38b5d23e8c9d61759 | train_002.jsonl | 1538750100 | Vasya has recently got a job as a cashier at a local store. His day at work is $$$L$$$ minutes long. Vasya has already memorized $$$n$$$ regular customers, the $$$i$$$-th of which comes after $$$t_{i}$$$ minutes after the beginning of the day, and his service consumes $$$l_{i}$$$ minutes. It is guaranteed that no custo... | 256 megabytes | import java.util.*;
public class Cashier {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int L = sc.nextInt();
int A = sc.nextInt();
int prevC = 0;
long sum = 0L;
for (int i = 0; i < N; i++) {
... | Java | ["2 11 3\n0 1\n1 1", "0 5 2", "1 3 2\n1 2"] | 2 seconds | ["3", "2", "0"] | NoteIn the first sample Vasya can take $$$3$$$ breaks starting after $$$2$$$, $$$5$$$ and $$$8$$$ minutes after the beginning of the day.In the second sample Vasya can take $$$2$$$ breaks starting after $$$0$$$ and $$$2$$$ minutes after the beginning of the day.In the third sample Vasya can't take any breaks. | Java 8 | standard input | [
"implementation"
] | 00acb3b54975820989a788b9389c7c0b | The first line contains three integers $$$n$$$, $$$L$$$ and $$$a$$$ ($$$0 \le n \le 10^{5}$$$, $$$1 \le L \le 10^{9}$$$, $$$1 \le a \le L$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$t_{i}$$$ and $$$l_{i}$$$ ($$$0 \le t_{i} \le L - 1$$$, $$$1 \le l_{i} \le L$$$). It is guaranteed that $$$t_{i}... | 1,000 | Output one integer — the maximum number of breaks. | standard output | |
PASSED | 2a0e1d0b86e682184138a306c91310f6 | train_002.jsonl | 1538750100 | Vasya has recently got a job as a cashier at a local store. His day at work is $$$L$$$ minutes long. Vasya has already memorized $$$n$$$ regular customers, the $$$i$$$-th of which comes after $$$t_{i}$$$ minutes after the beginning of the day, and his service consumes $$$l_{i}$$$ minutes. It is guaranteed that no custo... | 256 megabytes |
//package Codeforces_contest;
import java.io.*;
import java.util.*;
/**
*
* @author abhishek
*/
import java.io.*;
import java.util.*;
public class R514Div2A{
InputStream obj;
PrintWriter out;
String check = "";
//Solution !!
void solution() {
int n=inti(),l=inti(),a=inti();
in... | Java | ["2 11 3\n0 1\n1 1", "0 5 2", "1 3 2\n1 2"] | 2 seconds | ["3", "2", "0"] | NoteIn the first sample Vasya can take $$$3$$$ breaks starting after $$$2$$$, $$$5$$$ and $$$8$$$ minutes after the beginning of the day.In the second sample Vasya can take $$$2$$$ breaks starting after $$$0$$$ and $$$2$$$ minutes after the beginning of the day.In the third sample Vasya can't take any breaks. | Java 8 | standard input | [
"implementation"
] | 00acb3b54975820989a788b9389c7c0b | The first line contains three integers $$$n$$$, $$$L$$$ and $$$a$$$ ($$$0 \le n \le 10^{5}$$$, $$$1 \le L \le 10^{9}$$$, $$$1 \le a \le L$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$t_{i}$$$ and $$$l_{i}$$$ ($$$0 \le t_{i} \le L - 1$$$, $$$1 \le l_{i} \le L$$$). It is guaranteed that $$$t_{i}... | 1,000 | Output one integer — the maximum number of breaks. | standard output | |
PASSED | 398786349924bd161720667dcdb683f7 | train_002.jsonl | 1538750100 | Vasya has recently got a job as a cashier at a local store. His day at work is $$$L$$$ minutes long. Vasya has already memorized $$$n$$$ regular customers, the $$$i$$$-th of which comes after $$$t_{i}$$$ minutes after the beginning of the day, and his service consumes $$$l_{i}$$$ minutes. It is guaranteed that no custo... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual soluti... | Java | ["2 11 3\n0 1\n1 1", "0 5 2", "1 3 2\n1 2"] | 2 seconds | ["3", "2", "0"] | NoteIn the first sample Vasya can take $$$3$$$ breaks starting after $$$2$$$, $$$5$$$ and $$$8$$$ minutes after the beginning of the day.In the second sample Vasya can take $$$2$$$ breaks starting after $$$0$$$ and $$$2$$$ minutes after the beginning of the day.In the third sample Vasya can't take any breaks. | Java 8 | standard input | [
"implementation"
] | 00acb3b54975820989a788b9389c7c0b | The first line contains three integers $$$n$$$, $$$L$$$ and $$$a$$$ ($$$0 \le n \le 10^{5}$$$, $$$1 \le L \le 10^{9}$$$, $$$1 \le a \le L$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$t_{i}$$$ and $$$l_{i}$$$ ($$$0 \le t_{i} \le L - 1$$$, $$$1 \le l_{i} \le L$$$). It is guaranteed that $$$t_{i}... | 1,000 | Output one integer — the maximum number of breaks. | standard output | |
PASSED | b32b36651e30114d201292918e940cb7 | train_002.jsonl | 1538750100 | Vasya has recently got a job as a cashier at a local store. His day at work is $$$L$$$ minutes long. Vasya has already memorized $$$n$$$ regular customers, the $$$i$$$-th of which comes after $$$t_{i}$$$ minutes after the beginning of the day, and his service consumes $$$l_{i}$$$ minutes. It is guaranteed that no custo... | 256 megabytes | import java.util.*;
import java.io.*;
public final class GFG {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int L = sc.nextInt();
int a = sc.nextInt();
int[] t = new int[n];
int[] l = new int[n];
for(int i = 0; i<n; i++) {
t[i] = sc.nextInt()... | Java | ["2 11 3\n0 1\n1 1", "0 5 2", "1 3 2\n1 2"] | 2 seconds | ["3", "2", "0"] | NoteIn the first sample Vasya can take $$$3$$$ breaks starting after $$$2$$$, $$$5$$$ and $$$8$$$ minutes after the beginning of the day.In the second sample Vasya can take $$$2$$$ breaks starting after $$$0$$$ and $$$2$$$ minutes after the beginning of the day.In the third sample Vasya can't take any breaks. | Java 8 | standard input | [
"implementation"
] | 00acb3b54975820989a788b9389c7c0b | The first line contains three integers $$$n$$$, $$$L$$$ and $$$a$$$ ($$$0 \le n \le 10^{5}$$$, $$$1 \le L \le 10^{9}$$$, $$$1 \le a \le L$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$t_{i}$$$ and $$$l_{i}$$$ ($$$0 \le t_{i} \le L - 1$$$, $$$1 \le l_{i} \le L$$$). It is guaranteed that $$$t_{i}... | 1,000 | Output one integer — the maximum number of breaks. | standard output | |
PASSED | be12f75c202d8448ee33701680a75c8f | train_002.jsonl | 1538750100 | Vasya has recently got a job as a cashier at a local store. His day at work is $$$L$$$ minutes long. Vasya has already memorized $$$n$$$ regular customers, the $$$i$$$-th of which comes after $$$t_{i}$$$ minutes after the beginning of the day, and his service consumes $$$l_{i}$$$ minutes. It is guaranteed that no custo... | 256 megabytes | import java.io.*;
import java.util.*;
public class Cashier {
public static void main(String[] args) throws Exception {
Scanner sc=new Scanner(System.in);
PrintWriter out=new PrintWriter(System.out);
int n=sc.nextInt();
int L=sc.nextInt();
int a=sc.nextInt();
cust []c=new cust[n];
for (int i=0;i<n;i++) {... | Java | ["2 11 3\n0 1\n1 1", "0 5 2", "1 3 2\n1 2"] | 2 seconds | ["3", "2", "0"] | NoteIn the first sample Vasya can take $$$3$$$ breaks starting after $$$2$$$, $$$5$$$ and $$$8$$$ minutes after the beginning of the day.In the second sample Vasya can take $$$2$$$ breaks starting after $$$0$$$ and $$$2$$$ minutes after the beginning of the day.In the third sample Vasya can't take any breaks. | Java 8 | standard input | [
"implementation"
] | 00acb3b54975820989a788b9389c7c0b | The first line contains three integers $$$n$$$, $$$L$$$ and $$$a$$$ ($$$0 \le n \le 10^{5}$$$, $$$1 \le L \le 10^{9}$$$, $$$1 \le a \le L$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$t_{i}$$$ and $$$l_{i}$$$ ($$$0 \le t_{i} \le L - 1$$$, $$$1 \le l_{i} \le L$$$). It is guaranteed that $$$t_{i}... | 1,000 | Output one integer — the maximum number of breaks. | standard output | |
PASSED | 46136d69c1095d9c52563469aba5976e | train_002.jsonl | 1538750100 | Vasya has recently got a job as a cashier at a local store. His day at work is $$$L$$$ minutes long. Vasya has already memorized $$$n$$$ regular customers, the $$$i$$$-th of which comes after $$$t_{i}$$$ minutes after the beginning of the day, and his service consumes $$$l_{i}$$$ minutes. It is guaranteed that no custo... | 256 megabytes | import java.util.Scanner;
public class Cashier {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int L = sc.nextInt();
int a = sc.nextInt();
int[] t = new int[n];
int[] l = new int [n];
int smoke = 0;
... | Java | ["2 11 3\n0 1\n1 1", "0 5 2", "1 3 2\n1 2"] | 2 seconds | ["3", "2", "0"] | NoteIn the first sample Vasya can take $$$3$$$ breaks starting after $$$2$$$, $$$5$$$ and $$$8$$$ minutes after the beginning of the day.In the second sample Vasya can take $$$2$$$ breaks starting after $$$0$$$ and $$$2$$$ minutes after the beginning of the day.In the third sample Vasya can't take any breaks. | Java 8 | standard input | [
"implementation"
] | 00acb3b54975820989a788b9389c7c0b | The first line contains three integers $$$n$$$, $$$L$$$ and $$$a$$$ ($$$0 \le n \le 10^{5}$$$, $$$1 \le L \le 10^{9}$$$, $$$1 \le a \le L$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$t_{i}$$$ and $$$l_{i}$$$ ($$$0 \le t_{i} \le L - 1$$$, $$$1 \le l_{i} \le L$$$). It is guaranteed that $$$t_{i}... | 1,000 | Output one integer — the maximum number of breaks. | standard output | |
PASSED | c8e1d34b0c474d56e0eacfd29a6cb720 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | //44,45,47,50,53,54,55
import java.util.*;
import java.lang.*;
import java.io.*;
import java.awt.Point;
public class CF601A
{ //***************************************** VARIABLE DECLERATION SECTION ********************************************************************;
//Integer ArrayList Math TreeMap T... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"shortest paths",
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 9e1a567d3e29cd9c6b2888ae8b526f10 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Solution {
public static void main(String[] args) {
InputReader fi = new InputReader(System.in);
int i,j,n,m1,m2;
n=fi.nextInt();
m1=fi.nextInt();
m2=((n)*(n-1)/2) - m1;
Graph train=new Graph(n,m1... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"shortest paths",
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 4067e8547edddc7859fa16254aa0e230 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.*;
import java.util.InputMismatchException;
public class cf_prac_bfs{
static long big=1000000007;
... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"shortest paths",
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | cabf71460126b5d7b23426639c46e79f | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.util.*;
import java.io.*;
public class gfg {
static int n;
static int m;
static boolean[][] road;
static boolean[][] train;
static boolean[] visroad;
static boolean[] vistrain;
static int[] levelroad;
static int[] leveltrain;
static void solve()throws IOException{
... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"shortest paths",
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 6dba0c7068107a9970e75c1c8b7a66ad | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
import javax.swing.plaf.synth.SynthSpinnerUI;
public class Problem2 {
static Scanner sc=new Scanner(System.in);
static final double EPS = 1e-9;
static ArrayList<Integer> bus[];
static boolean railway[][];
public static void main(String[] args) t... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"shortest paths",
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | e6f0fcf4a74582e3fb356a2f6a142534 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;
import javafx.util.Pair;
/**
*
* @author Public
*/
public class TheTwoRoutes601A {
public static void main(String[] args) throws Exc... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"shortest paths",
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | cd3b4c4ba74070e8ead71652f8badca1 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | //package codeforces.Round333;
import java.util.LinkedList;
import java.util.Scanner;
public class TheTwoRoutes {
private static int n;
private static boolean[][] adj;
private static int bfs(boolean edge) {
int[] distance = new int[n];
boolean[] visited = new boolean[n];
LinkedL... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"shortest paths",
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 50b095bb03fa6116662e084fa0cc0c80 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static int graph[][];
static int target;
static boolean vis[];
static boolean flag = false;
static int point = 1;
// public static int dfs1(int node) {
// vis[node] = true;
// if (node == target) {
// flag = tru... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"shortest paths",
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | dd9aecdcaa8e18638b4b83a4c6a144e5 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.*;
public class A {
public static boolean[][] adj;
public static int n;
public static int bfs(int vertex,boolean edge) {
ArrayDeque<Integer> stack = new ArrayDeque<>();
int[] cost = new int[n];
Arrays.fill(cost, Integer.MAX_VALUE);
cost[vertex] = 0;
... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"shortest paths",
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 52ef8c5c59798ef24f3f6113ba40ef4b | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes |
import javax.print.DocFlavor;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Inet4Address;
import java.nio.charset.IllegalCharsetNameException;
import java.time.temporal.Temporal;
import java.util.*;
import java.util.concurrent.l... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"shortest paths",
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | e3165febb38ecf3b3b8431a6ec1bc0af | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.util.Scanner;
public class Main {
private final static int INF = 1000000005;
public static void main (String[] args) throws java.lang.Exception
{
Scanner input = new Scanner(System.in);
String in = input.nextLine();
String[] to = in.split(" ");
int n = Integer.parseInt(to[0]);
... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"shortest paths",
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 6e5da6b23d1c2ea250337c05300b9a6d | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class A601 {
static char[] sarr;
public static void main(String[] args) throws IOException {
FastScanner fs=new FastScanner();
PrintWriter out = new PrintWriter(System.out);
// int T = 1;
// int T=fs.nextInt();
... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"shortest paths",
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 52249b66239ed872a00a302975de0494 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.util.*;
public class TheTwoRoutes {
static int n, m;
static List<Integer>[] rail;
static int[] vis;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
m = sc.nextInt();
rail = (List<Integer>[]) (new List[n]);
... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"shortest paths",
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 64a59becf5b082a2017e2a7a9859054f | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.util.*;
public class TheTwoRoutes {
static int n, m;
static List<Integer>[] rail;
static int[] vis;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
m = sc.nextInt();
rail = (List<Integer>[]) (new List[n]);
... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"shortest paths",
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | e9c9df1a95569cefef8a6dab3c6ebb65 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
static class Reader
{
private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;}
public int read() {if (nu... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"shortest paths",
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | d9dd56416a7d6393b94107e76da10684 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.io.*;
import java.util.*;
public class A601
{
static int dp[][];
static void bfs(int adj[][],int n,int r)
{
Queue<Integer> qu=new LinkedList<>();
qu.add(1);
boolean vis[]=new boolean[n+1];
vis[1]=true;
if(r==0)
{
dp[0][1]=0;
... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"shortest paths",
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | aee21bb80f1a887ac3b463bfe2d45dab | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes |
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class A601 {
public static void main(String[] args) throws IOException{
BufferedReader inp = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"shortest paths",
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 4339c54d32ea1e94ecaf7a799dcae30f | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.util.*;
public class A573
{
static int n;
static boolean[][] rails;
public static void main( String[] args )
{
Scanner in = new Scanner( System.in );
n = in.nextInt();
int m = in.nextInt();
rails = new boolean[n + 1][n + 1];
for ( int i = 0; i < ... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"shortest paths",
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 91c6c087f934f4cf5dd7759d4e526a60 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.io.*;
import java.util.*;
public final class TwoRoutes {
static class Stop {
int t;
int d;
Stop(int t, int d) { this.t = t; this.d = d; }
}
static int n;
static boolean[][] rail;
static boolean[] visited;
static int bfs(boolean isRail) {
// System.out.println("Visiting " + town);
... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"shortest paths",
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | a7b9d749c8802e760906d7ff10217c29 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class CF601A {
static int N;
static int M;
static boolean[][] roads;
static int[] visited;
static Queue<Integer> Q;
public static void main(String[] args) {
/*
for(int i = 2; i < 4... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"shortest paths",
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 49bd9426ebb4cb0dcf53b8aac23993ed | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.util.*;
public class the_two_routes
{
static int n;
static boolean[][] rails;
public static void main( String[] args )
{
Scanner in = new Scanner( System.in );
n = in.nextInt();
int m = in.nextInt();
rails = new boolean[n + 1][n + 1];
for ( int i = ... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"shortest paths",
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 3f76c419360c68e430802cf5f1cb320d | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.util.Scanner;
public class Main {
public static int floyd(int[][] tmp,int n) {
for(int k = 1;k <= n;k++) {
for(int i = 1;i <= n;i++) {
for(int j = 1;j <= n;j++) {
//中间点和起点或者终点都不可连
if(tmp[i][k] == 0 || tmp[k][j] == 0)
continue;
//如果起点和终点不可连... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"shortest paths",
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | c73d4602d89577c979a5b53414fa1f6a | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.util.Scanner;
public class Main {
public static int floyd(int[][] tmp,int n) {
for(int k = 1;k <= n;k++) {
for(int i = 1;i <= n;i++) {
for(int j = 1;j <= n;j++) {
//中间点和起点或者终点都不可连
if(tmp[i][k] == 0 || tmp[k][j] == 0)
continue;
//如果起点和终点不可连... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"shortest paths",
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 773e287423e4c6f2f6e4450f0807d36f | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.util.*;
public class TheTwoRoutes {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
Set<Integer>[] railAdj = new Set[n+1];
Set<Integer>[] roadAdj = new Set[n+1];
for(int i = 0; i <= n; i++) {
railAdj[i... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"shortest paths",
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 12d17fc139ad4cfd079134e106db86d0 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.util.*;
public class Main11233 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int[][] V = new int[n+1][n+1];
for (int i = 1; i <= m; i++) {
int a = sc.nextInt();
i... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"shortest paths",
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 4be9d0a66da44eb75b5d4d1990082b07 | train_002.jsonl | 1561905900 | Vasya has an array $$$a_1, a_2, \dots, a_n$$$.You don't know this array, but he told you $$$m$$$ facts about this array. The $$$i$$$-th fact is a triple of numbers $$$t_i$$$, $$$l_i$$$ and $$$r_i$$$ ($$$0 \le t_i \le 1, 1 \le l_i < r_i \le n$$$) and it means: if $$$t_i=1$$$ then subbarray $$$a_{l_i}, a_{l_i + 1}, \... | 256 megabytes |
//When I wrote this code, only God & I understood what it did. Now only God knows !!
import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
static class FastReader
{
private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public FastReader() {... | Java | ["7 4\n1 1 3\n1 2 5\n0 5 6\n1 6 7", "4 2\n1 1 4\n0 2 3"] | 1 second | ["YES\n1 2 2 3 5 4 4", "NO"] | null | Java 8 | standard input | [
"constructive algorithms",
"implementation",
"greedy"
] | 1522d9845b4ea1a903d4c81644797983 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n \le 1000, 1 \le m \le 1000$$$). Each of the next $$$m$$$ lines contains three integers $$$t_i$$$, $$$l_i$$$ and $$$r_i$$$ ($$$0 \le t_i \le 1, 1 \le l_i < r_i \le n$$$). If $$$t_i = 1$$$ then subbarray $$$a_{l_i}, a_{l_i + 1}, \dots , a_{r_i}$$$ is... | 1,800 | If there is no array that satisfies these facts in only line print NO (in any letter case). If there is a solution, print YES (in any letter case). In second line print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the array $$$a$$$, satisfying all the given facts. If there are multiple satis... | standard output | |
PASSED | 77c10c1ad80d0af5dd7ea18d74f6a2a6 | train_002.jsonl | 1561905900 | Vasya has an array $$$a_1, a_2, \dots, a_n$$$.You don't know this array, but he told you $$$m$$$ facts about this array. The $$$i$$$-th fact is a triple of numbers $$$t_i$$$, $$$l_i$$$ and $$$r_i$$$ ($$$0 \le t_i \le 1, 1 \le l_i < r_i \le n$$$) and it means: if $$$t_i=1$$$ then subbarray $$$a_{l_i}, a_{l_i + 1}, \... | 256 megabytes | import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;
public class Solution
{
public static void main(String[] args) throws Exception
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
PrintWriter w = new PrintWriter(S... | Java | ["7 4\n1 1 3\n1 2 5\n0 5 6\n1 6 7", "4 2\n1 1 4\n0 2 3"] | 1 second | ["YES\n1 2 2 3 5 4 4", "NO"] | null | Java 8 | standard input | [
"constructive algorithms",
"implementation",
"greedy"
] | 1522d9845b4ea1a903d4c81644797983 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n \le 1000, 1 \le m \le 1000$$$). Each of the next $$$m$$$ lines contains three integers $$$t_i$$$, $$$l_i$$$ and $$$r_i$$$ ($$$0 \le t_i \le 1, 1 \le l_i < r_i \le n$$$). If $$$t_i = 1$$$ then subbarray $$$a_{l_i}, a_{l_i + 1}, \dots , a_{r_i}$$$ is... | 1,800 | If there is no array that satisfies these facts in only line print NO (in any letter case). If there is a solution, print YES (in any letter case). In second line print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the array $$$a$$$, satisfying all the given facts. If there are multiple satis... | standard output | |
PASSED | 087404394d10621ff4e891773e5c9f89 | train_002.jsonl | 1561905900 | Vasya has an array $$$a_1, a_2, \dots, a_n$$$.You don't know this array, but he told you $$$m$$$ facts about this array. The $$$i$$$-th fact is a triple of numbers $$$t_i$$$, $$$l_i$$$ and $$$r_i$$$ ($$$0 \le t_i \le 1, 1 \le l_i < r_i \le n$$$) and it means: if $$$t_i=1$$$ then subbarray $$$a_{l_i}, a_{l_i + 1}, \... | 256 megabytes | import java.math.*;
import java.util.*;
import java.io.*;
public class Main {
void solve(){
int n=ni(),m=ni();
int a[]=new int[n+1];
int t[]=new int[m+1];
int l[]=new int[m+1];
int r[]=new int[m+1];
for(int i=1;i<=m;i++){
t[i]=ni(); l[i]=ni(); r[i]=ni();
... | Java | ["7 4\n1 1 3\n1 2 5\n0 5 6\n1 6 7", "4 2\n1 1 4\n0 2 3"] | 1 second | ["YES\n1 2 2 3 5 4 4", "NO"] | null | Java 8 | standard input | [
"constructive algorithms",
"implementation",
"greedy"
] | 1522d9845b4ea1a903d4c81644797983 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n \le 1000, 1 \le m \le 1000$$$). Each of the next $$$m$$$ lines contains three integers $$$t_i$$$, $$$l_i$$$ and $$$r_i$$$ ($$$0 \le t_i \le 1, 1 \le l_i < r_i \le n$$$). If $$$t_i = 1$$$ then subbarray $$$a_{l_i}, a_{l_i + 1}, \dots , a_{r_i}$$$ is... | 1,800 | If there is no array that satisfies these facts in only line print NO (in any letter case). If there is a solution, print YES (in any letter case). In second line print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the array $$$a$$$, satisfying all the given facts. If there are multiple satis... | standard output | |
PASSED | fcb0b22e50e7ec05bf02eaad115cb6a0 | train_002.jsonl | 1291536000 | Today there is going to be an unusual performance at the circus — hamsters and tigers will perform together! All of them stand in circle along the arena edge and now the trainer faces a difficult task: he wants to swap the animals' positions so that all the hamsters stood together and all the tigers also stood together... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class CF_46_C_HAMSTERS_TIGERS {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
... | Java | ["3\nHTH", "9\nHTHTHTHHT"] | 2 seconds | ["0", "2"] | NoteIn the first example we shouldn't move anybody because the animals of each species already stand apart from the other species. In the second example you may swap, for example, the tiger in position 2 with the hamster in position 5 and then — the tiger in position 9 with the hamster in position 7. | Java 8 | standard input | [
"two pointers"
] | 0fce263a9606fbfc3ec912894ab1a8f8 | The first line contains number n (2 ≤ n ≤ 1000) which indicates the total number of animals in the arena. The second line contains the description of the animals' positions. The line consists of n symbols "H" and "T". The "H"s correspond to hamsters and the "T"s correspond to tigers. It is guaranteed that at least one ... | 1,600 | Print the single number which is the minimal number of swaps that let the trainer to achieve his goal. | standard output | |
PASSED | f3d887c60fcaa0509666144fe39d2c0d | train_002.jsonl | 1291536000 | Today there is going to be an unusual performance at the circus — hamsters and tigers will perform together! All of them stand in circle along the arena edge and now the trainer faces a difficult task: he wants to swap the animals' positions so that all the hamsters stood together and all the tigers also stood together... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class SPCC {
public static void main (String[] args) throws java.lang.Exception {
InputReader in = new InputReader(System.in);
PrintWriter w = new PrintWriter(System.out);
int n = in.nextInt();
char[] ca = in.next().to... | Java | ["3\nHTH", "9\nHTHTHTHHT"] | 2 seconds | ["0", "2"] | NoteIn the first example we shouldn't move anybody because the animals of each species already stand apart from the other species. In the second example you may swap, for example, the tiger in position 2 with the hamster in position 5 and then — the tiger in position 9 with the hamster in position 7. | Java 8 | standard input | [
"two pointers"
] | 0fce263a9606fbfc3ec912894ab1a8f8 | The first line contains number n (2 ≤ n ≤ 1000) which indicates the total number of animals in the arena. The second line contains the description of the animals' positions. The line consists of n symbols "H" and "T". The "H"s correspond to hamsters and the "T"s correspond to tigers. It is guaranteed that at least one ... | 1,600 | Print the single number which is the minimal number of swaps that let the trainer to achieve his goal. | standard output | |
PASSED | fccb8919f090609dd2850c503623a069 | train_002.jsonl | 1291536000 | Today there is going to be an unusual performance at the circus — hamsters and tigers will perform together! All of them stand in circle along the arena edge and now the trainer faces a difficult task: he wants to swap the animals' positions so that all the hamsters stood together and all the tigers also stood together... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class C {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String s = sc.next();
char[] original = s.toCharArray();
char[] sort = s.toCharArray();
Arrays.sort(sort);
int min = n;
for(int ... | Java | ["3\nHTH", "9\nHTHTHTHHT"] | 2 seconds | ["0", "2"] | NoteIn the first example we shouldn't move anybody because the animals of each species already stand apart from the other species. In the second example you may swap, for example, the tiger in position 2 with the hamster in position 5 and then — the tiger in position 9 with the hamster in position 7. | Java 8 | standard input | [
"two pointers"
] | 0fce263a9606fbfc3ec912894ab1a8f8 | The first line contains number n (2 ≤ n ≤ 1000) which indicates the total number of animals in the arena. The second line contains the description of the animals' positions. The line consists of n symbols "H" and "T". The "H"s correspond to hamsters and the "T"s correspond to tigers. It is guaranteed that at least one ... | 1,600 | Print the single number which is the minimal number of swaps that let the trainer to achieve his goal. | standard output | |
PASSED | 1077af543d21ca4ecfdd27c4f6bbf370 | train_002.jsonl | 1291536000 | Today there is going to be an unusual performance at the circus — hamsters and tigers will perform together! All of them stand in circle along the arena edge and now the trainer faces a difficult task: he wants to swap the animals' positions so that all the hamsters stood together and all the tigers also stood together... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Deque;
import java.util.LinkedList;
import java.util.StringTokenizer;
public class HamstersandTigers {
public static void main(String[] args) throws IOException {
Scanner sc=new ... | Java | ["3\nHTH", "9\nHTHTHTHHT"] | 2 seconds | ["0", "2"] | NoteIn the first example we shouldn't move anybody because the animals of each species already stand apart from the other species. In the second example you may swap, for example, the tiger in position 2 with the hamster in position 5 and then — the tiger in position 9 with the hamster in position 7. | Java 8 | standard input | [
"two pointers"
] | 0fce263a9606fbfc3ec912894ab1a8f8 | The first line contains number n (2 ≤ n ≤ 1000) which indicates the total number of animals in the arena. The second line contains the description of the animals' positions. The line consists of n symbols "H" and "T". The "H"s correspond to hamsters and the "T"s correspond to tigers. It is guaranteed that at least one ... | 1,600 | Print the single number which is the minimal number of swaps that let the trainer to achieve his goal. | standard output | |
PASSED | 4e19f669471e283b2e1343957e59a9bc | train_002.jsonl | 1291536000 | Today there is going to be an unusual performance at the circus — hamsters and tigers will perform together! All of them stand in circle along the arena edge and now the trainer faces a difficult task: he wants to swap the animals' positions so that all the hamsters stood together and all the tigers also stood together... | 256 megabytes | import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class A
{ static int v;
static ArrayList<Edge> adjList[];
static int node1... | Java | ["3\nHTH", "9\nHTHTHTHHT"] | 2 seconds | ["0", "2"] | NoteIn the first example we shouldn't move anybody because the animals of each species already stand apart from the other species. In the second example you may swap, for example, the tiger in position 2 with the hamster in position 5 and then — the tiger in position 9 with the hamster in position 7. | Java 8 | standard input | [
"two pointers"
] | 0fce263a9606fbfc3ec912894ab1a8f8 | The first line contains number n (2 ≤ n ≤ 1000) which indicates the total number of animals in the arena. The second line contains the description of the animals' positions. The line consists of n symbols "H" and "T". The "H"s correspond to hamsters and the "T"s correspond to tigers. It is guaranteed that at least one ... | 1,600 | Print the single number which is the minimal number of swaps that let the trainer to achieve his goal. | standard output | |
PASSED | 59a6384bb4a3e54f0a1d7d22a48eca08 | train_002.jsonl | 1291536000 | Today there is going to be an unusual performance at the circus — hamsters and tigers will perform together! All of them stand in circle along the arena edge and now the trainer faces a difficult task: he wants to swap the animals' positions so that all the hamsters stood together and all the tigers also stood together... | 256 megabytes | import java.util.Scanner;
public class A
{
static String makeTigers(int s, int l, int n)
{
String res = "";
for (int i = 0; i < n; i++)
{
if ((s + l) >= n)
{
if (i < (s + l) % n || i >= s)
res += 'T';
else
... | Java | ["3\nHTH", "9\nHTHTHTHHT"] | 2 seconds | ["0", "2"] | NoteIn the first example we shouldn't move anybody because the animals of each species already stand apart from the other species. In the second example you may swap, for example, the tiger in position 2 with the hamster in position 5 and then — the tiger in position 9 with the hamster in position 7. | Java 8 | standard input | [
"two pointers"
] | 0fce263a9606fbfc3ec912894ab1a8f8 | The first line contains number n (2 ≤ n ≤ 1000) which indicates the total number of animals in the arena. The second line contains the description of the animals' positions. The line consists of n symbols "H" and "T". The "H"s correspond to hamsters and the "T"s correspond to tigers. It is guaranteed that at least one ... | 1,600 | Print the single number which is the minimal number of swaps that let the trainer to achieve his goal. | standard output | |
PASSED | 2c145d789b1b710ab31a29fb11125e6d | train_002.jsonl | 1281970800 | A bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters «+» and «1» into this sequence. For example, sequences «(())()», «()» and «(()(()))» are regular, while «)(», «(()» and «(()))(» are not.One day Johnny got bracket sequence. He decided to remove some o... | 256 megabytes |
import java.util.*;
public class Main {
public static void main(String[] args)
{
Scanner in=new Scanner(System.in);
String s = in.next();
int count1=0, count2=0;
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) == '('){
count1++;
}... | Java | ["(()))(", "((()())"] | 5 seconds | ["4", "6"] | null | Java 11 | standard input | [
"greedy"
] | 2ce2d0c4ac5e630bafad2127a1b589dd | Input consists of a single line with non-empty string of «(» and «)» characters. Its length does not exceed 106. | 1,400 | Output the maximum possible length of a regular bracket sequence. | standard output | |
PASSED | 4448f6ada4a65d44a3a19cb454788fb7 | train_002.jsonl | 1281970800 | A bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters «+» and «1» into this sequence. For example, sequences «(())()», «()» and «(()(()))» are regular, while «)(», «(()» and «(()))(» are not.One day Johnny got bracket sequence. He decided to remove some o... | 256 megabytes | import java.util.*;
import java.lang.*;
public class bracketSeq{
public static void main(String[]args){
Scanner sc = new Scanner(System.in);
String bra = sc.nextLine();
Stack<Character> s = new Stack<Character>();
for(int i = 0 ; i < bra.length();i++){
if(!s.empty()){
char l = s... | Java | ["(()))(", "((()())"] | 5 seconds | ["4", "6"] | null | Java 11 | standard input | [
"greedy"
] | 2ce2d0c4ac5e630bafad2127a1b589dd | Input consists of a single line with non-empty string of «(» and «)» characters. Its length does not exceed 106. | 1,400 | Output the maximum possible length of a regular bracket sequence. | standard output | |
PASSED | 52b275a3df0f164600cb535af61b735d | train_002.jsonl | 1281970800 | A bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters «+» and «1» into this sequence. For example, sequences «(())()», «()» and «(()(()))» are regular, while «)(», «(()» and «(()))(» are not.One day Johnny got bracket sequence. He decided to remove some o... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.TreeSet;
import java.io.Writer;
import java.io.OutputStreamWr... | Java | ["(()))(", "((()())"] | 5 seconds | ["4", "6"] | null | Java 11 | standard input | [
"greedy"
] | 2ce2d0c4ac5e630bafad2127a1b589dd | Input consists of a single line with non-empty string of «(» and «)» characters. Its length does not exceed 106. | 1,400 | Output the maximum possible length of a regular bracket sequence. | standard output | |
PASSED | 1b2d3a391917dc2d72cce427389af912 | train_002.jsonl | 1281970800 | A bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters «+» and «1» into this sequence. For example, sequences «(())()», «()» and «(()(()))» are regular, while «)(», «(()» and «(()))(» are not.One day Johnny got bracket sequence. He decided to remove some o... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.Input... | Java | ["(()))(", "((()())"] | 5 seconds | ["4", "6"] | null | Java 11 | standard input | [
"greedy"
] | 2ce2d0c4ac5e630bafad2127a1b589dd | Input consists of a single line with non-empty string of «(» and «)» characters. Its length does not exceed 106. | 1,400 | Output the maximum possible length of a regular bracket sequence. | standard output | |
PASSED | 636f18a7904cf24cea16d49b2d9b67c2 | train_002.jsonl | 1281970800 | A bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters «+» and «1» into this sequence. For example, sequences «(())()», «()» and «(()(()))» are regular, while «)(», «(()» and «(()))(» are not.One day Johnny got bracket sequence. He decided to remove some o... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.HashSet;
import java.io.Writer;
import java.io.OutputStreamWr... | Java | ["(()))(", "((()())"] | 5 seconds | ["4", "6"] | null | Java 11 | standard input | [
"greedy"
] | 2ce2d0c4ac5e630bafad2127a1b589dd | Input consists of a single line with non-empty string of «(» and «)» characters. Its length does not exceed 106. | 1,400 | Output the maximum possible length of a regular bracket sequence. | standard output | |
PASSED | faa9d9f35f3a50f53f118c5f4c1820d1 | train_002.jsonl | 1281970800 | A bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters «+» and «1» into this sequence. For example, sequences «(())()», «()» and «(()(()))» are regular, while «)(», «(()» and «(()))(» are not.One day Johnny got bracket sequence. He decided to remove some o... | 256 megabytes |
import java.util.*;
public class regularseq {
public static void main(String args[]) {
Scanner S= new Scanner(System.in);
String s=S.nextLine();
int max=0;
int curr=0;
for(int x=s.length()-1;x>=0;x--) {
int co=0;
int cc=0;
//System.out.println(x);
while(cc>=co&&x>=0) {
// System.out... | Java | ["(()))(", "((()())"] | 5 seconds | ["4", "6"] | null | Java 11 | standard input | [
"greedy"
] | 2ce2d0c4ac5e630bafad2127a1b589dd | Input consists of a single line with non-empty string of «(» and «)» characters. Its length does not exceed 106. | 1,400 | Output the maximum possible length of a regular bracket sequence. | standard output | |
PASSED | 396b3da145d8ee8e351561f4b9d61656 | train_002.jsonl | 1281970800 | A bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters «+» and «1» into this sequence. For example, sequences «(())()», «()» and «(()(()))» are regular, while «)(», «(()» and «(()))(» are not.One day Johnny got bracket sequence. He decided to remove some o... | 256 megabytes | import java.util.*;
import java.io.*;
public class Regular_Bracket_Sequence {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
... | Java | ["(()))(", "((()())"] | 5 seconds | ["4", "6"] | null | Java 11 | standard input | [
"greedy"
] | 2ce2d0c4ac5e630bafad2127a1b589dd | Input consists of a single line with non-empty string of «(» and «)» characters. Its length does not exceed 106. | 1,400 | Output the maximum possible length of a regular bracket sequence. | standard output | |
PASSED | 654967ba3bcfe5f65a624c82aa5c080a | train_002.jsonl | 1281970800 | A bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters «+» and «1» into this sequence. For example, sequences «(())()», «()» and «(()(()))» are regular, while «)(», «(()» and «(()))(» are not.One day Johnny got bracket sequence. He decided to remove some o... | 256 megabytes |
import java.util.Scanner;
import java.io.BufferedReader;
import java.io.*;
import java.io.InputStream;
public class WTF{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
String str = input.nextLine();
int openningBraket=0,ans=0;
for(int i=0;i<str.length();i++){
if(s... | Java | ["(()))(", "((()())"] | 5 seconds | ["4", "6"] | null | Java 11 | standard input | [
"greedy"
] | 2ce2d0c4ac5e630bafad2127a1b589dd | Input consists of a single line with non-empty string of «(» and «)» characters. Its length does not exceed 106. | 1,400 | Output the maximum possible length of a regular bracket sequence. | standard output | |
PASSED | c061e44b50c1a4d9ff5e51ba6ee948dc | train_002.jsonl | 1281970800 | A bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters «+» and «1» into this sequence. For example, sequences «(())()», «()» and «(()(()))» are regular, while «)(», «(()» and «(()))(» are not.One day Johnny got bracket sequence. He decided to remove some o... | 256 megabytes | import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
//import java.util.*;
public class sex {
public static void main (String args[]) throws Exception{
// Scanner s = new Scanner(System.in);
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["(()))(", "((()())"] | 5 seconds | ["4", "6"] | null | Java 11 | standard input | [
"greedy"
] | 2ce2d0c4ac5e630bafad2127a1b589dd | Input consists of a single line with non-empty string of «(» and «)» characters. Its length does not exceed 106. | 1,400 | Output the maximum possible length of a regular bracket sequence. | standard output | |
PASSED | 8c0ef92c6fdec67ffc5c132a1d7e7a2c | train_002.jsonl | 1281970800 | A bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters «+» and «1» into this sequence. For example, sequences «(())()», «()» and «(()(()))» are regular, while «)(», «(()» and «(()))(» are not.One day Johnny got bracket sequence. He decided to remove some o... | 256 megabytes |
/**
* @author egaeus
* @mail sebegaeusprogram@gmail.com
* @veredict Accepted
* @url <https://codeforces.com/problemset/problem/26/B>
* @category strings
* @date 23/10/2019
**/
import java.io.BufferedReader;
import java.io.InputStreamReader;
import static java.lang.Integer.parseInt;
public class CF26B {
p... | Java | ["(()))(", "((()())"] | 5 seconds | ["4", "6"] | null | Java 11 | standard input | [
"greedy"
] | 2ce2d0c4ac5e630bafad2127a1b589dd | Input consists of a single line with non-empty string of «(» and «)» characters. Its length does not exceed 106. | 1,400 | Output the maximum possible length of a regular bracket sequence. | standard output | |
PASSED | a3ae54896cc3162fe7952c68e53dda5c | train_002.jsonl | 1281970800 | A bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters «+» and «1» into this sequence. For example, sequences «(())()», «()» and «(()(()))» are regular, while «)(», «(()» and «(()))(» are not.One day Johnny got bracket sequence. He decided to remove some o... | 256 megabytes | import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.util.*;
/**
* @author Tran Anh Tai
* @template for CP codes
* What a trick prob!
*/
public class ProbA {
public static void main(String[] args) {
InputStream inputStream = System.in;
... | Java | ["(()))(", "((()())"] | 5 seconds | ["4", "6"] | null | Java 11 | standard input | [
"greedy"
] | 2ce2d0c4ac5e630bafad2127a1b589dd | Input consists of a single line with non-empty string of «(» and «)» characters. Its length does not exceed 106. | 1,400 | Output the maximum possible length of a regular bracket sequence. | standard output | |
PASSED | 26edd04ec3374ad3c94aeb83ab278805 | train_002.jsonl | 1281970800 | A bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters «+» and «1» into this sequence. For example, sequences «(())()», «()» and «(()(()))» are regular, while «)(», «(()» and «(()))(» are not.One day Johnny got bracket sequence. He decided to remove some o... | 256 megabytes | import java.util.*;
public class sb {
public static void main(String[] args) {
Scanner no=new Scanner(System.in);
String s=no.next();
int o=0;
int c=0;
for(int i=0;i<s.length();i++){
if(s.charAt(i)=='('){
o++;
}
else if(s.charAt(i)==')'){
if(o>0){
o--;
c+=2;
}
... | Java | ["(()))(", "((()())"] | 5 seconds | ["4", "6"] | null | Java 11 | standard input | [
"greedy"
] | 2ce2d0c4ac5e630bafad2127a1b589dd | Input consists of a single line with non-empty string of «(» and «)» characters. Its length does not exceed 106. | 1,400 | Output the maximum possible length of a regular bracket sequence. | standard output | |
PASSED | d36e9ef36de7702e92ef6e99bdfb60bb | train_002.jsonl | 1281970800 | A bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters «+» and «1» into this sequence. For example, sequences «(())()», «()» and «(()(()))» are regular, while «)(», «(()» and «(()))(» are not.One day Johnny got bracket sequence. He decided to remove some o... | 256 megabytes | import java.util.*;
public class RegularBracketSequence {
static void solve(){
Scanner sc = new Scanner(System.in);
// len - maximum length so far, l = current length
int ocount = 0, len = Integer.MIN_VALUE, l = 0;
for(char ch: sc.next().toCharArray()){
if(ch=='('){
... | Java | ["(()))(", "((()())"] | 5 seconds | ["4", "6"] | null | Java 11 | standard input | [
"greedy"
] | 2ce2d0c4ac5e630bafad2127a1b589dd | Input consists of a single line with non-empty string of «(» and «)» characters. Its length does not exceed 106. | 1,400 | Output the maximum possible length of a regular bracket sequence. | standard output | |
PASSED | c261473f2d7d302b8708f53aea2ebfd9 | train_002.jsonl | 1281970800 | A bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters «+» and «1» into this sequence. For example, sequences «(())()», «()» and «(()(()))» are regular, while «)(», «(()» and «(()))(» are not.One day Johnny got bracket sequence. He decided to remove some o... | 256 megabytes | import java.util.*;
public class RegularBracketSequence {
// A little optimized.
static void solve(){
Scanner sc = new Scanner(System.in);
// len - maximum length so far
int ocount = 0, len = 0;
for(char ch: sc.next().toCharArray()){
if(ch=='('){
... | Java | ["(()))(", "((()())"] | 5 seconds | ["4", "6"] | null | Java 11 | standard input | [
"greedy"
] | 2ce2d0c4ac5e630bafad2127a1b589dd | Input consists of a single line with non-empty string of «(» and «)» characters. Its length does not exceed 106. | 1,400 | Output the maximum possible length of a regular bracket sequence. | standard output | |
PASSED | e3e9a649715fb13bf08c09dbe6821b15 | train_002.jsonl | 1281970800 | A bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters «+» and «1» into this sequence. For example, sequences «(())()», «()» and «(()(()))» are regular, while «)(», «(()» and «(()))(» are not.One day Johnny got bracket sequence. He decided to remove some o... | 256 megabytes | import java.util.*;
import java.util.Scanner;
public class lol {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
char[] b=s.next().toCharArray();
Stack<Character> stack = new Stack<>();
int c=0;
for (int i = 0; ... | Java | ["(()))(", "((()())"] | 5 seconds | ["4", "6"] | null | Java 11 | standard input | [
"greedy"
] | 2ce2d0c4ac5e630bafad2127a1b589dd | Input consists of a single line with non-empty string of «(» and «)» characters. Its length does not exceed 106. | 1,400 | Output the maximum possible length of a regular bracket sequence. | standard output | |
PASSED | 5688198718e60512e902d16dff1eb8d0 | train_002.jsonl | 1281970800 | A bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters «+» and «1» into this sequence. For example, sequences «(())()», «()» and «(()(()))» are regular, while «)(», «(()» and «(()))(» are not.One day Johnny got bracket sequence. He decided to remove some o... | 256 megabytes | //I AM THE CREED
/* package codechef; // don't place package name! */
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.*;
public class HelloWorld{
public static void main(String[] args) throws IOException
{
... | Java | ["(()))(", "((()())"] | 5 seconds | ["4", "6"] | null | Java 11 | standard input | [
"greedy"
] | 2ce2d0c4ac5e630bafad2127a1b589dd | Input consists of a single line with non-empty string of «(» and «)» characters. Its length does not exceed 106. | 1,400 | Output the maximum possible length of a regular bracket sequence. | standard output | |
PASSED | 122e77345ebf146dc90eec88f4974730 | train_002.jsonl | 1281970800 | A bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters «+» and «1» into this sequence. For example, sequences «(())()», «()» and «(()(()))» are regular, while «)(», «(()» and «(()))(» are not.One day Johnny got bracket sequence. He decided to remove some o... | 256 megabytes | import java.util.*;
//import java.util.Scanner;
/**
*
* @author DELL
*/
public class Main{
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int track=1;
int t=1;
whi... | Java | ["(()))(", "((()())"] | 5 seconds | ["4", "6"] | null | Java 11 | standard input | [
"greedy"
] | 2ce2d0c4ac5e630bafad2127a1b589dd | Input consists of a single line with non-empty string of «(» and «)» characters. Its length does not exceed 106. | 1,400 | Output the maximum possible length of a regular bracket sequence. | standard output | |
PASSED | 7921e58a55c6b62a2f309ab817cfbe4f | train_002.jsonl | 1281970800 | A bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters «+» and «1» into this sequence. For example, sequences «(())()», «()» and «(()(()))» are regular, while «)(», «(()» and «(()))(» are not.One day Johnny got bracket sequence. He decided to remove some o... | 256 megabytes |
import java.util.*;
public class CodeForces3 {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
Stack s=new Stack();
Stack s2=new Stack();
String string=in.next();
int k=0;
for(int i=0;i<string.length();i++)
... | Java | ["(()))(", "((()())"] | 5 seconds | ["4", "6"] | null | Java 11 | standard input | [
"greedy"
] | 2ce2d0c4ac5e630bafad2127a1b589dd | Input consists of a single line with non-empty string of «(» and «)» characters. Its length does not exceed 106. | 1,400 | Output the maximum possible length of a regular bracket sequence. | standard output | |
PASSED | 46d54e85156d078b8a7f65a7e47a80ca | train_002.jsonl | 1281970800 | A bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters «+» and «1» into this sequence. For example, sequences «(())()», «()» and «(()(()))» are regular, while «)(», «(()» and «(()))(» are not.One day Johnny got bracket sequence. He decided to remove some o... | 256 megabytes | import java .io.*;
import java.util.*;
import java.lang.*;
import java.util.Arrays;
public class RATHOD
{
public static void main (String[] args)
{
Scanner sc=new Scanner(System.in);
String s=sc.next();
int i;
Stack<Character> stack = new Stack<>();
long index=-1;
long length=0;
... | Java | ["(()))(", "((()())"] | 5 seconds | ["4", "6"] | null | Java 11 | standard input | [
"greedy"
] | 2ce2d0c4ac5e630bafad2127a1b589dd | Input consists of a single line with non-empty string of «(» and «)» characters. Its length does not exceed 106. | 1,400 | Output the maximum possible length of a regular bracket sequence. | standard output | |
PASSED | d3205b3b3c6bdcde951094b0ae2b1dcf | train_002.jsonl | 1281970800 | A bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters «+» and «1» into this sequence. For example, sequences «(())()», «()» and «(()(()))» are regular, while «)(», «(()» and «(()))(» are not.One day Johnny got bracket sequence. He decided to remove some o... | 256 megabytes | import java.util.Scanner;
public class acm {
public static void main(String[] args)
{
Scanner in =new Scanner(System.in);
String x=in.next();
int l=x.length(),counter=0;
for(int i=0;i<x.length();i++)
{
if(x.charAt(i)=='(')
counter++;
else
counter--;
if(counter<0)
{
counter=0;
... | Java | ["(()))(", "((()())"] | 5 seconds | ["4", "6"] | null | Java 11 | standard input | [
"greedy"
] | 2ce2d0c4ac5e630bafad2127a1b589dd | Input consists of a single line with non-empty string of «(» and «)» characters. Its length does not exceed 106. | 1,400 | Output the maximum possible length of a regular bracket sequence. | standard output | |
PASSED | ba3a2cb7079b72cb9bc376d7e6d0e62d | train_002.jsonl | 1281970800 | A bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters «+» and «1» into this sequence. For example, sequences «(())()», «()» and «(()(()))» are regular, while «)(», «(()» and «(()))(» are not.One day Johnny got bracket sequence. He decided to remove some o... | 256 megabytes | import java.util.*;
import java.math.*;
import java.io.*;
public class A{
static FastReader scan=new FastReader();
public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
public static void main(String[] args) throws IOException
{
String s=scan.next();
char[]chars=s.toCharA... | Java | ["(()))(", "((()())"] | 5 seconds | ["4", "6"] | null | Java 11 | standard input | [
"greedy"
] | 2ce2d0c4ac5e630bafad2127a1b589dd | Input consists of a single line with non-empty string of «(» and «)» characters. Its length does not exceed 106. | 1,400 | Output the maximum possible length of a regular bracket sequence. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.