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 | fca02de92208afc43c9ff2310fafacd3 | train_001.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class B{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
int a[] = new int[n + 2];
for (int i = 1; i <= n; i++)
a[i] = sc.nextInt();
Arrays.sort(a, 1, n + 1);
int ans = ... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 7 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 22d5b27f94fed26c1a3476f6e85e1796 | train_001.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes |
import java.util.Scanner;
import java.util.Vector;
/*
* 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 KHALED
*/
public class SettlersTraining {
public static boo... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 7 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 435053f56997ee82bd7fd151d00da11f | train_001.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class B1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
int k=sc.nextInt();
int [] a = new int [n+2];
for (int i = 1; i <=n; i++) {
a[i]=sc.nextInt... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 7 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | e426d9ebd672eeffeb91ef26324dd22b | train_001.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.util.Scanner;
/**
* Created by Muhammad on 05.10.2015.
*/
public class C_0063B {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
boolean [] used = new boolean[150];
int [] arr = new int[n+... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 7 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 5367517c17bd1444dc6333dbbe9e0fda | train_001.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 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.util.StringTokenizer;
import java.util.TreeSet;
public class solver implements Runnable {
BufferedReader in;
Prin... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 7 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | af76cc3b432cd3775a54cc96780d3eef | train_001.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.*;
import java.util.*;
public class SettlersTraining {
public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(f.readLine());
int n = Integer.parseInt(st.next... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 7 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | ab348f73c224f808e86419e2ad969126 | train_001.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes |
import java.util.Scanner;
public class b {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
int a[] = new int[101];
for (int i = 1; i <=n; i++) {
int sol = sc.nextInt();
a[sol]++;
}
int ans = 0;
boolean f = false;
while (!f)... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 7 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | e16cea3f2100a4ae6e70cee358406a4f | train_001.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;
public class B {
sta... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 7 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 4f2b95a6edf806679c8dc623f4e4a8aa | train_001.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.util.*;
public class D063B {
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int N = in.nextInt(), K = in.nextInt();
int[] vals = new int[N];
for (int n = 0; n < N; ++n)
vals[n] = in.nextInt();
int ans = 0;
for (;;)
{
Arrays.sort(vals);
// Syst... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 7 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 7c5828ffbdfc5e8e06c46d012f77c6f4 | train_001.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.*;
import java.util.*;
public final class settlers_training
{
static Scanner sc=new Scanner(System.in);
static PrintWriter out=new PrintWriter(System.out);
public static void main(String args[]) throws Exception
{
int n=sc.nextInt(),k=sc.nextInt();
int[] a=new int[n];
int[] cnt=new int[k+1];
... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 7 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | e60e02d944f21486866ff1f85e3906d4 | train_001.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class Solution {
private BufferedReader in;
private PrintWriter out;
private StringTokenizer st;
public String next() throws Exception {
if (st == null || !st.hasMoreElements()) {
st = new StringTokenizer(in.readLine... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 7 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 214804acfaef564400a64bdea9181862 | train_001.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes |
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;
public class B {
... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 7 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 3d12474c0ba2ab945cf01ffb584a7932 | train_001.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes |
import java.util.Scanner;
public class B {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
int ans = 0;
for (ans = 0; a[0] < k; ans++) {
for (int... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 7 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 501eb92ae6165ee8823392d3e47d4bc1 | train_001.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.util.List;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 7 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 0c4f32d2a8c6831a0d87ef85a0137c2d | train_001.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Locale;
import java.util.StringTokenizer;
public class B_59 {
... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 7 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | a5747a02c7473d4b3d7503f77b48bdbc | train_001.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.InputStream;
import java.io.OutputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.A... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 7 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | c915cc2cad13386600bf0d630d190062 | train_001.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;
public class B {
private static Buff... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 7 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 07ce2afeb22183aa8e82c20e45c9ce7b | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class M{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt() ;
Long a[] = new Long[n] , b[] = new Long[n] , x[] = new Long[n + 1] , y[] = new Long[n + 1];
for(int i = 0;i ... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | 4700a5c233fc59e55a2a03bf67558b88 | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
public class HashSimple {
public static void main(String[] args) {
// TODO A... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | 699c4f80a20d8b383385e024378f5406 | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes | import java.util.*;
public class HashSimple
{
public static void main(String ar[])
{
Scanner obj=new Scanner(System.in);
int n=obj.nextInt();
int a[]=new int[n];
Integer b[]=new Integer[n];
long sa[]=new long[n+1];
long sb[]=new long[n+1];
for(int i=0;i<n;i++){
a[i]=obj.nextInt();
b[i]=a[i];
}
Arrays.sort(b);
sa[0]=0;
... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | cafed87e11249a7feadfcc033dc5368c | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
public class B433 {
public static void main(String[] args) throws IOException {
InputReader reader = new InputReader(System.in);
int N = reader.readInt();
int[] A = new int[N];
Integer[] B = new Intege... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | 79ba4a0ed78a38c61472f7dd7546b9ff | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main{
final boolean isFileIO = false;
BufferedReader in;
PrintWriter out;
StringTokenizer st = new StringTokenizer("");
String delim = " ";
public static void main(String[] args) throws IOException {
Main m = new Main();
m.initIO();
m.solve()... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | b36541a99ad1153efd2c3ba38992178b | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class ques4
{
static int n;
public static void main( String args[] ) throws Exception
{
BufferedReader br = new BufferedReader( new InputStrea... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | 039b9e17bf9ab2074454d7963d20988f | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
/**
*
* @author sousnake
*/
public class CF248_B {
public s... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | fe4561efa87898f7346bc5986af50fbb | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class MiraisStones433B {
private int[] rawValue;
private int[] sortedValue;
private int num;
private long[] sumForRaw;
private long[] sumForSorted;
public void solve(){
Scanner scanner = new Scanner(System.in);
num = scanner.nextInt();
rawValue =... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | 7a4c200c9028518ade3122fba9cf3178 | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes | import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;
public class cf_248_b {
public static void main(String[] args) {
Scanner lee=new Scanner(System.in);
int n,m,l,r,t;
n=lee.nextInt();
BigInteger v[]=new BigInteger[n+1];
BigInteger task1[]=new BigInteger[n+1];
BigInteger t... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | 9d898210cfc1fc31da06ff194aa64d8d | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
BufferedReader in = new BufferedReader(new InputStream... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | e44f1c4ced68afef8b74b20c57e653e6 | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.util.Scanner;
/**
* Ashesh Vidyut (Drift King) *
*/
public class B {
public static void main(String[] args) {
try {
Scanner i... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | d3aebe644ffb7b20823d0712606a0ff8 | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class B {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
in.nextLine();
long input []= new long [n];
long arr []= new long [n];
Long sorted []= new Long [... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | 2e46c0384db30f32bd7e3a76eeb1a14a | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class PBV2 {
public static void main(String[] args) throws IOException {
BufferedReader bi = new BufferedReader(new InputStreamReader(System.in));
String line;
int n = Integer.parseInt... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | a805bba8400675f02053f91160115772 | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.StringTokenizer;
public class KuriyamaMiraisStones {
public static void main(String[] args) {
MyScanner sc = new MyScanner();
int N = sc.nextInt();
... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | f20acaea87ae294b98e45dc0422c24fa | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes | import java.io.*;
import java.util.*;
public final class mirai_stones
{
static FasterScanner sc=new FasterScanner();
static PrintWriter out=new PrintWriter(System.out);
public static void main(String args[]) throws Exception
{
int n=sc.nextInt();
Long[] a=new Long[n+1],b=new Long[n+1];
a[0]=b[0]=0L;
for(i... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | 2b5e5a6daf9a2801b4512f247ffe5d5c | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class p433b {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
ArrayList<Long> v = new ArrayList<Long>();
v.add((long)0);
long[] csum = new long[n + 1];
... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | 4677a359f73b5fe45b9007823db0490e | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes | import java.util.*;
import java.io.*;
import java.awt.Point;
import java.math.BigDecimal;
import java.math.BigInteger;
import static java.lang.Math.*;
// Solution is at the bottom of code
public class B implements Runnable{
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
BufferedReader... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | 4cb3f2bb63358afc824997e61e0d4b6c | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes | import java.util.*;
public class KuriyamaMiraiStones {
private static Scanner reader = new Scanner(System.in);
private static final int MAX = 1000000;
public static void main(String[] args) {
int n = reader.nextInt(); // 10^5
long[] dpV = new long[n]; // 10^9
long[][] dpU = new long[2][n]; // 10^9
MaxHeap h... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | 6e8e413a82dca02b35b9105d60481cda | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Stone {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int n ... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | 517e950a29d8714d3d9059b7e7415978 | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class Stone {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
Integer[] nums = new Integer[n];
for (int i = 0; i < nums.length; i++) {
nums[i] = in.nextInt();
}
long[] sum = ne... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | 2aef107b5ec821969860e970e2771182 | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes | import java.util.*;
import java.io.*;
public class km248
{
public static void main(String ar[])throws IOException
{
BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));
//Scanner obj=new Scanner(System.in);
int n=Integer.parseInt(obj.readLine());
int t,l,r,i,j;
int a[]=new int[n];
Integer b[]=new ... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | b792b01e205ad1eb943a8489fea770ef | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class sumsubset {
public static void main(String[] args) throws IOException {
int n,noque,l,r,set;
long a[],b[];
BufferedReader s = new Buff... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | ba9e31505dae085eb3b5e5392e87b795 | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes | import java.util.*;
public class B433
{
public static void main(String ar[])
{
Scanner obj=new Scanner(System.in);
int n=obj.nextInt();
int a[]=new int[n];
Integer b[]=new Integer[n];
long sa[]=new long[n+1];
long sb[]=new long[n+1];
for(int i=0;i<n;i++){
a[i]=obj.nextInt();
b[i]=a[i];
}
Arrays.sort(b);
sa[0]=0;
sb[0]=... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | 20ff73fff2c1443626ff1d0318950b17 | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Locale;
import java.util.StringTokenizer;
/*
* To c... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | 6957cd72bdc4b47bc215719d0aa0e74b | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Locale;
import java.util.StringTokenizer;
/*
* To c... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | ce71ff7c03c74a7fd41462c7949b78d3 | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Locale;
import java.util.StringTokenizer;
/*
* To c... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | 35139196c4c31872266723efb556540a | train_001.jsonl | 1400914800 | Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She will tell you two numbers, l and rΒ (1ββ€βlββ€βrββ€βn), and you should tell... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Locale;
import java.util.StringTokenizer;
public class Main {
static StringTokenizer s... | Java | ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2"] | 2 seconds | ["24\n9\n28", "10\n15\n5\n15\n5\n5\n2\n12\n3\n5"] | NotePlease note that the answers to the questions may overflow 32-bit integer type. | Java 7 | standard input | [
"dp",
"implementation",
"sortings"
] | c764b9f87cb5e5872eb157c3d2b7f3c5 | The first line contains an integer nΒ (1ββ€βnββ€β105). The second line contains n integers: v1,βv2,β...,βvnΒ (1ββ€βviββ€β109) β costs of the stones. The third line contains an integer mΒ (1ββ€βmββ€β105) β the number of Kuriyama Mirai's questions. Then follow m lines, each line contains three integers type, l and rΒ (1ββ€βlββ€βrββ€... | 1,200 | Print m lines. Each line must contain an integer β the answer to Kuriyama Mirai's question. Print the answers to the questions in the order of input. | standard output | |
PASSED | 16d8f3129d78be94e3b84ae7dfe8af01 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes |
import java.util.*;
public class Buffered {
public static void main(String[] args) {
// TODO code application logic here
Scanner sc =new Scanner(System.in);
int t;
t=sc.nextInt();
for(int i=0;i<t;i++)
{
int n;
n=sc.nextInt();
... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | bef99a1507ff0837caa1391742491fa6 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes |
import java.io.*;
import java.util.*;
/**
* @author Tran Anh Tai
* @template for CP codes
*/
public class ProbB {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 258a7cb9d676d05ef09f8f19289b8cad | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Scanner;
import java.util.ArrayList;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author ky112233
*/
public class Main {
public sta... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | aa1cba0a1c3db54e31c91a2345321e81 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import java.util.*;
public class CharacterSwap {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t--!=0) {
int n=sc.nextInt();
String s=sc.next(),k=sc.next(),temp="";
for(int i=0;i<n;i++) {
if(s.charAt(i)!=k.charAt(i)) {
temp+=s.charAt(i... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 775297811ccc11213679c81d9635b9d8 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes |
import java.util.*; import java.io.*;
public class Main{
static Reader scan = new Reader();
static int MAX = 10;
static HashSet<Long> psq = new HashSet<>();
static String[] answer = new String[MAX+100];
public static void main(String[] args) throws IOException {
// TODO Auto-generated meth... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | b70a43b059d0b13ea86793ec976efeac | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | //make sure to make new file!
import java.io.*;
import java.util.*;
public class B599{
public static void main(String[] args)throws IOException{
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
int t = Integer.parseI... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 6d043a0057845baee3dc8b732f966fee | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import java.util.Scanner;
import java.util.stream.IntStream;
public class CharacterSwap {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int k = sc.nextInt();
int stringLen=0;
int i,n=0;
int count=0;
char [] f... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 15da208ad8e78e7227424230ca6d7864 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
Task solver = new Task();
int i =... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 2aec2994aa2ae9166175700d0f523cfa | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import java.util.ArrayList;
import java.util.Scanner;
public class Solution{
public static void main(final String[] args) {
Scanner scan = new Scanner(System.in);
int t = scan.nextInt();
while(t-->0){
int n = scan.nextInt();
String st1 = scan.next();
St... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 136f253ac64f95979a24eea559249075 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes |
import java.util.*;
public class Main {
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
int t = scan.nextInt();
while(t-->0)
{
int n = scan.nextInt();
String x = scan.next(), y = scan.next();
String[] a = x.split("");
String[] b = y.split("");
System.out.print... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 3b6e5ab93074d8fd5eabc5c822d9d189 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
public class P1 {
public static void main(String args[])
{
try{
BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
int testcases=Integer.parseInt(br.readLine());
for(int i=0;i<testcases;i++)
{
int n=Integer.parseInt(br.re... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | a260b12883245f966eb60f2fdccf6888 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes |
import java.util.*;
import java.lang.*;
import java.io.*;
public class cswap
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(System.in);
int tt=sc.nextInt();
while(tt-->0){
int n=sc.nextInt();
String s1=sc.next();
String s2=sc.next();
List<... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 607109fd185f68d0235f189f40dd89b1 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | /** author : SanskarxRawat
**/
import java.util. * ;
public class solution {
public static void main(String[] args) {
Scanner in =new Scanner(System. in );
int t = in.nextInt();
while (t-->0) {
ArrayList < Integer > arr = new ArrayList < Integer > ();
int n = in.nextInt();
String first = in.next();
... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 58fba0e0620c70033462bcedb24a9781 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
in.nextLine();
while(t-- > 0){
in.nextLine();
StringBuilder a = new StringBuilder(in.nextLine());
... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 3e32dd07c4990354e1feca2125b74375 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import java.util.*;
public class CharacterSwapEasy {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int k=sc.nextInt();
while(k-->0) {
int n=sc.nextInt();
sc.nextLine();
String s=sc.nextLine();
String t=sc.nextLine();
boolean res=ans(s,t,n);
if(res==true) Syste... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 1feb4f3c7e3e0be54a69ea762b5d5e78 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import java.util.*;
public class Main
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
for(int x=0;x<t;x++)
{
int n=sc.nextInt();
sc.nextLine();
String s1=sc.nextLine();
String s2=sc.... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | b926744584b51bfd5da8aa647debf177 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import java.util.*;
public class Main
{
public static void main (String[] args)
{
Scanner sc = new Scanner(System.in);
int k = sc.nextInt();
while(k-->0)
{
int n = sc.nextInt();
String s = sc.next();
String t = sc.next();
int cnt ... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 6ace49067b97920c139f5659b81759dd | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import java.util.*;
public class cp{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0)
{
int len = sc.nextInt();
sc.nextLine();
String a = sc.nextLine();
String b = sc.nextLine();
int one=-1,two=-1;
boolean not= false;
for(in... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 7d094256973b728e6f7d466e86208ec5 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Arrays;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner in =new Scanner(System.in);
int t,n,i,j,m,k,p,... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 3984e0ad8b00d9a4b4f72953bc466255 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Arrays;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner in =new Scanner(System.in);
int t,n,i,j,m,k,p,... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | c243c5653d4d828421cbb0ce9443283e | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Solution
{
// Complete the maximumSum function below.
public static class InputReader {
private InputStream ... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 20b1d5e55e62d046f4f400fb75dd0dee | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes |
import java.util.*;
public class BruteForce{
public static Scanner in=new Scanner(System.in);
public static void main(String[]args){
int T=in.nextInt();
while(T-->0){
int n=in.nextInt();
String a=in.next();
String b=in.next();
int count=0;
... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | b59c751673380fda2de4927a1e9bd3a6 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import java.io.*;
import java.util.ArrayList;
import java.util.Comparator;
public class CFTask {
static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
static PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out));
static String currentInputLine = "";
sta... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 82866af4e0cb32a1145060e67e6bfa78 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | // I know stuff but probably my rating tells otherwise...
// Kya hua, code samajhne ki koshish kar rhe ho?? Mat karo,
// mujhe bhi samajh nhi aata kya likha hai
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class _1243B {
static ... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 9cb2831022eabb27110eb950899de654 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import java.util.*;
import java.io.*;
//Captain on duty!
public class Main {
static void compare(Main.pair a[] , int n) {
Arrays.sort(a, new Comparator<Main.pair>() {
@Override
public int compare(Main.pair p1, Main.pair p2) {
return p1.f - p2.f;
}
... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 52b5967d594771cc2c7643845b78446b | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import java.util.*;
public class MyClass {
public static void main(String args[]) {
Scanner s = new Scanner(System.in);
int t = s.nextInt();
while(t-->0){
int n =s.nextInt();
String s1 = s.next();
String s2 = s.next();
int count =0;
int flag=0;
... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | fe2cb017e1ca0f1ec6448429103d34b6 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
Solv... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 4d94e5cfe64965aca5a08eacee9ac229 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes |
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Another {
// public static void quickSortInDescendingOrder (long[] numbers, int low, int high)
// {
//
// int i=low;
// int ... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | ea3492a26f788118634fa35e2268915b | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int t = s.nextInt();
for (int njvnv = 0; njvnv < t; njvnv++) {
int n = s... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 0ad6bfd22b8d16e6fce8402b27246ab2 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import java.util.Scanner;
/**
*
*/
/**
* @author εΌ ι¨θ±ͺ
*
*/
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
// TODO θͺε¨ηζηζΉζ³εζ Ή
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for(int i = 0;i<n;i++){
int k = sc.nextInt();
Str... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 285c62484b2660cc15cf57991c1433ec | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class d1 extends PrintWriter {
static BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
d1 () { super(System.out); }
public static void main(String[] args) ... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 7b51d092cb83db64d5c8e2b003f489f1 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | /*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
What do you think? What do you think?
1st on Billboard, what do you think of it
Next is a Grammy, what do you think of it
However you think, Iβm sorry, but shit, I have no fcking inter... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 6223673b8c4702ac85d2d7485a845117 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static class FastReader {
BufferedReader br;
StringTokenizer st;
FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreEl... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | cfbf287fedecab145242563ae1f47aa9 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | //package practice;
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class prac
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes he... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 7d091dcea631b72df07efd0cab24a6fe | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
import java.util.Scanner;
public class Main{
public static StreamTokenizer sc=new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
public static int nextint() throws IO... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | d34ed68e6cefba9349d67def0515f688 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;import java.util.Arrays;
import java.util.Collections;
public class cff4 {
public static void main(String[] args) throws IOException {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
//int m=sc.nextInt();... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | f2fcc51888ad501af0b92dde5dfe19fb | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import java.util.Scanner;
public class demo {
public static void main(String [] args) {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
for(int i = 0 ; i < n ; i++){
input.nextInt();
System.out.println(demo.canChange(input.next() , input.next()));
... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | ae3620332e0cb0217d04001879899e2a | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int k = sc.nextInt();
while(k>0){
int n = sc.nextInt();
String s = sc.next();
String t = sc.next();
String chks = "";
String chkt = "";
int cnt = 0;
... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 319f1c244cf530a924d273dac0a3ca7a | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
public class b {
public static void main(String[] args) throws Exception {
i... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 08ed9116b1a5b4381275582f4a28338b | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 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 | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | de73f4eb2c51cf0ed2b8b54f9424523c | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import javax.print.DocFlavor;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.IllegalCharsetNameException;
import java.sql.SQLOutput;
import java.util.*;
public class Main {
static int[][] R;
static int[] parent;... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 074ae4f8dc556a39612e371ac4d4b706 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import java.util.Scanner;
public class C1243B {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt();
String a = sc.next();
String b = sc.next();
char[] ac ... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 8252470ce052b317924ffa0ce0abe8bc | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes | import java.util.*;
public class solution
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int k=sc.nextInt();
while(k-->0)
{
int n=sc.nextInt();
String s=sc.next();
String t=sc.next();
char[] ch1=s.toCh... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | fe7afb68e19753d67cea95d7d281f961 | train_001.jsonl | 1573052700 | This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.Ujan has two distinct strings... | 256 megabytes |
import java.util.*;import java.io.*;import java.math.*;
public class Main
{
public static void process()throws IOException
{
int n=ni(),cnt=0;
String s=nln(),t=nln();
char rs=' ',rt=' ';
for(int i=0;i<n;i++){
char a=s.charAt(i),b=t.charAt(i);
if(a!=b){
if(cnt==0){
... | Java | ["4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca"] | 1 second | ["Yes\nNo\nNo\nNo"] | NoteIn the first test case, Ujan can swap characters $$$s_1$$$ and $$$t_4$$$, obtaining the word "house".In the second test case, it is not possible to make the strings equal using exactly one swap of $$$s_i$$$ and $$$t_j$$$. | Java 11 | standard input | [
"strings"
] | 97fa7e82566e3799e165ce6cbbf1da22 | The first line contains a single integer $$$k$$$ ($$$1 \leq k \leq 10$$$), the number of test cases. For each of the test cases, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^4$$$), the length of the strings $$$s$$$ and $$$t$$$. Each of the next two lines contains the strings $$$s$$$ and $$$t$$... | 1,000 | For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 951907ea0612d10fcad0a760d6de6d63 | train_001.jsonl | 1435414200 | Andrewid the Android is a galaxy-famous detective. He is now chasing a criminal hiding on the planet Oxa-5, the planet almost fully covered with water.The only dry land there is an archipelago of n narrow islands located in a row. For more comfort let's represent them as non-intersecting segments on a straight line: is... | 256 megabytes |
import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
static long sx = 0, sy = 0, mod = (long) (1e9 + 7);
static ArrayList<Integer>[] a;
// static ArrayList<pair> p;
static int[][] dp;
static long[] fa;
static int[] farr;
public static PrintWriter out = new PrintWriter(Syste... | Java | ["4 4\n1 4\n7 8\n9 10\n12 14\n4 5 3 8", "2 2\n11 14\n17 18\n2 9", "2 1\n1 1\n1000000000000000000 1000000000000000000\n999999999999999999"] | 3 seconds | ["Yes\n2 3 1", "No", "Yes\n1"] | NoteIn the first sample test you can, for example, place the second bridge between points 3 and 8, place the third bridge between points 7 and 10 and place the first bridge between points 10 and 14.In the second sample test the first bridge is too short and the second bridge is too long, so the solution doesn't exist. | Java 11 | standard input | [
"data structures",
"binary search",
"greedy"
] | f7a34711e8a4faa9822d42ef54a0bfc1 | The first line contains integers n (2ββ€βnββ€β2Β·105) and m (1ββ€βmββ€β2Β·105) β the number of islands and bridges. Next n lines each contain two integers li and ri (1ββ€βliββ€βriββ€β1018) β the coordinates of the island endpoints. The last line contains m integer numbers a1,βa2,β...,βam (1ββ€βaiββ€β1018) β the lengths of the bri... | 2,000 | If it is impossible to place a bridge between each pair of adjacent islands in the required manner, print on a single line "No" (without the quotes), otherwise print in the first line "Yes" (without the quotes), and in the second line print nβ-β1 numbers b1,βb2,β...,βbnβ-β1, which mean that between islands i and iβ+β1 ... | standard output | |
PASSED | a3cdd62d27514dbdf02fbb6fc3edfc2b | train_001.jsonl | 1318919400 | Let's consider the famous game called Boom (aka Hat) with simplified rules.There are n teams playing the game. Each team has two players. The purpose of the game is to explain the words to the teammate without using any words that contain the same root or that sound similarly. Player j from team i (1ββ€βiββ€βn,β1ββ€βjββ€β2... | 256 megabytes | import java.util.*;
import java.util.Map.Entry;
import java.io.*;
import java.lang.*;
import java.math.*;
import static java.lang.Math.*;
public class Solution implements Runnable {
void solve() throws Exception {
int n = sc.nextInt();
int t = sc.nextInt();
int[][] a = new int[n][2];
int[][]... | Java | ["2 2\n1 1 1 1\n1 1 1 1\n3\nhome\n1\ncar\n1\nbrother\n1", "2 4\n1 2 2 1\n2 3 2 2\n4\narmchair\n3\nquetzalcoatl\n10\npilotage\n5\ndefibrillator\n7"] | 1 second | ["2 home car \n1 brother", "2 armchair quetzalcoatl \n2 pilotage defibrillator"] | null | Java 7 | input.txt | [
"implementation"
] | 2733797c5dd5b9d9e0bf9fe786c3120a | The first line contains two integers n,βt (1ββ€βn,βtββ€β100), which correspondingly denote the number of teams and a turn's duration. Next n lines of the input file contain four integers each: ai1,βbi1,βai2,βbi2 (1ββ€βaij,βbijββ€β100) β the skills of the first and the second player of the i-th team. The teams are given in ... | 1,800 | Print n lines. On the i-th line first print number si the number of points the i-th team wins. Then print si space-separated words β the words from the cards guessed by team i in the order in which they were guessed. | output.txt | |
PASSED | 596e1a604a9e9f5b6fee569924fc66fe | train_001.jsonl | 1586700300 | You have array of $$$n$$$ numbers $$$a_{1}, a_{2}, \ldots, a_{n}$$$. Rearrange these numbers to satisfy $$$|a_{1} - a_{2}| \le |a_{2} - a_{3}| \le \ldots \le |a_{n-1} - a_{n}|$$$, where $$$|x|$$$ denotes absolute value of $$$x$$$. It's always possible to find such rearrangement.Note that all numbers in $$$a$$$ are not ... | 256 megabytes |
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
import java.util.*;
import java.util.Collections;
import java.util.Scanner;
import java.util.*;
public class cd {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner s=new Scanner(System.in);
... | Java | ["2\n6\n5 -2 4 8 6 5\n4\n8 1 4 2"] | 1 second | ["5 5 4 6 8 -2\n1 2 4 8"] | NoteIn the first test case, after given rearrangement, $$$|a_{1} - a_{2}| = 0 \le |a_{2} - a_{3}| = 1 \le |a_{3} - a_{4}| = 2 \le |a_{4} - a_{5}| = 2 \le |a_{5} - a_{6}| = 10$$$. There are other possible answers like "5 4 5 6 -2 8".In the second test case, after given rearrangement, $$$|a_{1} - a_{2}| = 1 \le |a_{2} - ... | Java 11 | standard input | [
"constructive algorithms",
"sortings"
] | 3c8bfd3199a9435cfbdee1daaacbd1b3 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$)Β β the number of test cases. The first line of each test case contains single integer $$$n$$$ ($$$3 \le n \le 10^{5}$$$)Β β the length of array $$$a$$$. It is guaranteed that the sum of values of $$$n$$$ over all test cases in the input does not ... | 1,200 | For each test case, print the rearranged version of array $$$a$$$ which satisfies given condition. If there are multiple valid rearrangements, print any of them. | standard output | |
PASSED | c48fb59b215857905d50af5e2da898f7 | train_001.jsonl | 1586700300 | You have array of $$$n$$$ numbers $$$a_{1}, a_{2}, \ldots, a_{n}$$$. Rearrange these numbers to satisfy $$$|a_{1} - a_{2}| \le |a_{2} - a_{3}| \le \ldots \le |a_{n-1} - a_{n}|$$$, where $$$|x|$$$ denotes absolute value of $$$x$$$. It's always possible to find such rearrangement.Note that all numbers in $$$a$$$ are not ... | 256 megabytes | import java.util.*;
public class AdjacentSorting{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0){
int n = sc.nextInt();
long arr[] = new long[n];
for(int i = 0;i<n;i++){
arr[i] = sc.nextLong();
... | Java | ["2\n6\n5 -2 4 8 6 5\n4\n8 1 4 2"] | 1 second | ["5 5 4 6 8 -2\n1 2 4 8"] | NoteIn the first test case, after given rearrangement, $$$|a_{1} - a_{2}| = 0 \le |a_{2} - a_{3}| = 1 \le |a_{3} - a_{4}| = 2 \le |a_{4} - a_{5}| = 2 \le |a_{5} - a_{6}| = 10$$$. There are other possible answers like "5 4 5 6 -2 8".In the second test case, after given rearrangement, $$$|a_{1} - a_{2}| = 1 \le |a_{2} - ... | Java 11 | standard input | [
"constructive algorithms",
"sortings"
] | 3c8bfd3199a9435cfbdee1daaacbd1b3 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$)Β β the number of test cases. The first line of each test case contains single integer $$$n$$$ ($$$3 \le n \le 10^{5}$$$)Β β the length of array $$$a$$$. It is guaranteed that the sum of values of $$$n$$$ over all test cases in the input does not ... | 1,200 | For each test case, print the rearranged version of array $$$a$$$ which satisfies given condition. If there are multiple valid rearrangements, print any of them. | standard output | |
PASSED | fef4890e203cace1d233cb8709bb26e6 | train_001.jsonl | 1586700300 | You have array of $$$n$$$ numbers $$$a_{1}, a_{2}, \ldots, a_{n}$$$. Rearrange these numbers to satisfy $$$|a_{1} - a_{2}| \le |a_{2} - a_{3}| \le \ldots \le |a_{n-1} - a_{n}|$$$, where $$$|x|$$$ denotes absolute value of $$$x$$$. It's always possible to find such rearrangement.Note that all numbers in $$$a$$$ are not ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;
public final class B {
public static void main(String[] args) {
final FastScanner fs = new FastScanner();
final int t =... | Java | ["2\n6\n5 -2 4 8 6 5\n4\n8 1 4 2"] | 1 second | ["5 5 4 6 8 -2\n1 2 4 8"] | NoteIn the first test case, after given rearrangement, $$$|a_{1} - a_{2}| = 0 \le |a_{2} - a_{3}| = 1 \le |a_{3} - a_{4}| = 2 \le |a_{4} - a_{5}| = 2 \le |a_{5} - a_{6}| = 10$$$. There are other possible answers like "5 4 5 6 -2 8".In the second test case, after given rearrangement, $$$|a_{1} - a_{2}| = 1 \le |a_{2} - ... | Java 11 | standard input | [
"constructive algorithms",
"sortings"
] | 3c8bfd3199a9435cfbdee1daaacbd1b3 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$)Β β the number of test cases. The first line of each test case contains single integer $$$n$$$ ($$$3 \le n \le 10^{5}$$$)Β β the length of array $$$a$$$. It is guaranteed that the sum of values of $$$n$$$ over all test cases in the input does not ... | 1,200 | For each test case, print the rearranged version of array $$$a$$$ which satisfies given condition. If there are multiple valid rearrangements, print any of them. | standard output | |
PASSED | 968f86bf097177dcc28cdf331f0ceac4 | train_001.jsonl | 1586700300 | You have array of $$$n$$$ numbers $$$a_{1}, a_{2}, \ldots, a_{n}$$$. Rearrange these numbers to satisfy $$$|a_{1} - a_{2}| \le |a_{2} - a_{3}| \le \ldots \le |a_{n-1} - a_{n}|$$$, where $$$|x|$$$ denotes absolute value of $$$x$$$. It's always possible to find such rearrangement.Note that all numbers in $$$a$$$ are not ... | 256 megabytes | import java.util.*;
import java.lang.*;
public class Main
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t =sc.nextInt();
while(t-->0){
int n = sc.nextInt();
List<Integer> l = new ArrayList<>();
for(int i=0;i<n;i++){
int a= sc.nextInt();
... | Java | ["2\n6\n5 -2 4 8 6 5\n4\n8 1 4 2"] | 1 second | ["5 5 4 6 8 -2\n1 2 4 8"] | NoteIn the first test case, after given rearrangement, $$$|a_{1} - a_{2}| = 0 \le |a_{2} - a_{3}| = 1 \le |a_{3} - a_{4}| = 2 \le |a_{4} - a_{5}| = 2 \le |a_{5} - a_{6}| = 10$$$. There are other possible answers like "5 4 5 6 -2 8".In the second test case, after given rearrangement, $$$|a_{1} - a_{2}| = 1 \le |a_{2} - ... | Java 11 | standard input | [
"constructive algorithms",
"sortings"
] | 3c8bfd3199a9435cfbdee1daaacbd1b3 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$)Β β the number of test cases. The first line of each test case contains single integer $$$n$$$ ($$$3 \le n \le 10^{5}$$$)Β β the length of array $$$a$$$. It is guaranteed that the sum of values of $$$n$$$ over all test cases in the input does not ... | 1,200 | For each test case, print the rearranged version of array $$$a$$$ which satisfies given condition. If there are multiple valid rearrangements, print any of them. | standard output | |
PASSED | d4ed6296f379f35a9e4ec1cbcce4814d | train_001.jsonl | 1586700300 | You have array of $$$n$$$ numbers $$$a_{1}, a_{2}, \ldots, a_{n}$$$. Rearrange these numbers to satisfy $$$|a_{1} - a_{2}| \le |a_{2} - a_{3}| \le \ldots \le |a_{n-1} - a_{n}|$$$, where $$$|x|$$$ denotes absolute value of $$$x$$$. It's always possible to find such rearrangement.Note that all numbers in $$$a$$$ are not ... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
public class HelloWorld{
public static void main(String []args) throws Exception{
//BufferedReader
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int T = Integer.parseInt(... | Java | ["2\n6\n5 -2 4 8 6 5\n4\n8 1 4 2"] | 1 second | ["5 5 4 6 8 -2\n1 2 4 8"] | NoteIn the first test case, after given rearrangement, $$$|a_{1} - a_{2}| = 0 \le |a_{2} - a_{3}| = 1 \le |a_{3} - a_{4}| = 2 \le |a_{4} - a_{5}| = 2 \le |a_{5} - a_{6}| = 10$$$. There are other possible answers like "5 4 5 6 -2 8".In the second test case, after given rearrangement, $$$|a_{1} - a_{2}| = 1 \le |a_{2} - ... | Java 11 | standard input | [
"constructive algorithms",
"sortings"
] | 3c8bfd3199a9435cfbdee1daaacbd1b3 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$)Β β the number of test cases. The first line of each test case contains single integer $$$n$$$ ($$$3 \le n \le 10^{5}$$$)Β β the length of array $$$a$$$. It is guaranteed that the sum of values of $$$n$$$ over all test cases in the input does not ... | 1,200 | For each test case, print the rearranged version of array $$$a$$$ which satisfies given condition. If there are multiple valid rearrangements, print any of them. | standard output | |
PASSED | 0051221a158a8ead7ce43dd8c1d2d451 | train_001.jsonl | 1586700300 | You have array of $$$n$$$ numbers $$$a_{1}, a_{2}, \ldots, a_{n}$$$. Rearrange these numbers to satisfy $$$|a_{1} - a_{2}| \le |a_{2} - a_{3}| \le \ldots \le |a_{n-1} - a_{n}|$$$, where $$$|x|$$$ denotes absolute value of $$$x$$$. It's always possible to find such rearrangement.Note that all numbers in $$$a$$$ are not ... | 256 megabytes | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
try {
BufferedReader br=new B... | Java | ["2\n6\n5 -2 4 8 6 5\n4\n8 1 4 2"] | 1 second | ["5 5 4 6 8 -2\n1 2 4 8"] | NoteIn the first test case, after given rearrangement, $$$|a_{1} - a_{2}| = 0 \le |a_{2} - a_{3}| = 1 \le |a_{3} - a_{4}| = 2 \le |a_{4} - a_{5}| = 2 \le |a_{5} - a_{6}| = 10$$$. There are other possible answers like "5 4 5 6 -2 8".In the second test case, after given rearrangement, $$$|a_{1} - a_{2}| = 1 \le |a_{2} - ... | Java 11 | standard input | [
"constructive algorithms",
"sortings"
] | 3c8bfd3199a9435cfbdee1daaacbd1b3 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$)Β β the number of test cases. The first line of each test case contains single integer $$$n$$$ ($$$3 \le n \le 10^{5}$$$)Β β the length of array $$$a$$$. It is guaranteed that the sum of values of $$$n$$$ over all test cases in the input does not ... | 1,200 | For each test case, print the rearranged version of array $$$a$$$ which satisfies given condition. If there are multiple valid rearrangements, print any of them. | standard output | |
PASSED | 1b2535c820ee84ec53d87100e36fc9d0 | train_001.jsonl | 1586700300 | You have array of $$$n$$$ numbers $$$a_{1}, a_{2}, \ldots, a_{n}$$$. Rearrange these numbers to satisfy $$$|a_{1} - a_{2}| \le |a_{2} - a_{3}| \le \ldots \le |a_{n-1} - a_{n}|$$$, where $$$|x|$$$ denotes absolute value of $$$x$$$. It's always possible to find such rearrangement.Note that all numbers in $$$a$$$ are not ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.StringTokenizer;
public class sortAdjDiff {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(n... | Java | ["2\n6\n5 -2 4 8 6 5\n4\n8 1 4 2"] | 1 second | ["5 5 4 6 8 -2\n1 2 4 8"] | NoteIn the first test case, after given rearrangement, $$$|a_{1} - a_{2}| = 0 \le |a_{2} - a_{3}| = 1 \le |a_{3} - a_{4}| = 2 \le |a_{4} - a_{5}| = 2 \le |a_{5} - a_{6}| = 10$$$. There are other possible answers like "5 4 5 6 -2 8".In the second test case, after given rearrangement, $$$|a_{1} - a_{2}| = 1 \le |a_{2} - ... | Java 11 | standard input | [
"constructive algorithms",
"sortings"
] | 3c8bfd3199a9435cfbdee1daaacbd1b3 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$)Β β the number of test cases. The first line of each test case contains single integer $$$n$$$ ($$$3 \le n \le 10^{5}$$$)Β β the length of array $$$a$$$. It is guaranteed that the sum of values of $$$n$$$ over all test cases in the input does not ... | 1,200 | For each test case, print the rearranged version of array $$$a$$$ which satisfies given condition. If there are multiple valid rearrangements, print any of them. | standard output | |
PASSED | f7fbdf1d4cdc19c750b4319e833bd930 | train_001.jsonl | 1586700300 | You have array of $$$n$$$ numbers $$$a_{1}, a_{2}, \ldots, a_{n}$$$. Rearrange these numbers to satisfy $$$|a_{1} - a_{2}| \le |a_{2} - a_{3}| \le \ldots \le |a_{n-1} - a_{n}|$$$, where $$$|x|$$$ denotes absolute value of $$$x$$$. It's always possible to find such rearrangement.Note that all numbers in $$$a$$$ are not ... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeSet;
import javax.swing.event.TreeExpansionEvent;
public cl... | Java | ["2\n6\n5 -2 4 8 6 5\n4\n8 1 4 2"] | 1 second | ["5 5 4 6 8 -2\n1 2 4 8"] | NoteIn the first test case, after given rearrangement, $$$|a_{1} - a_{2}| = 0 \le |a_{2} - a_{3}| = 1 \le |a_{3} - a_{4}| = 2 \le |a_{4} - a_{5}| = 2 \le |a_{5} - a_{6}| = 10$$$. There are other possible answers like "5 4 5 6 -2 8".In the second test case, after given rearrangement, $$$|a_{1} - a_{2}| = 1 \le |a_{2} - ... | Java 11 | standard input | [
"constructive algorithms",
"sortings"
] | 3c8bfd3199a9435cfbdee1daaacbd1b3 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$)Β β the number of test cases. The first line of each test case contains single integer $$$n$$$ ($$$3 \le n \le 10^{5}$$$)Β β the length of array $$$a$$$. It is guaranteed that the sum of values of $$$n$$$ over all test cases in the input does not ... | 1,200 | For each test case, print the rearranged version of array $$$a$$$ which satisfies given condition. If there are multiple valid rearrangements, print any of them. | standard output | |
PASSED | 8a4b4567794a81945c429ca199f46754 | train_001.jsonl | 1586700300 | You have array of $$$n$$$ numbers $$$a_{1}, a_{2}, \ldots, a_{n}$$$. Rearrange these numbers to satisfy $$$|a_{1} - a_{2}| \le |a_{2} - a_{3}| \le \ldots \le |a_{n-1} - a_{n}|$$$, where $$$|x|$$$ denotes absolute value of $$$x$$$. It's always possible to find such rearrangement.Note that all numbers in $$$a$$$ are not ... | 256 megabytes | import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;
public class Main{
public static void pn(Object o)
{
System.out.println(o);
}
public static void p(Object o)
{
System.out.print(o+" ");
}
public static ArrayList<Integer>[] al=new ArrayList[1100010] ;
... | Java | ["2\n6\n5 -2 4 8 6 5\n4\n8 1 4 2"] | 1 second | ["5 5 4 6 8 -2\n1 2 4 8"] | NoteIn the first test case, after given rearrangement, $$$|a_{1} - a_{2}| = 0 \le |a_{2} - a_{3}| = 1 \le |a_{3} - a_{4}| = 2 \le |a_{4} - a_{5}| = 2 \le |a_{5} - a_{6}| = 10$$$. There are other possible answers like "5 4 5 6 -2 8".In the second test case, after given rearrangement, $$$|a_{1} - a_{2}| = 1 \le |a_{2} - ... | Java 11 | standard input | [
"constructive algorithms",
"sortings"
] | 3c8bfd3199a9435cfbdee1daaacbd1b3 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$)Β β the number of test cases. The first line of each test case contains single integer $$$n$$$ ($$$3 \le n \le 10^{5}$$$)Β β the length of array $$$a$$$. It is guaranteed that the sum of values of $$$n$$$ over all test cases in the input does not ... | 1,200 | For each test case, print the rearranged version of array $$$a$$$ which satisfies given condition. If there are multiple valid rearrangements, print any of them. | standard output | |
PASSED | d5452ac536906c7c0ade693613dd1346 | train_001.jsonl | 1586700300 | You have array of $$$n$$$ numbers $$$a_{1}, a_{2}, \ldots, a_{n}$$$. Rearrange these numbers to satisfy $$$|a_{1} - a_{2}| \le |a_{2} - a_{3}| \le \ldots \le |a_{n-1} - a_{n}|$$$, where $$$|x|$$$ denotes absolute value of $$$x$$$. It's always possible to find such rearrangement.Note that all numbers in $$$a$$$ are not ... | 256 megabytes | import java.io.*;
import java.lang.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
while(t > 0) {
int n = in.nextInt();
int arr[] = new int[n];
for(int i=0; i<n; i++) {
arr[i] = in.nex... | Java | ["2\n6\n5 -2 4 8 6 5\n4\n8 1 4 2"] | 1 second | ["5 5 4 6 8 -2\n1 2 4 8"] | NoteIn the first test case, after given rearrangement, $$$|a_{1} - a_{2}| = 0 \le |a_{2} - a_{3}| = 1 \le |a_{3} - a_{4}| = 2 \le |a_{4} - a_{5}| = 2 \le |a_{5} - a_{6}| = 10$$$. There are other possible answers like "5 4 5 6 -2 8".In the second test case, after given rearrangement, $$$|a_{1} - a_{2}| = 1 \le |a_{2} - ... | Java 11 | standard input | [
"constructive algorithms",
"sortings"
] | 3c8bfd3199a9435cfbdee1daaacbd1b3 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$)Β β the number of test cases. The first line of each test case contains single integer $$$n$$$ ($$$3 \le n \le 10^{5}$$$)Β β the length of array $$$a$$$. It is guaranteed that the sum of values of $$$n$$$ over all test cases in the input does not ... | 1,200 | For each test case, print the rearranged version of array $$$a$$$ which satisfies given condition. If there are multiple valid rearrangements, 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.