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 | 0561f1e3a901d6a382f901fee45e9734 | train_002.jsonl | 1288440000 | The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank iβ+β1. Reaching a certain rank i having not reached all the previous iβ-β1 ranks is impossible.Vasya has ju... | 256 megabytes |
import java.util.Scanner;
public class army {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int a[] = new int[n-1];
for(int i=0;i<n-1;i++){
a[i]=s.nextInt();
}
int b =s.nextInt();
int c= s.nextInt();
int j=b-1;
int sum=0;
f... | Java | ["3\n5 6\n1 2", "3\n5 6\n1 3"] | 2 seconds | ["5", "11"] | null | Java 8 | standard input | [
"implementation"
] | 69850c2af99d60711bcff5870575e15e | The first input line contains an integer n (2ββ€βnββ€β100). The second line contains nβ-β1 integers di (1ββ€βdiββ€β100). The third input line contains two integers a and b (1ββ€βaβ<βbββ€βn). The numbers on the lines are space-separated. | 800 | Print the single number which is the number of years that Vasya needs to rise from rank a to rank b. | standard output | |
PASSED | 54d31e965b5b9d433c3222fa9ecb82fa | train_002.jsonl | 1288440000 | The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank iβ+β1. Reaching a certain rank i having not reached all the previous iβ-β1 ranks is impossible.Vasya has ju... | 256 megabytes | import java.util.Scanner;
public class problem38A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
//int nm1= n-1;
int[] lvlRando = new int[n];
//int[] rango = new int[nm1];
lvlRando [0]= 0;
... | Java | ["3\n5 6\n1 2", "3\n5 6\n1 3"] | 2 seconds | ["5", "11"] | null | Java 8 | standard input | [
"implementation"
] | 69850c2af99d60711bcff5870575e15e | The first input line contains an integer n (2ββ€βnββ€β100). The second line contains nβ-β1 integers di (1ββ€βdiββ€β100). The third input line contains two integers a and b (1ββ€βaβ<βbββ€βn). The numbers on the lines are space-separated. | 800 | Print the single number which is the number of years that Vasya needs to rise from rank a to rank b. | standard output | |
PASSED | c613e09ac1e5948ace3dda6169beeda7 | train_002.jsonl | 1288440000 | The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank iβ+β1. Reaching a certain rank i having not reached all the previous iβ-β1 ranks is impossible.Vasya has ju... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Army {
public static void main(String[]args) throws Exception {
BufferedReader b = new BufferedReader(new InputStreamReader(System.in));
int year = Integer.parseInt(b.readLine()) , sum = 0 , start , end;
args = b.... | Java | ["3\n5 6\n1 2", "3\n5 6\n1 3"] | 2 seconds | ["5", "11"] | null | Java 8 | standard input | [
"implementation"
] | 69850c2af99d60711bcff5870575e15e | The first input line contains an integer n (2ββ€βnββ€β100). The second line contains nβ-β1 integers di (1ββ€βdiββ€β100). The third input line contains two integers a and b (1ββ€βaβ<βbββ€βn). The numbers on the lines are space-separated. | 800 | Print the single number which is the number of years that Vasya needs to rise from rank a to rank b. | standard output | |
PASSED | 3ce64424db20c3836c2e49901879ae2b | train_002.jsonl | 1288440000 | The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank iβ+β1. Reaching a certain rank i having not reached all the previous iβ-β1 ranks is impossible.Vasya has ju... | 256 megabytes |
import java.util.Scanner;
import java.util.Stack;
import javax.swing.JOptionPane;
/**
*
* @author User
*/
public class Test {
public static void main(String[]args){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int d[] = new int[n];
for (int i = ... | Java | ["3\n5 6\n1 2", "3\n5 6\n1 3"] | 2 seconds | ["5", "11"] | null | Java 8 | standard input | [
"implementation"
] | 69850c2af99d60711bcff5870575e15e | The first input line contains an integer n (2ββ€βnββ€β100). The second line contains nβ-β1 integers di (1ββ€βdiββ€β100). The third input line contains two integers a and b (1ββ€βaβ<βbββ€βn). The numbers on the lines are space-separated. | 800 | Print the single number which is the number of years that Vasya needs to rise from rank a to rank b. | standard output | |
PASSED | ff1128286a2544a7ac454408dfb58422 | train_002.jsonl | 1288440000 | The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank iβ+β1. Reaching a certain rank i having not reached all the previous iβ-β1 ranks is impossible.Vasya has ju... | 256 megabytes | import java.util.*;
public class Army {
public static void main(String[]args){
Scanner clv=new Scanner(System.in);
int a=clv.nextInt(); int somme=0;
int[]tabl=new int[a-1];int[] deux=new int[2];
for(int t=0;t<a-1;t++){
tabl[t]=clv.nextInt();
}
deux[0]=clv.nextInt();
deux[1]=clv.nextInt();
int pomme... | Java | ["3\n5 6\n1 2", "3\n5 6\n1 3"] | 2 seconds | ["5", "11"] | null | Java 8 | standard input | [
"implementation"
] | 69850c2af99d60711bcff5870575e15e | The first input line contains an integer n (2ββ€βnββ€β100). The second line contains nβ-β1 integers di (1ββ€βdiββ€β100). The third input line contains two integers a and b (1ββ€βaβ<βbββ€βn). The numbers on the lines are space-separated. | 800 | Print the single number which is the number of years that Vasya needs to rise from rank a to rank b. | standard output | |
PASSED | f6a895c5e7e8c97467170a6342541acf | train_002.jsonl | 1288440000 | The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank iβ+β1. Reaching a certain rank i having not reached all the previous iβ-β1 ranks is impossible.Vasya has ju... | 256 megabytes |
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.lang.String;
import java.util.Locale;
public class JavaApplication4 {
public static void main(String[] args) {
Scanner ss=new Scanner(System.in);
int n=ss.nextInt();
int[] str=new int[n-1];
f... | Java | ["3\n5 6\n1 2", "3\n5 6\n1 3"] | 2 seconds | ["5", "11"] | null | Java 8 | standard input | [
"implementation"
] | 69850c2af99d60711bcff5870575e15e | The first input line contains an integer n (2ββ€βnββ€β100). The second line contains nβ-β1 integers di (1ββ€βdiββ€β100). The third input line contains two integers a and b (1ββ€βaβ<βbββ€βn). The numbers on the lines are space-separated. | 800 | Print the single number which is the number of years that Vasya needs to rise from rank a to rank b. | standard output | |
PASSED | c28849ff6b35430a25c8327b1c6578e2 | train_002.jsonl | 1288440000 | The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank iβ+β1. Reaching a certain rank i having not reached all the previous iβ-β1 ranks is impossible.Vasya has ju... | 256 megabytes | import java.util.*;
import java.math.*;
public class Me
{
public static void main(String[] args)
{
Scanner br=new Scanner(System.in);
int n=br.nextInt();
int[] arr=new int[n-1];
int s=0;
for(int i=0;i<n-1;i++)
{
arr[i]=br.nextInt();
}int a=br.nextInt();
int b=br.nextInt();
int c=b... | Java | ["3\n5 6\n1 2", "3\n5 6\n1 3"] | 2 seconds | ["5", "11"] | null | Java 8 | standard input | [
"implementation"
] | 69850c2af99d60711bcff5870575e15e | The first input line contains an integer n (2ββ€βnββ€β100). The second line contains nβ-β1 integers di (1ββ€βdiββ€β100). The third input line contains two integers a and b (1ββ€βaβ<βbββ€βn). The numbers on the lines are space-separated. | 800 | Print the single number which is the number of years that Vasya needs to rise from rank a to rank b. | standard output | |
PASSED | d8894f169c7e14d1705b93d8bfa7f2bb | train_002.jsonl | 1288440000 | The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank iβ+β1. Reaching a certain rank i having not reached all the previous iβ-β1 ranks is impossible.Vasya has ju... | 256 megabytes | import java.util.Scanner;
public class Test1 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
byte n = in.nextByte();
int count = 0;
byte arr[] = new byte[n-1];
for (int i = 0; i < arr.length; i++) {
arr[i] = in.next... | Java | ["3\n5 6\n1 2", "3\n5 6\n1 3"] | 2 seconds | ["5", "11"] | null | Java 8 | standard input | [
"implementation"
] | 69850c2af99d60711bcff5870575e15e | The first input line contains an integer n (2ββ€βnββ€β100). The second line contains nβ-β1 integers di (1ββ€βdiββ€β100). The third input line contains two integers a and b (1ββ€βaβ<βbββ€βn). The numbers on the lines are space-separated. | 800 | Print the single number which is the number of years that Vasya needs to rise from rank a to rank b. | standard output | |
PASSED | 1995361ef7965b061888db88d47ef126 | train_002.jsonl | 1288440000 | The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank iβ+β1. Reaching a certain rank i having not reached all the previous iβ-β1 ranks is impossible.Vasya has ju... | 256 megabytes | import java.util.Scanner;
import java.lang.*;
public class Code1 {
public static void main(String str[])
{
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b[] = new int[a-1];
for(int i=0;i<b.length;i++)
{
b[i]=sc.nextInt();
}
int a1,b1;
a1 = sc.nextInt();
b1 = sc.nextInt();
int c... | Java | ["3\n5 6\n1 2", "3\n5 6\n1 3"] | 2 seconds | ["5", "11"] | null | Java 8 | standard input | [
"implementation"
] | 69850c2af99d60711bcff5870575e15e | The first input line contains an integer n (2ββ€βnββ€β100). The second line contains nβ-β1 integers di (1ββ€βdiββ€β100). The third input line contains two integers a and b (1ββ€βaβ<βbββ€βn). The numbers on the lines are space-separated. | 800 | Print the single number which is the number of years that Vasya needs to rise from rank a to rank b. | standard output | |
PASSED | a42f769346758fefa0d47a2156647386 | train_002.jsonl | 1288440000 | The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank iβ+β1. Reaching a certain rank i having not reached all the previous iβ-β1 ranks is impossible.Vasya has ju... | 256 megabytes | import java.util.Scanner;
import java.util.Arrays;
import java.lang.*;
public class mitul
{
public static void main(String args[])
{
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int[] arr = new int[n-1];
for(int i=0;i<n-1;i++)
... | Java | ["3\n5 6\n1 2", "3\n5 6\n1 3"] | 2 seconds | ["5", "11"] | null | Java 8 | standard input | [
"implementation"
] | 69850c2af99d60711bcff5870575e15e | The first input line contains an integer n (2ββ€βnββ€β100). The second line contains nβ-β1 integers di (1ββ€βdiββ€β100). The third input line contains two integers a and b (1ββ€βaβ<βbββ€βn). The numbers on the lines are space-separated. | 800 | Print the single number which is the number of years that Vasya needs to rise from rank a to rank b. | standard output | |
PASSED | 1857bb31373ad6a5cdf899fe35786cfc | train_002.jsonl | 1288440000 | The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank iβ+β1. Reaching a certain rank i having not reached all the previous iβ-β1 ranks is impossible.Vasya has ju... | 256 megabytes |
import java.util.Scanner;
public class Army {
public static void main(String args[])
{
Scanner input = new Scanner(System.in);
int n,a,b,i,y=0;
n=input.nextInt();
int aray[]=new int[n-1];
for( i=0;i<n-1;i++)
{
aray[i]=input.nextInt();
}
... | Java | ["3\n5 6\n1 2", "3\n5 6\n1 3"] | 2 seconds | ["5", "11"] | null | Java 8 | standard input | [
"implementation"
] | 69850c2af99d60711bcff5870575e15e | The first input line contains an integer n (2ββ€βnββ€β100). The second line contains nβ-β1 integers di (1ββ€βdiββ€β100). The third input line contains two integers a and b (1ββ€βaβ<βbββ€βn). The numbers on the lines are space-separated. | 800 | Print the single number which is the number of years that Vasya needs to rise from rank a to rank b. | standard output | |
PASSED | 5fa49f3d4be30b61f14467b1aa106197 | train_002.jsonl | 1288440000 | The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank iβ+β1. Reaching a certain rank i having not reached all the previous iβ-β1 ranks is impossible.Vasya has ju... | 256 megabytes |
/*
* Author- Kishan_25
* BTech 2nd Year DAIICT
*/
import java.io.*;
import java.math.*;
import java.util.*;
import javax.print.attribute.SetOfIntegerSyntax;
public class code {
private static InputStream stream;
private static byte[] bu... | Java | ["3\n5 6\n1 2", "3\n5 6\n1 3"] | 2 seconds | ["5", "11"] | null | Java 8 | standard input | [
"implementation"
] | 69850c2af99d60711bcff5870575e15e | The first input line contains an integer n (2ββ€βnββ€β100). The second line contains nβ-β1 integers di (1ββ€βdiββ€β100). The third input line contains two integers a and b (1ββ€βaβ<βbββ€βn). The numbers on the lines are space-separated. | 800 | Print the single number which is the number of years that Vasya needs to rise from rank a to rank b. | standard output | |
PASSED | 090df9abf284d10798846d550e0f88b8 | train_002.jsonl | 1288440000 | The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank iβ+β1. Reaching a certain rank i having not reached all the previous iβ-β1 ranks is impossible.Vasya has ju... | 256 megabytes |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int n=in.nextInt();
int a[]=new int[n-1];
for(int i=0;i<(n-1);i++)
{
a[i]=in.nextInt();
}
int d=in.nextInt();
... | Java | ["3\n5 6\n1 2", "3\n5 6\n1 3"] | 2 seconds | ["5", "11"] | null | Java 8 | standard input | [
"implementation"
] | 69850c2af99d60711bcff5870575e15e | The first input line contains an integer n (2ββ€βnββ€β100). The second line contains nβ-β1 integers di (1ββ€βdiββ€β100). The third input line contains two integers a and b (1ββ€βaβ<βbββ€βn). The numbers on the lines are space-separated. | 800 | Print the single number which is the number of years that Vasya needs to rise from rank a to rank b. | standard output | |
PASSED | eda1ef235ef28f40216d332a888977e6 | train_002.jsonl | 1288440000 | The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank iβ+β1. Reaching a certain rank i having not reached all the previous iβ-β1 ranks is impossible.Vasya has ju... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int n;
int[] years;
n = in.nextInt();
years = new int[n-1];
... | Java | ["3\n5 6\n1 2", "3\n5 6\n1 3"] | 2 seconds | ["5", "11"] | null | Java 8 | standard input | [
"implementation"
] | 69850c2af99d60711bcff5870575e15e | The first input line contains an integer n (2ββ€βnββ€β100). The second line contains nβ-β1 integers di (1ββ€βdiββ€β100). The third input line contains two integers a and b (1ββ€βaβ<βbββ€βn). The numbers on the lines are space-separated. | 800 | Print the single number which is the number of years that Vasya needs to rise from rank a to rank b. | standard output | |
PASSED | 72a5aece2f4a572f91d6fd333a72c5c6 | train_002.jsonl | 1288440000 | The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank iβ+β1. Reaching a certain rank i having not reached all the previous iβ-β1 ranks is impossible.Vasya has ju... | 256 megabytes | import java.util.Scanner;
public class Army{
public static void main(String args[]){
Scanner scan = new Scanner(System.in);
int numRanks = scan.nextInt();
int[]rankCost = new int[numRanks+2];
for(int i=2;i<=numRanks;i++){
rankCost[i] = scan.nex... | Java | ["3\n5 6\n1 2", "3\n5 6\n1 3"] | 2 seconds | ["5", "11"] | null | Java 8 | standard input | [
"implementation"
] | 69850c2af99d60711bcff5870575e15e | The first input line contains an integer n (2ββ€βnββ€β100). The second line contains nβ-β1 integers di (1ββ€βdiββ€β100). The third input line contains two integers a and b (1ββ€βaβ<βbββ€βn). The numbers on the lines are space-separated. | 800 | Print the single number which is the number of years that Vasya needs to rise from rank a to rank b. | standard output | |
PASSED | 637e082484b568559ecd05bfe0b6cfac | train_002.jsonl | 1288440000 | The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank iβ+β1. Reaching a certain rank i having not reached all the previous iβ-β1 ranks is impossible.Vasya has ju... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Army {
public static void main(String[] args) throws IOException {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int []a=new int [n];
... | Java | ["3\n5 6\n1 2", "3\n5 6\n1 3"] | 2 seconds | ["5", "11"] | null | Java 8 | standard input | [
"implementation"
] | 69850c2af99d60711bcff5870575e15e | The first input line contains an integer n (2ββ€βnββ€β100). The second line contains nβ-β1 integers di (1ββ€βdiββ€β100). The third input line contains two integers a and b (1ββ€βaβ<βbββ€βn). The numbers on the lines are space-separated. | 800 | Print the single number which is the number of years that Vasya needs to rise from rank a to rank b. | standard output | |
PASSED | 23e705aae4296ee4d5410491382e8817 | train_002.jsonl | 1288440000 | The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank iβ+β1. Reaching a certain rank i having not reached all the previous iβ-β1 ranks is impossible.Vasya has ju... | 256 megabytes | import java.util.*;
import javax.print.attribute.IntegerSyntax;
import java.io.*;
public class Problem {
public static void main(String[] args)throws IOException {
// BufferedReader br = new BufferedReader(new FileReader("input.txt"));
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
P... | Java | ["3\n5 6\n1 2", "3\n5 6\n1 3"] | 2 seconds | ["5", "11"] | null | Java 8 | standard input | [
"implementation"
] | 69850c2af99d60711bcff5870575e15e | The first input line contains an integer n (2ββ€βnββ€β100). The second line contains nβ-β1 integers di (1ββ€βdiββ€β100). The third input line contains two integers a and b (1ββ€βaβ<βbββ€βn). The numbers on the lines are space-separated. | 800 | Print the single number which is the number of years that Vasya needs to rise from rank a to rank b. | standard output | |
PASSED | eeac644ed0f4c0b0badb7abe172f204c | train_002.jsonl | 1288440000 | The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank iβ+β1. Reaching a certain rank i having not reached all the previous iβ-β1 ranks is impossible.Vasya has ju... | 256 megabytes | import java.util.*;
public class Army {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in) ;
int n = in.nextInt() ;
int [] d = new int [n] ;
int sum = 0 ;
for(int i =1 ; i<= n-1 ; i++){
d[i] = in.nextInt() ;
}
int a = in.nextInt()... | Java | ["3\n5 6\n1 2", "3\n5 6\n1 3"] | 2 seconds | ["5", "11"] | null | Java 8 | standard input | [
"implementation"
] | 69850c2af99d60711bcff5870575e15e | The first input line contains an integer n (2ββ€βnββ€β100). The second line contains nβ-β1 integers di (1ββ€βdiββ€β100). The third input line contains two integers a and b (1ββ€βaβ<βbββ€βn). The numbers on the lines are space-separated. | 800 | Print the single number which is the number of years that Vasya needs to rise from rank a to rank b. | standard output | |
PASSED | cda5642e3b456be576cc27f7d24a76b7 | train_002.jsonl | 1288440000 | The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank iβ+β1. Reaching a certain rank i having not reached all the previous iβ-β1 ranks is impossible.Vasya has ju... | 256 megabytes | /* Read input from STDIN. Print your output to STDOUT*/
import java.io.*;
import java.util.*;
public class demo38 {
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br=new BufferedReader(new InputStreamReader(System.in));
}
String... | Java | ["3\n5 6\n1 2", "3\n5 6\n1 3"] | 2 seconds | ["5", "11"] | null | Java 8 | standard input | [
"implementation"
] | 69850c2af99d60711bcff5870575e15e | The first input line contains an integer n (2ββ€βnββ€β100). The second line contains nβ-β1 integers di (1ββ€βdiββ€β100). The third input line contains two integers a and b (1ββ€βaβ<βbββ€βn). The numbers on the lines are space-separated. | 800 | Print the single number which is the number of years that Vasya needs to rise from rank a to rank b. | standard output | |
PASSED | b4ba7e03105018b93e687a557a303d37 | train_002.jsonl | 1287904200 | Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, thatβs why he d... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import ... | Java | ["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"] | 2 seconds | ["1\n3", "2\n1 2", "0"] | null | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | 0df064fd0288c2ac4832efa227107a0e | The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one. | 1,500 | In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible... | standard output | |
PASSED | 7bd3b1f770c8a9378cdfd1fffd1bbcd4 | train_002.jsonl | 1287904200 | Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, thatβs why he d... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
public class Main {
public static void main(String[] args) throws Exception{
InputReader in = new InputRead... | Java | ["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"] | 2 seconds | ["1\n3", "2\n1 2", "0"] | null | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | 0df064fd0288c2ac4832efa227107a0e | The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one. | 1,500 | In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible... | standard output | |
PASSED | 797f6f3bd7cac30a17ab1e04f13a1fa6 | train_002.jsonl | 1287904200 | Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, thatβs why he d... | 256 megabytes | import javax.annotation.processing.SupportedSourceVersion;
import java.io.*;
import java.util.*;
import java.util.regex.Matcher;
public class Main {
public static void main(String[] args) throws IOException {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
Inpu... | Java | ["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"] | 2 seconds | ["1\n3", "2\n1 2", "0"] | null | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | 0df064fd0288c2ac4832efa227107a0e | The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one. | 1,500 | In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible... | standard output | |
PASSED | 8d3170e03c2a36080f5510938622ecd8 | train_002.jsonl | 1287904200 | Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, thatβs why he d... | 256 megabytes | 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.StringTokenizer;
public class A {
public static void main(String[] args) throws IOException
{
Scanner sc = new Scanner(... | Java | ["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"] | 2 seconds | ["1\n3", "2\n1 2", "0"] | null | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | 0df064fd0288c2ac4832efa227107a0e | The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one. | 1,500 | In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible... | standard output | |
PASSED | 20909983a875e411e183b8c505e91542 | train_002.jsonl | 1287904200 | Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, thatβs why he d... | 256 megabytes | 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.StringTokenizer;
public class A {
public static void main(String[] args) throws IOException
{
Scanner sc = new Scanner(... | Java | ["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"] | 2 seconds | ["1\n3", "2\n1 2", "0"] | null | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | 0df064fd0288c2ac4832efa227107a0e | The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one. | 1,500 | In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible... | standard output | |
PASSED | c6fb57f6268f2e6aa6c448f5dc85a0a4 | train_002.jsonl | 1287904200 | Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, thatβs why he d... | 256 megabytes | import java.util.*;
import java.io.*;
// Solution
public class Main
{
public static void main (String[] argv)
{
new Main();
}
boolean test = false;
public Main() {
FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));
//FastReader in = new FastRe... | Java | ["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"] | 2 seconds | ["1\n3", "2\n1 2", "0"] | null | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | 0df064fd0288c2ac4832efa227107a0e | The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one. | 1,500 | In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible... | standard output | |
PASSED | 94586d3d9f06323f4bf77231a90f17b8 | train_002.jsonl | 1287904200 | Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, thatβs why he d... | 256 megabytes |
/*
* Author- Priyam Vora
* BTech 2nd Year DAIICT
*/
import java.io.*;
import java.math.*;
import java.net.NetworkInterface;
import java.util.*;
import javax.print.attribute.SetOfIntegerSyntax;
public class CodeMonk_Graph {
p... | Java | ["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"] | 2 seconds | ["1\n3", "2\n1 2", "0"] | null | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | 0df064fd0288c2ac4832efa227107a0e | The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one. | 1,500 | In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible... | standard output | |
PASSED | 411ece17be3e1a71baabefca35adc93c | train_002.jsonl | 1287904200 | Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, thatβs why he d... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main1 {
public static InputReader in;
public static PrintWriter pw;
public static void main(String args[]) {
new Thread(null, new Runnable() {
public void run() {
try{
... | Java | ["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"] | 2 seconds | ["1\n3", "2\n1 2", "0"] | null | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | 0df064fd0288c2ac4832efa227107a0e | The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one. | 1,500 | In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible... | standard output | |
PASSED | 2f5249e5e9559081512e9bf5387b7d0a | train_002.jsonl | 1287904200 | Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, thatβs why he d... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
public static InputReader in;
public static PrintWriter pw;
public static void main(String args[]) {
new Thread(null, new Runnable() {
public void run() {
try{
solve();
... | Java | ["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"] | 2 seconds | ["1\n3", "2\n1 2", "0"] | null | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | 0df064fd0288c2ac4832efa227107a0e | The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one. | 1,500 | In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible... | standard output | |
PASSED | f7623e2d9fc46cb20e391614467dfc7a | train_002.jsonl | 1287904200 | Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, thatβs why he d... | 256 megabytes | import sun.reflect.generics.tree.Tree;
import java.io.*;
import java.math.*;
import java.util.*;
import java.lang.*;
public class Main implements Runnable {
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int ... | Java | ["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"] | 2 seconds | ["1\n3", "2\n1 2", "0"] | null | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | 0df064fd0288c2ac4832efa227107a0e | The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one. | 1,500 | In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible... | standard output | |
PASSED | f689f569895f83485960bac077b3954c | train_002.jsonl | 1287904200 | Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, thatβs why he d... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this templ... | Java | ["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"] | 2 seconds | ["1\n3", "2\n1 2", "0"] | null | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | 0df064fd0288c2ac4832efa227107a0e | The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one. | 1,500 | In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible... | standard output | |
PASSED | 3813f6b5d22a5189ec0f15e30f09d9df | train_002.jsonl | 1287904200 | Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, thatβs why he d... | 256 megabytes | import java.io.*;
import java.util.*;
public class MyClass {
public static void main(String args[]) throws Exception{
//Scanner scanner = new Scanner(System.in);
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String s1 = in.readLine();
St... | Java | ["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"] | 2 seconds | ["1\n3", "2\n1 2", "0"] | null | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | 0df064fd0288c2ac4832efa227107a0e | The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one. | 1,500 | In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible... | standard output | |
PASSED | b210307aa6141ae02bc3ac1d66a68fe7 | train_002.jsonl | 1287904200 | Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, thatβs why he d... | 256 megabytes | import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Random;
import java.io.Writer;
import java.util.List;
import java.io.IOException;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.ArrayList;
impo... | Java | ["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"] | 2 seconds | ["1\n3", "2\n1 2", "0"] | null | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | 0df064fd0288c2ac4832efa227107a0e | The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one. | 1,500 | In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible... | standard output | |
PASSED | b6be4ce36ecd198e8f66eecb2a85b3fa | train_002.jsonl | 1287904200 | Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, thatβs why he d... | 256 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.io.Writer;
import java.math.BigInteger;
import ... | Java | ["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"] | 2 seconds | ["1\n3", "2\n1 2", "0"] | null | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | 0df064fd0288c2ac4832efa227107a0e | The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one. | 1,500 | In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible... | standard output | |
PASSED | 101a979c6b56c533e9b1bd825749168c | train_002.jsonl | 1287904200 | Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, thatβs why he d... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.Writer;
import java.io.OutputStream... | Java | ["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"] | 2 seconds | ["1\n3", "2\n1 2", "0"] | null | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | 0df064fd0288c2ac4832efa227107a0e | The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one. | 1,500 | In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible... | standard output | |
PASSED | 5391f7b431bc0e1dffe209ab2b288292 | train_002.jsonl | 1287904200 | Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, thatβs why he d... | 256 megabytes | import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitS... | Java | ["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"] | 2 seconds | ["1\n3", "2\n1 2", "0"] | null | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | 0df064fd0288c2ac4832efa227107a0e | The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one. | 1,500 | In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible... | standard output | |
PASSED | 195c3da257de6b91f877e4c9ae615f6e | train_002.jsonl | 1287904200 | Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, thatβs why he d... | 256 megabytes | //package prac;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class P39J {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
char[] s = ns().toCh... | Java | ["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"] | 2 seconds | ["1\n3", "2\n1 2", "0"] | null | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | 0df064fd0288c2ac4832efa227107a0e | The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one. | 1,500 | In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible... | standard output | |
PASSED | 409c762d6bdff55238f5d5bc96684d0f | train_002.jsonl | 1287904200 | Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, thatβs why he d... | 256 megabytes | import java.io.*;
import java.util.*;
public class J implements Runnable {
public static void main (String[] args) {new Thread(null, new J(), "_cf", 1 << 28).start();}
public void run() {
FastScanner fs = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
System.err.println("Go!");
String s... | Java | ["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"] | 2 seconds | ["1\n3", "2\n1 2", "0"] | null | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | 0df064fd0288c2ac4832efa227107a0e | The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one. | 1,500 | In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible... | standard output | |
PASSED | 8c0610270eb513a2374291559b5b119a | train_002.jsonl | 1287904200 | Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, thatβs why he d... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
//Scanner in = new Scanner(System.in);
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
Stri... | Java | ["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"] | 2 seconds | ["1\n3", "2\n1 2", "0"] | null | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | 0df064fd0288c2ac4832efa227107a0e | The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one. | 1,500 | In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible... | standard output | |
PASSED | c752689e50d91ec1708af7c91ada64ce | train_002.jsonl | 1287904200 | Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, thatβs why he d... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
//Scanner in = new Scanner(System.in);
BufferedReader in = new BufferedReader(new InputStreamReader(System... | Java | ["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"] | 2 seconds | ["1\n3", "2\n1 2", "0"] | null | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | 0df064fd0288c2ac4832efa227107a0e | The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one. | 1,500 | In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible... | standard output | |
PASSED | da87ff0440f47ca7c5ed86db6bf9a087 | train_002.jsonl | 1287904200 | Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, thatβs why he d... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
/**
* 39J
* ΞΈ(|s|) time
* ΞΈ(|s|) space
*
* @author artyom
*/
public class _39J implements Runnable {
private BufferedReader in;
private StringTokenizer tok;
private Object solve() throws IOException {
String s = nextToken(), t = nextToken()... | Java | ["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"] | 2 seconds | ["1\n3", "2\n1 2", "0"] | null | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | 0df064fd0288c2ac4832efa227107a0e | The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one. | 1,500 | In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible... | standard output | |
PASSED | 12925b241870cf687c07a677ed25f085 | train_002.jsonl | 1287904200 | Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, thatβs why he d... | 256 megabytes | import java.util.*;
public class SpellingCheck39J {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String s1 = scanner.next();
String s2 = scanner.next();
if(s1.length() == 1 && s2.length() == 0) {
System.out.println("1");
System.out.println("1");
}
int i = 0;
... | Java | ["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"] | 2 seconds | ["1\n3", "2\n1 2", "0"] | null | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | 0df064fd0288c2ac4832efa227107a0e | The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one. | 1,500 | In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible... | standard output | |
PASSED | 2544dfcb02f4e7fd17af0ab76b2260a7 | train_002.jsonl | 1287904200 | Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, thatβs why he d... | 256 megabytes |
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Scanner;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author madis
*/
public class CheckGramar {
public static voi... | Java | ["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"] | 2 seconds | ["1\n3", "2\n1 2", "0"] | null | Java 6 | standard input | [
"implementation",
"hashing",
"strings"
] | 0df064fd0288c2ac4832efa227107a0e | The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one. | 1,500 | In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible... | standard output | |
PASSED | dbf59c47ad5c81ef434df6f7eed41c4c | train_002.jsonl | 1287904200 | Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, thatβs why he d... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Locale;
import java.util.StringTokenizer;
public class Main {
void solve() throws IOException {
char[] s1 = next().toCharArray();
ch... | Java | ["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"] | 2 seconds | ["1\n3", "2\n1 2", "0"] | null | Java 6 | standard input | [
"implementation",
"hashing",
"strings"
] | 0df064fd0288c2ac4832efa227107a0e | The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one. | 1,500 | In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible... | standard output | |
PASSED | 4f10a9b9541f7339181d85420fae8162 | train_002.jsonl | 1287904200 | Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, thatβs why he d... | 256 megabytes | import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Locale;
import java.util.Scanner;
public class J implements Runnable {
private Scanner in;
private PrintWriter out;
private void solve() {
char[] s = in.next().toCharArray();
char[] t = in.next().toCharArray();
... | Java | ["abdrakadabra\nabrakadabra", "aa\na", "competition\ncodeforces"] | 2 seconds | ["1\n3", "2\n1 2", "0"] | null | Java 6 | standard input | [
"implementation",
"hashing",
"strings"
] | 0df064fd0288c2ac4832efa227107a0e | The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one. | 1,500 | In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible... | standard output | |
PASSED | cc6426538515ce8a69c14e1790dfa778 | train_002.jsonl | 1312390800 | Having watched the last Harry Potter film, little Gerald also decided to practice magic. He found in his father's magical book a spell that turns any number in the sum of its digits. At the moment Gerald learned that, he came across a number n. How many times can Gerald put a spell on it until the number becomes one-di... | 265 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
public class summRazr {
static public int count=0;
static public String b="";
static private int countInc(String s,int l){
if (s.length()==1){
return l;
}
else {
Integer y = 0,x=0;
... | Java | ["0", "10", "991"] | 2 seconds | ["0", "1", "3"] | NoteIn the first sample the number already is one-digit β Herald can't cast a spell.The second test contains number 10. After one casting of a spell it becomes 1, and here the process is completed. Thus, Gerald can only cast the spell once.The third test contains number 991. As one casts a spell the following transform... | Java 6 | standard input | [
"implementation"
] | ddc9201725e30297a5fc83f4eed75fc9 | The first line contains the only integer n (0ββ€βnββ€β10100000). It is guaranteed that n doesn't contain any leading zeroes. | 1,000 | Print the number of times a number can be replaced by the sum of its digits until it only contains one digit. | standard output | |
PASSED | e5a3c28f2b9032bf2b39dbcfd38469e4 | train_002.jsonl | 1312390800 | Having watched the last Harry Potter film, little Gerald also decided to practice magic. He found in his father's magical book a spell that turns any number in the sum of its digits. At the moment Gerald learned that, he came across a number n. How many times can Gerald put a spell on it until the number becomes one-di... | 265 megabytes | import java.util.Scanner;
public class SumOfDigits {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String k = scan.nextLine();
System.out.println(numberOfTurns(k));
}
private static int numberOfTurns(String k) {
String theNumber = k;
... | Java | ["0", "10", "991"] | 2 seconds | ["0", "1", "3"] | NoteIn the first sample the number already is one-digit β Herald can't cast a spell.The second test contains number 10. After one casting of a spell it becomes 1, and here the process is completed. Thus, Gerald can only cast the spell once.The third test contains number 991. As one casts a spell the following transform... | Java 6 | standard input | [
"implementation"
] | ddc9201725e30297a5fc83f4eed75fc9 | The first line contains the only integer n (0ββ€βnββ€β10100000). It is guaranteed that n doesn't contain any leading zeroes. | 1,000 | Print the number of times a number can be replaced by the sum of its digits until it only contains one digit. | standard output | |
PASSED | 2120e29cc23dbc348bf056d31281e5ea | train_002.jsonl | 1312390800 | Having watched the last Harry Potter film, little Gerald also decided to practice magic. He found in his father's magical book a spell that turns any number in the sum of its digits. At the moment Gerald learned that, he came across a number n. How many times can Gerald put a spell on it until the number becomes one-di... | 265 megabytes | import java.util.Scanner;
/**
* Date: 01.12.11
* Time: 10:41
*/
public class B79 {
public static void main(String[] args) {
String t = new Scanner(System.in).nextLine();
if (t.length()==1) {
System.out.println(0);
return;
}
int n = 0;
for (int i = 0; i < t.length(); i++) {
n+=(t.charAt(i)-'0');
... | Java | ["0", "10", "991"] | 2 seconds | ["0", "1", "3"] | NoteIn the first sample the number already is one-digit β Herald can't cast a spell.The second test contains number 10. After one casting of a spell it becomes 1, and here the process is completed. Thus, Gerald can only cast the spell once.The third test contains number 991. As one casts a spell the following transform... | Java 6 | standard input | [
"implementation"
] | ddc9201725e30297a5fc83f4eed75fc9 | The first line contains the only integer n (0ββ€βnββ€β10100000). It is guaranteed that n doesn't contain any leading zeroes. | 1,000 | Print the number of times a number can be replaced by the sum of its digits until it only contains one digit. | standard output | |
PASSED | 91a15f018015fbd2885c2a035c31148a | train_002.jsonl | 1312390800 | Having watched the last Harry Potter film, little Gerald also decided to practice magic. He found in his father's magical book a spell that turns any number in the sum of its digits. At the moment Gerald learned that, he came across a number n. How many times can Gerald put a spell on it until the number becomes one-di... | 265 megabytes | import java.io.*;
import java.util.*;
public class cf{
public static void main(String args[]) throws IOException{
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
String s = f.readLine();
int ans = 0;
while(s.length()>1){
++ans;
s = op... | Java | ["0", "10", "991"] | 2 seconds | ["0", "1", "3"] | NoteIn the first sample the number already is one-digit β Herald can't cast a spell.The second test contains number 10. After one casting of a spell it becomes 1, and here the process is completed. Thus, Gerald can only cast the spell once.The third test contains number 991. As one casts a spell the following transform... | Java 6 | standard input | [
"implementation"
] | ddc9201725e30297a5fc83f4eed75fc9 | The first line contains the only integer n (0ββ€βnββ€β10100000). It is guaranteed that n doesn't contain any leading zeroes. | 1,000 | Print the number of times a number can be replaced by the sum of its digits until it only contains one digit. | standard output | |
PASSED | 0f7ec95b6c8ce4c951bd627547e64a40 | train_002.jsonl | 1312390800 | Having watched the last Harry Potter film, little Gerald also decided to practice magic. He found in his father's magical book a spell that turns any number in the sum of its digits. At the moment Gerald learned that, he came across a number n. How many times can Gerald put a spell on it until the number becomes one-di... | 265 megabytes | import java.util.Scanner;
public class SumOfDigits{
public static void main(String [] args){
Scanner input = new Scanner(System.in);
String masuk = input.nextLine();
int temp = 0;
int sum = 0;
int count = 0;
while (masuk.length()>1){
sum = 0;
f... | Java | ["0", "10", "991"] | 2 seconds | ["0", "1", "3"] | NoteIn the first sample the number already is one-digit β Herald can't cast a spell.The second test contains number 10. After one casting of a spell it becomes 1, and here the process is completed. Thus, Gerald can only cast the spell once.The third test contains number 991. As one casts a spell the following transform... | Java 6 | standard input | [
"implementation"
] | ddc9201725e30297a5fc83f4eed75fc9 | The first line contains the only integer n (0ββ€βnββ€β10100000). It is guaranteed that n doesn't contain any leading zeroes. | 1,000 | Print the number of times a number can be replaced by the sum of its digits until it only contains one digit. | standard output | |
PASSED | 6e1ac3f7f585cc6550e9aa8cdb985db5 | train_002.jsonl | 1312390800 | Having watched the last Harry Potter film, little Gerald also decided to practice magic. He found in his father's magical book a spell that turns any number in the sum of its digits. At the moment Gerald learned that, he came across a number n. How many times can Gerald put a spell on it until the number becomes one-di... | 265 megabytes | import java.math.BigInteger;
import java.util.Scanner;
public class B {
private void solve() {
while(sc.hasNext()) {
//BigInteger b = new BigInteger(sc.nextLine());
String s = sc.nextLine();
int n = 0;
long b = 0;
if(s.length()>1) {
n++;
int size = s.length();
for(int i=0;i<size;i++) b+= ... | Java | ["0", "10", "991"] | 2 seconds | ["0", "1", "3"] | NoteIn the first sample the number already is one-digit β Herald can't cast a spell.The second test contains number 10. After one casting of a spell it becomes 1, and here the process is completed. Thus, Gerald can only cast the spell once.The third test contains number 991. As one casts a spell the following transform... | Java 6 | standard input | [
"implementation"
] | ddc9201725e30297a5fc83f4eed75fc9 | The first line contains the only integer n (0ββ€βnββ€β10100000). It is guaranteed that n doesn't contain any leading zeroes. | 1,000 | Print the number of times a number can be replaced by the sum of its digits until it only contains one digit. | standard output | |
PASSED | 35f799f7b61e78bd41be49322a96d996 | train_002.jsonl | 1312390800 | Having watched the last Harry Potter film, little Gerald also decided to practice magic. He found in his father's magical book a spell that turns any number in the sum of its digits. At the moment Gerald learned that, he came across a number n. How many times can Gerald put a spell on it until the number becomes one-di... | 265 megabytes | import java.io.IOException;
import java.util.Scanner;
public class B102 {
public static void main(String[] args) throws IOException {
Scanner sc=new Scanner(System.in);
String s1=sc.next();
int n=0,l=0,i=0,x=0,j=0,k=s1.length();
String s;
for(int u=0;u<k;u++)
{n=n+(s1.charAt(u)-'0')... | Java | ["0", "10", "991"] | 2 seconds | ["0", "1", "3"] | NoteIn the first sample the number already is one-digit β Herald can't cast a spell.The second test contains number 10. After one casting of a spell it becomes 1, and here the process is completed. Thus, Gerald can only cast the spell once.The third test contains number 991. As one casts a spell the following transform... | Java 6 | standard input | [
"implementation"
] | ddc9201725e30297a5fc83f4eed75fc9 | The first line contains the only integer n (0ββ€βnββ€β10100000). It is guaranteed that n doesn't contain any leading zeroes. | 1,000 | Print the number of times a number can be replaced by the sum of its digits until it only contains one digit. | standard output | |
PASSED | bc1f5981d28df087bec11f87e65a28a1 | train_002.jsonl | 1312390800 | Having watched the last Harry Potter film, little Gerald also decided to practice magic. He found in his father's magical book a spell that turns any number in the sum of its digits. At the moment Gerald learned that, he came across a number n. How many times can Gerald put a spell on it until the number becomes one-di... | 265 megabytes |
import java.util.*;
public class Main{
public static void main(String[]args)throws Exception{
Scanner in = new Scanner(System.in);
String s = in.next();
if(s.length() == 1){
System.out.println(0);
}else{
int count = 0;
while(true){
... | Java | ["0", "10", "991"] | 2 seconds | ["0", "1", "3"] | NoteIn the first sample the number already is one-digit β Herald can't cast a spell.The second test contains number 10. After one casting of a spell it becomes 1, and here the process is completed. Thus, Gerald can only cast the spell once.The third test contains number 991. As one casts a spell the following transform... | Java 6 | standard input | [
"implementation"
] | ddc9201725e30297a5fc83f4eed75fc9 | The first line contains the only integer n (0ββ€βnββ€β10100000). It is guaranteed that n doesn't contain any leading zeroes. | 1,000 | Print the number of times a number can be replaced by the sum of its digits until it only contains one digit. | standard output | |
PASSED | 347c0f8fdebd03d68999713977f08027 | train_002.jsonl | 1312390800 | Having watched the last Harry Potter film, little Gerald also decided to practice magic. He found in his father's magical book a spell that turns any number in the sum of its digits. At the moment Gerald learned that, he came across a number n. How many times can Gerald put a spell on it until the number becomes one-di... | 265 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
import static java.lang.Math.*;
import static java.math.BigInteger.*;
public class Task {
public static void main(String[] args) throws IOException {
br = new BufferedReader(new InputStreamReader(System.in));
//br = new BufferedReader(new FileReader("in... | Java | ["0", "10", "991"] | 2 seconds | ["0", "1", "3"] | NoteIn the first sample the number already is one-digit β Herald can't cast a spell.The second test contains number 10. After one casting of a spell it becomes 1, and here the process is completed. Thus, Gerald can only cast the spell once.The third test contains number 991. As one casts a spell the following transform... | Java 6 | standard input | [
"implementation"
] | ddc9201725e30297a5fc83f4eed75fc9 | The first line contains the only integer n (0ββ€βnββ€β10100000). It is guaranteed that n doesn't contain any leading zeroes. | 1,000 | Print the number of times a number can be replaced by the sum of its digits until it only contains one digit. | standard output | |
PASSED | 47da73894df8885e780ccd21097a4562 | train_002.jsonl | 1558884900 | Toad Rash has a binary string $$$s$$$. A binary string consists only of zeros and ones.Let $$$n$$$ be the length of $$$s$$$.Rash needs to find the number of such pairs of integers $$$l$$$, $$$r$$$ that $$$1 \leq l \leq r \leq n$$$ and there is at least one pair of integers $$$x$$$, $$$k$$$ such that $$$1 \leq x, k \leq... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;
public class fast implements Runnable {
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChar... | Java | ["010101", "11001100"] | 4 seconds | ["3", "0"] | NoteIn the first example, there are three $$$l$$$, $$$r$$$ pairs we need to count: $$$1$$$, $$$6$$$; $$$2$$$, $$$6$$$; and $$$1$$$, $$$5$$$.In the second example, there are no values $$$x$$$, $$$k$$$ for the initial string, so the answer is $$$0$$$. | Java 8 | standard input | [
"two pointers",
"brute force"
] | 71bace75df1279ae55a6e755159d4191 | The first line contains the string $$$s$$$ ($$$1 \leq |s| \leq 300\,000$$$), consisting of zeros and ones. | 1,900 | Output one integer: the number of such pairs of integers $$$l$$$, $$$r$$$ that $$$1 \leq l \leq r \leq n$$$ and there is at least one pair of integers $$$x$$$, $$$k$$$ such that $$$1 \leq x, k \leq n$$$, $$$l \leq x < x + 2k \leq r$$$, and $$$s_x = s_{x+k} = s_{x+2k}$$$. | standard output | |
PASSED | 620564462835c954692bc382fdf59760 | train_002.jsonl | 1558884900 | Toad Rash has a binary string $$$s$$$. A binary string consists only of zeros and ones.Let $$$n$$$ be the length of $$$s$$$.Rash needs to find the number of such pairs of integers $$$l$$$, $$$r$$$ that $$$1 \leq l \leq r \leq n$$$ and there is at least one pair of integers $$$x$$$, $$$k$$$ such that $$$1 \leq x, k \leq... | 256 megabytes | import java.util.*;
import java.io.*;
public class CF1168B
{
public static void main(String[] args) throws Exception
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String s=br.readLine();
char[] c=s.toCharArray();
int n=s.length(),r=n;
long sum=0;
for(int i=n-1;i>=0;i--){
... | Java | ["010101", "11001100"] | 4 seconds | ["3", "0"] | NoteIn the first example, there are three $$$l$$$, $$$r$$$ pairs we need to count: $$$1$$$, $$$6$$$; $$$2$$$, $$$6$$$; and $$$1$$$, $$$5$$$.In the second example, there are no values $$$x$$$, $$$k$$$ for the initial string, so the answer is $$$0$$$. | Java 8 | standard input | [
"two pointers",
"brute force"
] | 71bace75df1279ae55a6e755159d4191 | The first line contains the string $$$s$$$ ($$$1 \leq |s| \leq 300\,000$$$), consisting of zeros and ones. | 1,900 | Output one integer: the number of such pairs of integers $$$l$$$, $$$r$$$ that $$$1 \leq l \leq r \leq n$$$ and there is at least one pair of integers $$$x$$$, $$$k$$$ such that $$$1 \leq x, k \leq n$$$, $$$l \leq x < x + 2k \leq r$$$, and $$$s_x = s_{x+k} = s_{x+2k}$$$. | standard output | |
PASSED | 9a9ba3259b5fa5e4e37c5531a9099543 | train_002.jsonl | 1558884900 | Toad Rash has a binary string $$$s$$$. A binary string consists only of zeros and ones.Let $$$n$$$ be the length of $$$s$$$.Rash needs to find the number of such pairs of integers $$$l$$$, $$$r$$$ that $$$1 \leq l \leq r \leq n$$$ and there is at least one pair of integers $$$x$$$, $$$k$$$ such that $$$1 \leq x, k \leq... | 256 megabytes | import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Scanner;
/**
* Created on 5/11/2017.
*/
public class B {
Scanner sc;
PrintWriter pw;
void run() throws FileNotFoundException {
// sc = new Scanner(new File("D.txt"));
sc = new Scanner(... | Java | ["010101", "11001100"] | 4 seconds | ["3", "0"] | NoteIn the first example, there are three $$$l$$$, $$$r$$$ pairs we need to count: $$$1$$$, $$$6$$$; $$$2$$$, $$$6$$$; and $$$1$$$, $$$5$$$.In the second example, there are no values $$$x$$$, $$$k$$$ for the initial string, so the answer is $$$0$$$. | Java 8 | standard input | [
"two pointers",
"brute force"
] | 71bace75df1279ae55a6e755159d4191 | The first line contains the string $$$s$$$ ($$$1 \leq |s| \leq 300\,000$$$), consisting of zeros and ones. | 1,900 | Output one integer: the number of such pairs of integers $$$l$$$, $$$r$$$ that $$$1 \leq l \leq r \leq n$$$ and there is at least one pair of integers $$$x$$$, $$$k$$$ such that $$$1 \leq x, k \leq n$$$, $$$l \leq x < x + 2k \leq r$$$, and $$$s_x = s_{x+k} = s_{x+2k}$$$. | standard output | |
PASSED | fc90a49dd5a3b405a4cfe7ca66eaa889 | train_002.jsonl | 1558884900 | Toad Rash has a binary string $$$s$$$. A binary string consists only of zeros and ones.Let $$$n$$$ be the length of $$$s$$$.Rash needs to find the number of such pairs of integers $$$l$$$, $$$r$$$ that $$$1 \leq l \leq r \leq n$$$ and there is at least one pair of integers $$$x$$$, $$$k$$$ such that $$$1 \leq x, k \leq... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String args[]) {new Main().run();}
FastReader in = new FastReader();
PrintWriter out = new PrintWriter(System.out);
void run(){
out.println(work());
out.flush();
}
long mod=1000000007;
long gcd(long a,long b) {
return b==0?... | Java | ["010101", "11001100"] | 4 seconds | ["3", "0"] | NoteIn the first example, there are three $$$l$$$, $$$r$$$ pairs we need to count: $$$1$$$, $$$6$$$; $$$2$$$, $$$6$$$; and $$$1$$$, $$$5$$$.In the second example, there are no values $$$x$$$, $$$k$$$ for the initial string, so the answer is $$$0$$$. | Java 8 | standard input | [
"two pointers",
"brute force"
] | 71bace75df1279ae55a6e755159d4191 | The first line contains the string $$$s$$$ ($$$1 \leq |s| \leq 300\,000$$$), consisting of zeros and ones. | 1,900 | Output one integer: the number of such pairs of integers $$$l$$$, $$$r$$$ that $$$1 \leq l \leq r \leq n$$$ and there is at least one pair of integers $$$x$$$, $$$k$$$ such that $$$1 \leq x, k \leq n$$$, $$$l \leq x < x + 2k \leq r$$$, and $$$s_x = s_{x+k} = s_{x+2k}$$$. | standard output | |
PASSED | f4c8abc0023673ece7374b7c7030fc1d | train_002.jsonl | 1558884900 | Toad Rash has a binary string $$$s$$$. A binary string consists only of zeros and ones.Let $$$n$$$ be the length of $$$s$$$.Rash needs to find the number of such pairs of integers $$$l$$$, $$$r$$$ that $$$1 \leq l \leq r \leq n$$$ and there is at least one pair of integers $$$x$$$, $$$k$$$ such that $$$1 \leq x, k \leq... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author aryssoncf
*/
public class Main {
public static void main(String[] args) {
InputStream... | Java | ["010101", "11001100"] | 4 seconds | ["3", "0"] | NoteIn the first example, there are three $$$l$$$, $$$r$$$ pairs we need to count: $$$1$$$, $$$6$$$; $$$2$$$, $$$6$$$; and $$$1$$$, $$$5$$$.In the second example, there are no values $$$x$$$, $$$k$$$ for the initial string, so the answer is $$$0$$$. | Java 8 | standard input | [
"two pointers",
"brute force"
] | 71bace75df1279ae55a6e755159d4191 | The first line contains the string $$$s$$$ ($$$1 \leq |s| \leq 300\,000$$$), consisting of zeros and ones. | 1,900 | Output one integer: the number of such pairs of integers $$$l$$$, $$$r$$$ that $$$1 \leq l \leq r \leq n$$$ and there is at least one pair of integers $$$x$$$, $$$k$$$ such that $$$1 \leq x, k \leq n$$$, $$$l \leq x < x + 2k \leq r$$$, and $$$s_x = s_{x+k} = s_{x+2k}$$$. | standard output | |
PASSED | 85dab4cd44d01970a52b3932243f577d | train_002.jsonl | 1558884900 | Toad Rash has a binary string $$$s$$$. A binary string consists only of zeros and ones.Let $$$n$$$ be the length of $$$s$$$.Rash needs to find the number of such pairs of integers $$$l$$$, $$$r$$$ that $$$1 \leq l \leq r \leq n$$$ and there is at least one pair of integers $$$x$$$, $$$k$$$ such that $$$1 \leq x, k \leq... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual soluti... | Java | ["010101", "11001100"] | 4 seconds | ["3", "0"] | NoteIn the first example, there are three $$$l$$$, $$$r$$$ pairs we need to count: $$$1$$$, $$$6$$$; $$$2$$$, $$$6$$$; and $$$1$$$, $$$5$$$.In the second example, there are no values $$$x$$$, $$$k$$$ for the initial string, so the answer is $$$0$$$. | Java 8 | standard input | [
"two pointers",
"brute force"
] | 71bace75df1279ae55a6e755159d4191 | The first line contains the string $$$s$$$ ($$$1 \leq |s| \leq 300\,000$$$), consisting of zeros and ones. | 1,900 | Output one integer: the number of such pairs of integers $$$l$$$, $$$r$$$ that $$$1 \leq l \leq r \leq n$$$ and there is at least one pair of integers $$$x$$$, $$$k$$$ such that $$$1 \leq x, k \leq n$$$, $$$l \leq x < x + 2k \leq r$$$, and $$$s_x = s_{x+k} = s_{x+2k}$$$. | standard output | |
PASSED | 5ca234e5dca6a8c912c0c1acd22ab34f | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.lang.*;
import java.io.*;
import java.util.*;
public class Diverse {
public static void main(String[] args) throws java.lang.Exception {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | d6d1071ed861e6732ef28495a0ce63a3 | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.io.*;
import java.util.*;
public class Solution {
private static void solve(InputReader in, OutputWriter out) {
int n, k;
n = in.nextInt();
k = in.nextInt();
int left, right;
left = 0;
right = 2 + k;
while (true) {
left++;
... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | a9435d2a7cf05bfaada5ac5f559f6352 | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes |
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Rinat
*/
public class C275A {
pu... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | ddea513233c50b36791f853200c7eec6 | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.util.*;
/**
*
* @author greggy
*/
public class DiversePermutation {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int k = in.nextInt();
int a = 1;
System.out.print(1 + " ");
for (int i = 2; i <= ... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | 63d4be44810f9d7901bd184251ad025c | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.InputStream;
import java.util.NoSuchElementException;
import java.io.OutputStreamWriter;
import java.math.BigInteger;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.io.IOException;
/**
*... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | 4fe81184356b94ebdc153957aa0c0c1a | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes |
import java.awt.Point;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.i... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | bcc33789e28f15008eb0d515a643bf16 | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.io.*;
import java.util.*;
public class Smile {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
int k = in.nextInt();
int i = 1;
int j = k + 1;
boolean flag = true;
while (i <= j) {
if (f... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | a46c690379b52d556f5692edefed11f8 | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.util.*;
public class a {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int n = input.nextInt(), k = input.nextInt();
int[] res = new int[n];
int lo = 0, hi = n-1;
for(int i = 0; i<k; i++)
{
if(i%2 == 0) res[i... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | 68f1f784c76a747a9c9c2f4af405b77b | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.util.*;
public class Solution {
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
long n = scanner.nextLong();
long k = scanner.nextLong();
if (k == 1){
for (int i=1; i<=n; i++){
System.out.print(i + " ");
... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | d0cbebd2093731661e2a9399e27062fd | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.util.Scanner;
public class Diverse_Permutation {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner x = new Scanner(System.in);
int n = x.nextInt();
int k = x.nextInt();
int tempk = k+1;
int temp = 1;
int [] lis =... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | 1bba944a55ed5767c2fedca0799963d9 | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.util.*;
public class CF482A_DiversePermutation {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int k = in.nextInt();
for(int i = 1; i <= k/2; i ++)
System.out.print(i + " " + (n - i + 1) + " ");
if(k%2!=0)
for(int i = k/2 + 1; i <= n - k... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | caa5709f5c63b88552c7cc7e4fff8b06 | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | 3d128e66732093f1080d75be2482da0d | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class A_Div2_275 {
public static void main(String[]arg) throws IOException
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringTok... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | 2bc95da071c4b4b87c8c17436548f47b | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class A {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer tok = new StringToke... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | 9208370083f133a7b0b8820f22d42e9f | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class DiversePermutation {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamRea... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | feb3685319b91a54dd92b8764031c299 | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.util.Scanner;
////cf1*
public class Main {
public static void main(String[]args){
Scanner scanner =new Scanner(System.in);
int n = scanner.nextInt();
int k = scanner.nextInt();
int[] array = new int[n];
array[0] = 1;
int f = 1;
int i;
for (i = 1; i <= k; i++)
{
array[i] = array[i - ... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | 0398ba0cc2c095116c0db72b55cf8801 | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.io.*;
import java.util.*;
public class Solution {
void solve() throws IOException {
int n = readInt();
int k = readInt();
int len = n - 1;
int pos = 1;
boolean toRight = true;
List<Integer> ans = new ArrayList<Integer>();
for (int i = 0; i < k - ... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | a06bf3d82e511ccbd0fb2ebd08e0bc77 | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.util.Scanner;
public class Round275_C_Diverse_Permutation {
public static void main(String[] args) {
Scanner x = new Scanner(System.in);
int n = x.nextInt(), k = x.nextInt() ,temp = 1, tempk = k + 1;
int[] set = new int[k + 2];
for (int i = 1; i <= k + 1; i += 2) {
set[i] = temp;
temp++;... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | 57b986af7a6ce51a998efd69e689f1f2 | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.util.*;
public class _482A_Diverse_Permutation {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int k = in.nextInt();
int l = 1;
System.out.print(1 + " ");
for (int i = 0; i < k; i++)
System.out.print((l += i % 2 == 0 ? k - i : -(k - i)) +... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | beda677cac0a1daf4cdfc21de011a733 | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.util.*;
public class _482A_Diverse_Permutation {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int k = in.nextInt();
int MAX = 100005;
boolean[] a = new boolean[MAX];
int l = 1;
boolean inc = false;
a[1] = true;
System.out.print(1 + " ");
... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | 582146fd315b9689f670850da5bb98ba | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.util.*;
public class _482A_Diverse_Permutation {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int k = in.nextInt();
int MAX = 100005;
boolean[] a = new boolean[MAX];
int l = 1;
boolean inc = true;
a[1] = true;
System.out.print(1 + " ");
f... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | 54534aee9bea0aca5aa25f7395ec5920 | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
public class Codeforces implements Runnable {
private BufferedReader br = null;
private PrintWriter pw = null;
private StringTokenizer stk = new StringTokenizer("");
public static void main(String[] arg... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | e84238ec30c6973a9f93b3656d838983 | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.util.Scanner;
/**
* Created by G on 11/1/14.
*/
public class CF482A {
public static void main(String[] args){
Scanner sin = new Scanner(System.in);
int n = sin.nextInt();
int k = sin.nextInt();
int i = 1;
int last = 1;
System.out.print("1 ");
... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | 0ef701f26dd622aceaee1e5e93c5cd43 | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | //package Codeforces.Div1A_275.Code1;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
/*
* some cheeky quote
*/
public class Main
{
FastScanner in;
PrintWriter out;
public void solve() throws IOE... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | 783dac41b7473337513741cb77a4a257 | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class DiversePermutation {
public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st =... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | 0e04ae3566c6db2b26fd2eba03faf71d | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | // package Div2;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import java.util.Scanner;
import java.util.Stack;
public class Sketch {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
int n = input... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | 4791518707b36a73c98d6984a3e6b929 | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.util.Scanner;
public class PlayGround {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int k = in.nextInt();
int p = k + 1;
for (int i = 0; i < k + 1; i++)
if (i % 2 == 0) {
System.out.print(((i + 1) / 2 + 1) + " ");
} else {... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | 391df09a8fe8265dd6c0ac90a06617dc | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.util.Scanner;
public class divperm {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int numints = scan.nextInt();
boolean[] avail = new boolean[numints];
int kunique = scan.nextInt();
for (int i = 0; i < numints; ++i)
avail[i] = false;
... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | 0e62797e5ef5e2ba6bac9c62054fd6e3 | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Solver {
public static void main(String[] Args) t... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | 48d9d395e927f00a266cc9cf9ee06890 | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.lang.Math.*;
import java.io.*;
public class cf {
public static void main(String[] args) throws java.lang.Exception
{
Scanner reader = new Scanner(System.in);
int n,k;
n = reader.nextInt();
k = reader.nextInt();
for (int i=1; i<=n-k-1; i+... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | c36a0c36b42f9c40a150d55f9bc892c0 | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static ... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | e999e09ee4aa0ff1970f64ad53f8f655 | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.util.Arrays;
import java.util.*;
import java.io.*;
import java.lang.Math.*;
public class diversePermutation {
public static void main(String[] args) {
Scanner infile = new Scanner(System.in);
int n = infile.nextInt(); //
int k = infile.nextInt(); //1 - 64
gener... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | 1e9945f9e8f1ce1597f73f35ae0813e8 | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes |
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Bit... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | c14f14027d60afe66fdd02afd83d7e37 | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.TreeSet;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;
/**
* Built using CH... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | 077c5af6e94bf4bb019081ca19c63e6c | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
*
* @author giovanny
*/
public class DiversePermutation {
DiversePermutation(int n, int k) {
int kpos;
int kval = n;
int j = 0;
if (k % 2 == 0) {//multiplo de 2
for (int ... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | 2781092376936c2297d4b8262836effa | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | //package codeforces;
import java.io.*;
import java.util.*;
public class A {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
PrintWriter writer = new PrintWriter(System.out);
A() throws IOException {
// reader = new BufferedReader(new FileReader("input.txt"));
// ... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | eb75f02d3e9020123397d83e12cbadec | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes |
import java.util.Scanner;
/**
* Created by user1 on 14/10/29.
*/
public class ProblemA {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int k = in.nextInt();
int[] p = new int[n];
int idx = 0;
for (int i = 1 ;... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | 06dbf1656231fe0ea319fb34bd6c2c50 | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Scanner sc = new Scanner(br);
int n = sc.ne... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | 3e8624eac2c06402892a15f1f102e853 | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes |
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;
public class Nothing {
public static void main(String[] args) throws IOException {
Reader.init(System.in);
int n = Reader.ne... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | 8e1b40ddbf2016571d4c19ac0e7ef2ea | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes |
import java.util.Scanner;
public class A482 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int N = input.nextInt();
int K = input.nextInt();
int down = 1;
int up = N+1;
boolean lastUp = false;
StringBuilder output = new ... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output | |
PASSED | 221edb1f45e381331d3ba06f58d5ff08 | train_002.jsonl | 1414170000 | Permutation p is an ordered set of integers p1,βββp2,βββ...,βββpn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,βββp2,βββ...,βββpn.Your task is to find such permutation p of length n, that the group of numbers |p1β-βp2|,β|p2β-βp3|,β...,β|pnβ-β1β-βpn| has e... | 256 megabytes | import java.util.Scanner;
public class A482 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int l = 1;
int r = m + 1;
while (l <= r){
System.out.print(l + " ");
l++;
if (l <= r){
System.out.print(r + " ");
r--;
... | Java | ["3 2", "3 1", "5 2"] | 1 second | ["1 3 2", "1 2 3", "1 3 2 4 5"] | NoteBy |x| we denote the absolute value of number x. | Java 7 | standard input | [
"constructive algorithms",
"greedy"
] | 18b3d8f57ecc2b392c7b1708f75a477e | The single line of the input contains two space-separated positive integers n, k (1ββ€βkβ<βnββ€β105). | 1,200 | Print n integers forming the permutation. If there are multiple answers, print any of them. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.