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 | 7a8b6476d757dfbf769cd18618402a64 | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes | import java.util.Scanner;
public class Main
{
static int[][] matrix=new int[105][105];
static boolean[][] map=new boolean[105][105];
public static void main(String[] args)
{
Scanner in=new Scanner(System.in);
int n=in.nextInt();
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
matrix[i][j]=in.nextInt... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | 8433decb24cf25d1cf85f0b8243b97e5 | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes | //package contest_abbyy_easy;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.StreamTokenizer;
import java.io.Writer;
/**
* Date : 30.04.2012
... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | 9f0fb4f68e77314cfc5cba4842c93edf | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.StreamTokenizer;
import java.io.Writer;
/**
* Date : 21.04.2012
* Time : 16:48:16
* Emai... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | f7d02c1a6493cdc89fbea07244fdb236 | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes | //package abbyy2.easy;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
public class AS {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
int n = ni();
int[][] a = new int[n][n];
long s = 0;... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | 1b8b2100abc1d60b3af06141940a6164 | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes | import java.util.Scanner;
public class GoodMatrixElements
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int total=0;
int row,column;
int no;
row=column=n/2+1;
boolean is=false;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
no=sc.nextInt();
i... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | efb61cb68acc2340969763aa51c2b377 | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class MatrixGoodElements {
public static void main(String[] args) {
solve();
}
public static void solve() {
BufferedReader br = null;
InputStreamRe... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | 8e74d1d9c3f56eaf5b1e1852267da9cc | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes | import java.util.Scanner;
public class GoodMatrixElements {
/**
* @param args
*/
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String st = in.nextLine();
int n = Integer.parseInt(st);
int i = 0, j= n/2;
int s = 0;
for(int a=0;a<n;a++)
{
st = in.nextLine();
... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | d3ba3b518f7517eac154bffd50cb55ec | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class A {
public static void main(String[] args) throws IOException {
BufferedReader std = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new Pr... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | 0d508dd25692430367a7fc78a0694b78 | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes | import java.io.*;
import java.util.*;
public class A
{
String line;
StringTokenizer inputParser;
BufferedReader is;
FileInputStream fstream;
DataInputStream in;
String FInput="";
void openInput(String file)
{
if(file==null)is = new BufferedReader(new InputStreamReader(System.in));//stdin
else
{
try... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | 5b15979d03744bfd8c249d14520e2b97 | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes | import java.util.*;
public class ABBY_2_a {
public static void main(String agrs[]){
Scanner in=new Scanner(System.in);
int n = in.nextInt();
int a[][]=new int[n][n];
for (int i=0; i<n;i++)
for (int j=0; j<n; j++)
a[i][j] = in.nextInt();
long sum = 0;
boolean t[][]=new boolean[n][n];
for (int i=... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | 6a55dc24fd3660bcb110200e73e57682 | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes | import java.util.Scanner;
import java.util.StringTokenizer;
public class A1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int size = sc.nextInt();
int[][] matrix = new int[size][size];
for(int i = 0; i < size; i++){
... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | 5c2a573e5a30573ed7aea3e1fc032890 | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes |
import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import static java.lang.Math.*;
public class A implements Runnable{
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
BufferedReader in;
PrintWriter out;
StringTokenizer tok = n... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | 0b19cb3c39570f6e95ba1471828e0976 | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Домашний
*/
import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import static java.lang.Math.*;
public class A {
final boolean ONLINE_JUDGE = System.get... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | 96d2a978a12d1acdb9e52bcf5510e137 | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes | import java.util.Scanner;
public class A_Abba {
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
int n=sc.nextInt();
int a[][]=new int[n+1][n+1];
long sum=0;
for (int i = 1; i <=n; i++) {
for (int j = 1; j <=n; j++) {
a[i][j]=sc.nextInt();
if(i==j)
sum+=a[i][j];
}
}... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | 5562a1a25894a3090121987b20379759 | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes | import java.io.*;
public class First{
public static void main(String a[]){
try{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
int n=Integer.parseInt(in.readLine());
int s=(n-1)/2;
int sum=0;
for(int i=0;i<n;i++){
String z=in.readLine();
String zz[]=z.split(" ");
... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | 0b00774fdca2956f2e164c2b7201cf81 | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes |
import java.util.Scanner;
public class A177 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[][] a = new int[n][n];
boolean[][] u = new boolean[n][n];
for (int i = 0 ; i < n ; i++)
for (int j = 0 ; j < n ;... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | 13572ad097d46794aca0bd8f29e4f558 | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a;
long sum = 0;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
a = sc.nextInt();
... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | 4ee943ad30a0ac11a42f5819c29dd2df | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes | import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long sum = 0;
if (n <= 3)
for (int i = 0; i < n * n; i++)
sum += sc.nextLong();
else {
int p... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | 376207c01f838c41927465971caa2341 | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.Math.*;
public class good
{
public static void main(String args[])throws Exception
{
Scanner in=new Scanner(System.in);
//BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
//BufferedReader br = new Buffered... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | 4b3c2c2ee09bf07f5748baf5c67d19b7 | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.u... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | 3a007661c1c54667fa46b2d5a2fe0880 | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes | import java.util.*;
public class Main{
public static void main(String args[]){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int a[][] = new int[n][n];
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
a[i][j]=in.nextInt();
int mid = (n-1)/2;
int ans = 0;
for(int i=0;i<n;i++)
if(i!=mid)
ans... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | cddb5082871a382b1069c458ff7df631 | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class ab3 {
public static void debug(Object... obs)
{
System.out.println(Arrays.deepToString(obs));
}
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | 1bac27a7e757d85eecbfbf4e3a93ec89 | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) {
BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
try {
int size = Integer.parseInt(br.readLine());
int rezultat = 0, middle = size/2;
for(int i =... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | 139f7c3217e6627b8b92c0a8ba289759 | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class A {
static BufferedReader reader;
static StringTokenizer tokenizer;
static PrintWriter writer;
static void init() {
reader = n... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | 6c8f7f15cd61d291da2b5e42d0238b77 | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class ABBYY_Cup_2012_Div2_A implements Runnable {
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
BufferedReader in;
PrintWriter out;
StringTokenizer tok;
public static void main(String[] args) {
new Thread... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | bb0ea277fadb7a48766767345492d69c | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes | import java.io.*;
import java.util.InputMismatchException;
/**
* Created with IntelliJ IDEA.
* User: DOAN Minh Quy
* Date: 7/29/13
* Time: 7:13 PM
*/
public class Task177A {
public static void main(String[] args) {
new Task177A().run();
}
void run() {
Task177AReader reader = new Task1... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | 858f08f7d7517a1cb2cec75f4b1de3c9 | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public void solve( ) throws Throwable {
int n = in.nextInt( ), sum = 0;
//int mat[ ][ ] = new int[ n ][ n ];
//boolean vis[ ][ ] = new boolean[ n ][ n ];
for ( int i = 0; i < n; ++i ) {
for ( int j = 0; j < n; ++j... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | acae3182375f83a9857786c622ccfb53 | train_001.jsonl | 1335016800 | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the "middle" row — the row which has exactly rows... | 256 megabytes | import java.util.Scanner;
public class ABBY_easy_A1 {
static int sum;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a[][] = new int[n][n];
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
... | Java | ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"] | 2 seconds | ["45", "17"] | NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure. | Java 6 | standard input | [
"implementation"
] | 5ebfad36e56d30c58945c5800139b880 | The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1 ≤ n ≤ 5 The input limitations for getting 100 points are: 1 ≤ n ≤ 101 | 800 | Print a single integer — the sum of good matrix elements. | standard output | |
PASSED | 08a4a4284f38ba324bf034b155f613d2 | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.io.*;
import java.util.*;
public class C811 {
public static void main(String[] args) throws IOException {
IO io = new IO(System.in);
int[] dp = new int[5050];
int[] a = new int[101101];
boolean[] used = new boolean[5050];
int[] firstPos = new int[5050];
int[] lastPos = new int[5050];
int ... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | 66e2194fe076b1d731e55e7d9fe7ce65 | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.io.*;
import java.math.*;
import java.security.KeyStore.Entry;
import java.util.*;
public class CODEFORCES {
private InputStream is;
private PrintWriter out;
class Pair {
int u, v;
Pair(int x, int y) {
u = x;
v = y;
}
}
void solve() {
int n = ni();
int arr[] = new int[n];
HashMap<... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | da341be60a61ece0d5b6b569b15cd07e | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static InputReader in = new InputReader(System.in);
static PrintWriter out = new PrintWriter(System.out);
static int n;
static int[] a;
static int[] first = new int[5003];
static int[] last = new int[5003];
static boolean[] ap = new boolean[5003];
s... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | f1590818d89bf6b7b3d6ab37c97098cb | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.io.*;
import java.util.*;
public class c {
public static void main(String[] args){
Scanner sc=new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int n=sc.nextInt();
int[] a=new int[n+1];
int[] ppl=new int[5001];
for(int i=1; i<=n; i++){
a[i]=sc.nextInt();
ppl[a[i]]++;
}
... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | 1b7dfcda316c4964db01d3a921c73339 | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class D2416C {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int[] C = new int[5010];
int[] arr = new int[n];
s.nextLine();
for(int i = 0; i < n; i++){
arr[i] = s.nextInt();
C[arr[i]... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | 569879cc57a5942cc47f7da8e81911ab | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
public class Main3 {
static long mod = 1000000007L;
public static void main(String[] args) {
FastScanner scanner = new FastScanner();
... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | b1e84af0f203e91941782a3a9d1d666d | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes |
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Third {
static int n;
static int[] arr;
static int[] last;
static int[] first;
static Integer[] dp;
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
n = in.nextInt();
arr = ne... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | 69777d209609c2c6ad5f2373193c5cda | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | //package CF;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Cl {
static int[][] memo, x;
static int[] min, m... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | d02715b5db51f057df254e8c069aa6cb | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.StringTokenizer;
public class CF811C {
static clas... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | d825b172309a24bf56410d9a7b88a444 | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
i... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | cdf80de864dc083735995bdeac1d2ce2 | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws Exception{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
int n = Integer.parseInt(in.readLine());
... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | 510d915378d1325620d97bd3f7ecdbc4 | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.awt.geom.Point2D;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;
public class Main {
final static int INF = 1 << 28;
final static long MOD = 1_000_000_007;
final ... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | 07dfc5bdef685273cec5b326fb3a86cb | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String [] args){
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
Integer readFromFile=new Integer(1);
InputReader in = new InputReader(inputStream);
PrintWriter o... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | c3041a3dc2c2b23f1c4dd4059ec2ffb8 | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String [] args){
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
Integer readFromFile=new Integer(1);
InputReader in = new InputReader(inputStream);
PrintWriter o... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | b26c6a28795120150488e68738fbe2d5 | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
static final int UNCALC = -1, INF = (int) 1e9;
static int n;
static int[] memo, a, first, last;
public... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | 77da64ad811042778c1aff5ef1e2b69a | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.util.*;
import java.io.*;
public class c{
public static void main(String[] arg) throws IOException {
new c();
}
public c() throws IOException {
FastScanner in = new FastScanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
int[] vs = new int[n];
for(int i =... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | f40ae66482b8d51baae009be8a96669e | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
/**
* @author Don Li
*/
public class VladikMemorableTrip2 {
int N = 5005;
void solve() {
int n = in.nextInt();
... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | 497ee20aa75d73537aa6c14f03430ca3 | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
/**
* @author Don Li
*/
public class VladikMemorableTrip {
int N = 5005;
int n;
int[] a;
int[] fi = new in... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | 949678e7aedc6eff79f52eaff6cfd8f0 | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
/**
* @author Don Li
*/
public class VladikMemorableTrip2 {
int N = 5005;
void solve() {
int n = in.nextInt();
... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | 3265c6f7e5ecdcbbfdc07ef24a263366 | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
/**
* @author Don Li
*/
public class VladikMemorableTrip {
int N = 5005;
int n;
int[] a;
int[] fi = new in... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | 64059763ffa4aa256be5a1be7c72cff8 | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
/**
* @author Don Li
*/
public class VladikMemorableTrip {
int N = 5005;
int n;
int[] a;
int[] fi = new in... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | 069f8606515b072c8379ed36c29f5940 | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes |
import java.util.*;
import java.io.*;
import java.math.BigInteger;
/**
*
* @author usquare
*/
public class Problem{
static int mod = (int) (1e9+7);
static InputReader in;
static PrintWriter out;
static Pair[] list;
static int[] dp;
static int[] arr;
static int solve(int n){
... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | 0cb4e90f397e07530b9dca71e17d5c0c | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes |
import java.util.*;
import java.io.*;
import java.math.*;
public class Codechef{
static FR in;
public static void main(String[] args)throws Exception{
in =new FR();
int n=ni();
int[]a=ia(n);
boolean[]vis;
int[]fir=new int[5005];
int[]lst=new int[5005];
for( i... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | 7f35eafcd3ed17a92cedc776b4a16a76 | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.util.*;
public final class C811 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] numbers = new int[n + 1];
int[] max = new int[5001];
int[] min = new int[5001];
int[] dp = new int[5001];
for (int i = 0; i <= 5000; i++)... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | 320f48af432704579e3334d2406579ce | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static int n;
static int[] num;
static int[] min, max, D;
static int Answer;
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
n = Integer.parseInt(... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | b582da7ccb5d79c2b7c1eff0b2dc6b8a | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.util.Scanner;
/**
* Created by huang on 17-5-30.
*/
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt(), a[] = new int[n+1],l[] = new int[5001], r[] = new int[5001];
for (int i = 0; i <= 5000; i++) {
... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | 21bf2ebef36dbc406abb14af1ee66a7e | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.util.*;
import java.io.*;
public class CF416C {
public static void main(String args[]) {
InputReader in = new InputReader(System.in);
OutputStream outputStream = System.out;
PrintWriter out = new PrintWriter(outputStream);
/*------------------------------My Code starts here------------------------... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | 5f6defd96dbebb56e2c1e115b41c1ea1 | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.util.*;
import java.io.*;
public class CF416C {
public static void main(String args[]) {
InputReader in = new InputReader(System.in);
OutputStream outputStream = System.out;
PrintWriter out = new PrintWriter(outputStream);
/*------------------------------My Code starts here------------------------... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | f2c768b37bd595d42639d7e96cfcf548 | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Random;
im... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | c8ad200056901f6954e10300ad3e465a | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.util.*;
public class C{
static final int C = (int)5e3 + 10;
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] a = new int[n], cnt = new int[C];
for (int i = 0; i < n; i++){
a[i] = sc.nextInt();
cnt[a[i]]++;
}
int[] d = new int[n+... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | 9820cdd18355a9e0126ae7ca59a151a2 | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.util.*;
import java.io.*;
/*
5
4 2 5 2 3
*/
public class C416 {
static int[] a;
static int[] memo;
static int[] max;
static int[] min;
public static void main(String[] args) throws IOException {
FastScanner qwe = new FastScanner(System.in);
int n = qwe.nextInt();
a = new int[n+1];
min ... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | c85b3b169ce0f35980c010faaec77bd8 | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Codeforces811C {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] sp = br.readLine().split(" ");
int n = Integer.parseInt(sp[0]);
int[] a = new int[n];
sp = br.rea... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | 5045243f37da0a3c681c141e778e4bdc | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class hc {
InputStream is;
PrintWriter out;
static class Pair implements Comparable<Pair>{
int x,y,k,i;
Pair (int x,int y){
this.x=x;
this.y=y;
}
public int compareTo(Pair o) {
if(this.x!=o.x)
return this.x-o... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | ce50c3ffc5e9a22aeb1aadf18ebf3a44 | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class C416 {
static int n;
static int a[];
static int last[];
static int first[];
static boolean illegal[][];
static int comf[][];
static final int N = 5001;
public static void main(String[] args) {
Scanner sc = new Scanne... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | b5db810e207544c2d3d561ffb765ad50 | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | import java.util.*;
public class C416_ {
static int n;
static int a[];
static int comf[];
static int first[];
static int last[];
static int maxA;
static int interval[];
static ArrayList<Interval> intervals;
public static void main(String[] args) {
Scanner sc = new Scanner(Sys... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | c6a272c18b88664e00785e1ba7976017 | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 256 megabytes | //package CR416;
import java.util.Arrays;
import java.util.Scanner;
public class C416 {
static int n;
static int a[];
static int last[];
static int first[];
static boolean legal[][];
static final int N = 5001;
public static void main(String[] args) {
Scanner sc = new Scanner(System.i... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | d0a98d51d8fe4ef60324a0021613a633 | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 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.Arrays;
import java.util.StringTokenizer;
public class Abood2B {
static int N;
static int[] a, F, A, memo;
static int[] XOR;
static int solve(int i... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | 8f0713380855d925c271bab5b4e346ce | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 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.HashMap;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.io.BufferedReader;
imp... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | 5787ecdee67c142a2c68548b620cc1a8 | train_001.jsonl | 1495877700 | Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code ai is known ... | 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 C {
static int memo [];
static int n;
static int [] arr, max, min;
static int dp (int start) {
if (start == n) re... | Java | ["6\n4 4 2 5 2 3", "9\n5 1 3 1 5 2 4 2 5"] | 2 seconds | ["14", "9"] | NoteIn the first test case best partition into segments is: [4, 4] [2, 5, 2] [3], answer is calculated as follows: 4 + (2 xor 5) + 3 = 4 + 7 + 3 = 14In the second test case best partition into segments is: 5 1 [3] 1 5 [2, 4, 2] 5, answer calculated as follows: 3 + (2 xor 4) = 3 + 6 = 9. | Java 8 | standard input | [
"dp",
"implementation"
] | 158a9e5471928a9c7b4e728b68a954d4 | First line contains single integer n (1 ≤ n ≤ 5000) — number of people. Second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 5000), where ai denotes code of the city to which i-th person is going. | 1,900 | The output should contain a single integer — maximal possible total comfort. | standard output | |
PASSED | 7fa9cdd0b20e281533daa03c68059c36 | train_001.jsonl | 1561559700 | Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict... | 256 megabytes | import java.util.Scanner;
public class C {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int q = in.nextInt();
for(int i = 0; i<q; i++) {
long k = in.nextLong();
long n = in.nextLong();
long a = in.nextLong();
long b = in.nextLong();
long c = k-n*a;
long o... | Java | ["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"] | 3 seconds | ["4\n-1\n5\n2\n0\n1"] | NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ... | Java 8 | standard input | [
"binary search",
"math"
] | 2005224ffffb90411db3678ac4996f84 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b < a \le 10^9$$$) — the initial charge of Vova's laptop batt... | 1,400 | For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise. | standard output | |
PASSED | f7917bc0b03bfb275a406d2a02cf1d26 | train_001.jsonl | 1561559700 | Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict... | 256 megabytes | import java.util.*;
import java.io.*;
public final class Solution
{
public static void main(String []args)throws Exception
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int tc = Integer.parseInt(br.readLine());
while(tc-->0)
{
String tmp[] = br.readLine().split(" ")... | Java | ["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"] | 3 seconds | ["4\n-1\n5\n2\n0\n1"] | NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ... | Java 8 | standard input | [
"binary search",
"math"
] | 2005224ffffb90411db3678ac4996f84 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b < a \le 10^9$$$) — the initial charge of Vova's laptop batt... | 1,400 | For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise. | standard output | |
PASSED | e21df36d9209fa92533b070638ba76af | train_001.jsonl | 1561559700 | Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict... | 256 megabytes | //package learning;
import java.util.*;
import java.io.*;
import java.lang.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Nitslocal {
static ArrayList<String> s1;
static boolean[] prime;
static int n = (int)1e7;
static void sieve() {
Arrays.fill(prime , true);
prime[... | Java | ["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"] | 3 seconds | ["4\n-1\n5\n2\n0\n1"] | NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ... | Java 8 | standard input | [
"binary search",
"math"
] | 2005224ffffb90411db3678ac4996f84 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b < a \le 10^9$$$) — the initial charge of Vova's laptop batt... | 1,400 | For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise. | standard output | |
PASSED | 69ed7c9cc670d16ae32f41d4517a2f06 | train_001.jsonl | 1561559700 | Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict... | 256 megabytes | import java.io.*;
import java.math.*;
public class computergame
{
public static int com(int k,int n,int a,int b)
{
int r,s,t;
r=s=t=0;
if((BigInteger.valueOf(a).multiply(BigInteger.valueOf(n))).compareTo(BigInteger.valueOf(k))<0)
return n;
else if((BigInteger.valueOf(b).multiply(BigInteger.valueOf(n))).comp... | Java | ["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"] | 3 seconds | ["4\n-1\n5\n2\n0\n1"] | NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ... | Java 8 | standard input | [
"binary search",
"math"
] | 2005224ffffb90411db3678ac4996f84 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b < a \le 10^9$$$) — the initial charge of Vova's laptop batt... | 1,400 | For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise. | standard output | |
PASSED | 701485703bb800c9bc4656bd1eaa5448 | train_001.jsonl | 1561559700 | Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict... | 256 megabytes | import java.util.*;
import java.lang.*;
public class Main {
public static Scanner in;
public static void solve(int q){
while(q-->0){
long k = in.nextLong();
long n=in.nextLong();
long a = in.nextLong();
long b = in.nextLong();
k--;
if(n*b>k){//if n games require charg... | Java | ["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"] | 3 seconds | ["4\n-1\n5\n2\n0\n1"] | NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ... | Java 8 | standard input | [
"binary search",
"math"
] | 2005224ffffb90411db3678ac4996f84 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b < a \le 10^9$$$) — the initial charge of Vova's laptop batt... | 1,400 | For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise. | standard output | |
PASSED | d7deebb66010373bbc11a9d14e88fc3d | train_001.jsonl | 1561559700 | Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict... | 256 megabytes | import java.util.*;
import java.lang.*;
public class Main {
public static Scanner in;
public static void solve(int q){
while(q-->0){
long k = in.nextLong();
long n=in.nextLong();
long a = in.nextLong();
long b = in.nextLong();
k--;
if(n>k/b){//if n games require charg... | Java | ["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"] | 3 seconds | ["4\n-1\n5\n2\n0\n1"] | NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ... | Java 8 | standard input | [
"binary search",
"math"
] | 2005224ffffb90411db3678ac4996f84 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b < a \le 10^9$$$) — the initial charge of Vova's laptop batt... | 1,400 | For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise. | standard output | |
PASSED | d73f6e15cdfc4804cdf048f81c5836a4 | train_001.jsonl | 1561559700 | Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict... | 256 megabytes | import java.util.*;
import java.lang.*;
public class Main {
public static Scanner in;
public static void solve(int q){
while(q-->0){
long k = in.nextLong();
long n=in.nextLong();
long a = in.nextLong();
long b = in.nextLong();
k--;
if(n*b>k){//if n games require charg... | Java | ["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"] | 3 seconds | ["4\n-1\n5\n2\n0\n1"] | NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ... | Java 8 | standard input | [
"binary search",
"math"
] | 2005224ffffb90411db3678ac4996f84 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b < a \le 10^9$$$) — the initial charge of Vova's laptop batt... | 1,400 | For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise. | standard output | |
PASSED | 68177f4a88e55d458890e18399d2f91a | train_001.jsonl | 1561559700 | Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict... | 256 megabytes | import java.util.*;
import java.lang.*;
public class Main {
public static Scanner in;
public static void solve(int q){
while(q-->0){
long k = in.nextLong();
long n=in.nextLong();
long a = in.nextLong();
long b = in.nextLong();
k--;
if(n*b > k){//if n games require cha... | Java | ["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"] | 3 seconds | ["4\n-1\n5\n2\n0\n1"] | NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ... | Java 8 | standard input | [
"binary search",
"math"
] | 2005224ffffb90411db3678ac4996f84 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b < a \le 10^9$$$) — the initial charge of Vova's laptop batt... | 1,400 | For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise. | standard output | |
PASSED | 0ada5296cfabdafc9690e766688d9062 | train_001.jsonl | 1561559700 | Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
/* abhi2601 */
public class Q1 implements Runnable{
final static long mod = (long)1e9 + 7;
static class Pair implements Comparable<Pair>{
int a;
int b;
Pair(int a,int b){
this.a=a;
th... | Java | ["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"] | 3 seconds | ["4\n-1\n5\n2\n0\n1"] | NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ... | Java 8 | standard input | [
"binary search",
"math"
] | 2005224ffffb90411db3678ac4996f84 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b < a \le 10^9$$$) — the initial charge of Vova's laptop batt... | 1,400 | For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise. | standard output | |
PASSED | 6d69ee9742f2433857891a7d77dc6130 | train_001.jsonl | 1561559700 | Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
/* abhi2601 */
public class Q1 implements Runnable{
final static long mod = (long)1e9 + 7;
static class Pair implements Comparable<Pair>{
int a;
int b;
Pair(int a,int b){
this.a=a;
th... | Java | ["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"] | 3 seconds | ["4\n-1\n5\n2\n0\n1"] | NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ... | Java 8 | standard input | [
"binary search",
"math"
] | 2005224ffffb90411db3678ac4996f84 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b < a \le 10^9$$$) — the initial charge of Vova's laptop batt... | 1,400 | For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise. | standard output | |
PASSED | 76d90b046f557defd2778ca79e10a994 | train_001.jsonl | 1561559700 | Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Input... | Java | ["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"] | 3 seconds | ["4\n-1\n5\n2\n0\n1"] | NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ... | Java 8 | standard input | [
"binary search",
"math"
] | 2005224ffffb90411db3678ac4996f84 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b < a \le 10^9$$$) — the initial charge of Vova's laptop batt... | 1,400 | For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise. | standard output | |
PASSED | 90989e7c9e791cfe61a94833df6edfaa | train_001.jsonl | 1561559700 | Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict... | 256 megabytes |
import java.util.Scanner;
public class C {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int q = scan.nextInt();
for (int i = 0; i < q; i++) {
long k = scan.nextLong();
long n = scan.nextLong();
long a = scan.nextLong(... | Java | ["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"] | 3 seconds | ["4\n-1\n5\n2\n0\n1"] | NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ... | Java 8 | standard input | [
"binary search",
"math"
] | 2005224ffffb90411db3678ac4996f84 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b < a \le 10^9$$$) — the initial charge of Vova's laptop batt... | 1,400 | For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise. | standard output | |
PASSED | d66ea78139d93b0f0d290c80b956fe6b | train_001.jsonl | 1561559700 | Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict... | 256 megabytes | import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparat... | Java | ["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"] | 3 seconds | ["4\n-1\n5\n2\n0\n1"] | NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ... | Java 8 | standard input | [
"binary search",
"math"
] | 2005224ffffb90411db3678ac4996f84 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b < a \le 10^9$$$) — the initial charge of Vova's laptop batt... | 1,400 | For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise. | standard output | |
PASSED | 5434754da0e55c2d7a5b234401160c09 | train_001.jsonl | 1561559700 | Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.Math;
public class Main {
static class FastScanner {
BufferedReader br;
StringTokenizer st;
public FastScanner() {
try {
br = new BufferedReader(new InputStreamReader(System.in));
st = new S... | Java | ["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"] | 3 seconds | ["4\n-1\n5\n2\n0\n1"] | NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ... | Java 8 | standard input | [
"binary search",
"math"
] | 2005224ffffb90411db3678ac4996f84 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b < a \le 10^9$$$) — the initial charge of Vova's laptop batt... | 1,400 | For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise. | standard output | |
PASSED | 8b7d59bd3ef4c25a37593d046f63a40b | train_001.jsonl | 1561559700 | Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict... | 256 megabytes | import java.util.*;
public class Solution
{static int mod=1000000007;
static Scanner sc=new Scanner(System.in);
public static void main(String[] args) {
int t=sc.nextInt();
while(t-->0)
{
long k=sc.nextInt();
long turn=sc.nextInt();
long a=sc.nextInt();
long b=sc.nextInt();
long req=turn*b;
lo... | Java | ["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"] | 3 seconds | ["4\n-1\n5\n2\n0\n1"] | NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ... | Java 8 | standard input | [
"binary search",
"math"
] | 2005224ffffb90411db3678ac4996f84 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b < a \le 10^9$$$) — the initial charge of Vova's laptop batt... | 1,400 | For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise. | standard output | |
PASSED | 5bef08e36dbd7c46e486a86999fac2ee | train_001.jsonl | 1561559700 | Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Input... | Java | ["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"] | 3 seconds | ["4\n-1\n5\n2\n0\n1"] | NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ... | Java 8 | standard input | [
"binary search",
"math"
] | 2005224ffffb90411db3678ac4996f84 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b < a \le 10^9$$$) — the initial charge of Vova's laptop batt... | 1,400 | For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise. | standard output | |
PASSED | 596be60458547a6cf68dc61c55cddd65 | train_001.jsonl | 1561559700 | Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Input... | Java | ["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"] | 3 seconds | ["4\n-1\n5\n2\n0\n1"] | NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ... | Java 8 | standard input | [
"binary search",
"math"
] | 2005224ffffb90411db3678ac4996f84 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b < a \le 10^9$$$) — the initial charge of Vova's laptop batt... | 1,400 | For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise. | standard output | |
PASSED | e458068d4848b2b9faa074732fad4a43 | train_001.jsonl | 1561559700 | Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict... | 256 megabytes | import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
FastReader in = new FastReader();
int q = in.nextInt();
for (int i = 0; i < q; i++) {
long k = in.nextLong();
int n = in.nextInt(), a = in.nextInt(), b = in.nextInt... | Java | ["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"] | 3 seconds | ["4\n-1\n5\n2\n0\n1"] | NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ... | Java 8 | standard input | [
"binary search",
"math"
] | 2005224ffffb90411db3678ac4996f84 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b < a \le 10^9$$$) — the initial charge of Vova's laptop batt... | 1,400 | For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise. | standard output | |
PASSED | d72b91eb447a83ef2051f3dd4c026061 | train_001.jsonl | 1561559700 | Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict... | 256 megabytes | import java.io.*;
import java.util.*;
public class ComputerGame {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int t = input.nextInt();
for (int i = 0; i < t; i++) {
long k = input.nextLong();
long n = input.nextLong();
... | Java | ["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"] | 3 seconds | ["4\n-1\n5\n2\n0\n1"] | NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ... | Java 8 | standard input | [
"binary search",
"math"
] | 2005224ffffb90411db3678ac4996f84 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b < a \le 10^9$$$) — the initial charge of Vova's laptop batt... | 1,400 | For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise. | standard output | |
PASSED | 8efbf178d2833c5deace22704d73c7cc | train_001.jsonl | 1561559700 | Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Collections;
public class JavaApplication20 {
public static void main(String[] args) {
... | Java | ["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"] | 3 seconds | ["4\n-1\n5\n2\n0\n1"] | NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ... | Java 8 | standard input | [
"binary search",
"math"
] | 2005224ffffb90411db3678ac4996f84 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b < a \le 10^9$$$) — the initial charge of Vova's laptop batt... | 1,400 | For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise. | standard output | |
PASSED | 9ffd63c4c58c3e6bbdb7f98e7a706083 | train_001.jsonl | 1561559700 | Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict... | 256 megabytes | import java.io.*;
import java.util.*;
public class codeforces{
public static void main(String[] args) throws IOException {
InputStreamReader isr=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(isr);
StringBuilder str=new StringBuilder();
PrintWriter out=ne... | Java | ["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"] | 3 seconds | ["4\n-1\n5\n2\n0\n1"] | NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ... | Java 8 | standard input | [
"binary search",
"math"
] | 2005224ffffb90411db3678ac4996f84 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b < a \le 10^9$$$) — the initial charge of Vova's laptop batt... | 1,400 | For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise. | standard output | |
PASSED | d71f5993c6dfeb0668dd7f86e5db9f5f | train_001.jsonl | 1561559700 | Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict... | 256 megabytes | import java.io.*;
import java.util.*;
public class codeforces{
public static void main(String[] args) throws IOException {
InputStreamReader isr=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(isr);
StringBuilder str=new StringBuilder();
PrintWriter out=ne... | Java | ["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"] | 3 seconds | ["4\n-1\n5\n2\n0\n1"] | NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ... | Java 8 | standard input | [
"binary search",
"math"
] | 2005224ffffb90411db3678ac4996f84 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b < a \le 10^9$$$) — the initial charge of Vova's laptop batt... | 1,400 | For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise. | standard output | |
PASSED | d70e824d01b787594e71df42c3a111d5 | train_001.jsonl | 1561559700 | Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict... | 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 = new Integer(br.readLine());
StringBuffer sb = new StringBuffer();
... | Java | ["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"] | 3 seconds | ["4\n-1\n5\n2\n0\n1"] | NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ... | Java 8 | standard input | [
"binary search",
"math"
] | 2005224ffffb90411db3678ac4996f84 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b < a \le 10^9$$$) — the initial charge of Vova's laptop batt... | 1,400 | For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise. | standard output | |
PASSED | 0d9c22144d866fe0345305903b720900 | train_001.jsonl | 1418833800 | Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne... | 256 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.InputMismatchException;
public class Main {
public static void main(String[] args) {
Task mSol = new Task();
mSol.solve();
mSol.flush();
mSol.close();... | Java | ["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"] | 2 seconds | ["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"] | null | Java 7 | standard input | [
"binary search"
] | eefea51c77b411640a3b92b9f2dd2cf1 | The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre... | 1,900 | In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti. | standard output | |
PASSED | 03794b3d4191f7da51985192d07b8980 | train_001.jsonl | 1418833800 | Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne... | 256 megabytes |
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.InputMismatchException;
public class TennisGame496D {
static class Pair {
int s, t;
public Pair(int t, int s)... | Java | ["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"] | 2 seconds | ["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"] | null | Java 7 | standard input | [
"binary search"
] | eefea51c77b411640a3b92b9f2dd2cf1 | The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre... | 1,900 | In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti. | standard output | |
PASSED | 0dd28239ac397b3c6d82b6dbf62d08f9 | train_001.jsonl | 1418833800 | Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne... | 256 megabytes |
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.InputMismatchException;
public class TennisGame496D {
static class Pair {
int s, t;
public Pair(int t, int s)... | Java | ["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"] | 2 seconds | ["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"] | null | Java 7 | standard input | [
"binary search"
] | eefea51c77b411640a3b92b9f2dd2cf1 | The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre... | 1,900 | In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti. | standard output | |
PASSED | 063942a235902663c46b6b438dbc4a5c | train_001.jsonl | 1418833800 | Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne... | 256 megabytes |
import java.util.*;
import java.io.*;
public class TennisGame496D {
static class Pair {
int s, t;
public Pair(int t, int s) {
this.t = t;
this.s = s;
}
}
static void go() {
int n = in.nextInt();
int[] a = in.nextIntArray(n);
//long ... | Java | ["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"] | 2 seconds | ["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"] | null | Java 7 | standard input | [
"binary search"
] | eefea51c77b411640a3b92b9f2dd2cf1 | The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre... | 1,900 | In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti. | standard output | |
PASSED | a5de51a162cc71b58614cc1344b2b37f | train_001.jsonl | 1418833800 | Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne... | 256 megabytes |
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.InputMismatchException;
public class TennisGame496D {
static class Pair {
int s, t;
public Pair(int t, int s)... | Java | ["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"] | 2 seconds | ["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"] | null | Java 7 | standard input | [
"binary search"
] | eefea51c77b411640a3b92b9f2dd2cf1 | The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre... | 1,900 | In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti. | standard output | |
PASSED | 0e3fe5f69d0b271709e37c06fc95c73b | train_001.jsonl | 1418833800 | Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne... | 256 megabytes |
import java.util.*;
import java.io.*;
public class TennisGame496D {
static class Pair {
int s, t;
public Pair(int t, int s) {
this.t = t;
this.s = s;
}
}
static void go() {
int n = in.nextInt();
int[] a = in.nextIntArray(n);
//long ... | Java | ["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"] | 2 seconds | ["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"] | null | Java 7 | standard input | [
"binary search"
] | eefea51c77b411640a3b92b9f2dd2cf1 | The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre... | 1,900 | In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti. | standard output | |
PASSED | 22ea964f71fa2a0f3c4dbe9c8221649f | train_001.jsonl | 1418833800 | Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne... | 256 megabytes |
import java.util.*;
import java.io.*;
public class TennisGame496D {
static class Pair {
int s, t;
public Pair(int t, int s) {
this.t = t;
this.s = s;
}
}
static void go() {
int n = in.nextInt();
int[] a = in.nextIntArray(n);
//long ... | Java | ["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"] | 2 seconds | ["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"] | null | Java 7 | standard input | [
"binary search"
] | eefea51c77b411640a3b92b9f2dd2cf1 | The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre... | 1,900 | In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti. | standard output | |
PASSED | 62a35a203a3bc4ea4eedfdc839373c84 | train_001.jsonl | 1418833800 | Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main implements Runnable {
class Res{
int s, t;
Res(int s, int t){this.s = s; this.t = t;}
}
public void solve() throws IOException {
int N = nextInt();
int[] a = new int[N];
for(int i = 0; ... | Java | ["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"] | 2 seconds | ["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"] | null | Java 7 | standard input | [
"binary search"
] | eefea51c77b411640a3b92b9f2dd2cf1 | The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre... | 1,900 | In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti. | standard output | |
PASSED | 276f039e4cb027b94f98e4a828383b26 | train_001.jsonl | 1418833800 | Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne... | 256 megabytes | import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
/*from collections import Counter
from collections import Counter
def solve(lst):
ones = _count(lst, 1)
twos = _count(lst, 2)
counter = Counter(lst)
if counter[1] =... | Java | ["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"] | 2 seconds | ["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"] | null | Java 7 | standard input | [
"binary search"
] | eefea51c77b411640a3b92b9f2dd2cf1 | The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre... | 1,900 | In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti. | standard output | |
PASSED | 99186cabd5d25131d761fe3db0d9cf49 | train_001.jsonl | 1418833800 | Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne... | 256 megabytes | /*
PROG: b
LANG: JAVA
*/
import java.util.*;
import java.io.*;
public class b {
void bf(int[] a) {
int cm = 0, n = a.length;
for(int p = 1; p <= n; ++p) {
int s = 0, x = 0, y = 0, xs = 0, ys = 0;
for(int i = 0; i < n; ++i) {
if(a[i] == 1) {
x += 1;
} else {
y ... | Java | ["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"] | 2 seconds | ["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"] | null | Java 7 | standard input | [
"binary search"
] | eefea51c77b411640a3b92b9f2dd2cf1 | The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre... | 1,900 | In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.