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 | d14c1fe7aaf42de7ebfbe138f186aaa6 | train_000.jsonl | 1443430800 | The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.Let's enumerate all the houses from left to right, starting with one. A house is considered to be luxurious if the number of floors in it is strictly greater than in all t... | 256 megabytes | import java.util.*;
import java.io.*;
import java.util.Scanner;
public class main {
public static void main (String [] args) throws Exception {
new main();
}
BufferedReader in;
PrintWriter out;
StringTokenizer st;
public String next() throws Exception { //takes next word from input
if (st == null || !st.... | Java | ["5\n1 2 3 1 2", "4\n3 2 1 4"] | 1 second | ["3 2 0 2 0", "2 3 4 0"] | null | Java 7 | standard input | [
"implementation",
"math"
] | e544ed0904e2def0c1b2d91f94acbc56 | The first line of the input contains a single number n (1 ≤ n ≤ 105) — the number of houses in the capital of Berland. The second line contains n space-separated positive integers hi (1 ≤ hi ≤ 109), where hi equals the number of floors in the i-th house. | 1,100 | Print n integers a1, a2, ..., an, where number ai is the number of floors that need to be added to the house number i to make it luxurious. If the house is already luxurious and nothing needs to be added to it, then ai should be equal to zero. All houses are numbered from left to right, starting from one. | standard output | |
PASSED | 2727f80bfa73dd14b32db88c55f324e4 | train_000.jsonl | 1443430800 | The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.Let's enumerate all the houses from left to right, starting with one. A house is considered to be luxurious if the number of floors in it is strictly greater than in all t... | 256 megabytes | import java.util.*;
public class Spoj {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in=new Scanner(System.in);
int n=in.nextInt();
int arr[]=new int[n];
for(int i=0;i<n;i++)
arr[i]=in.nextInt();
int right[]=ne... | Java | ["5\n1 2 3 1 2", "4\n3 2 1 4"] | 1 second | ["3 2 0 2 0", "2 3 4 0"] | null | Java 7 | standard input | [
"implementation",
"math"
] | e544ed0904e2def0c1b2d91f94acbc56 | The first line of the input contains a single number n (1 ≤ n ≤ 105) — the number of houses in the capital of Berland. The second line contains n space-separated positive integers hi (1 ≤ hi ≤ 109), where hi equals the number of floors in the i-th house. | 1,100 | Print n integers a1, a2, ..., an, where number ai is the number of floors that need to be added to the house number i to make it luxurious. If the house is already luxurious and nothing needs to be added to it, then ai should be equal to zero. All houses are numbered from left to right, starting from one. | standard output | |
PASSED | 4bfc7370b2fd3c5d2d2b58d90578e9b5 | train_000.jsonl | 1443430800 | The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.Let's enumerate all the houses from left to right, starting with one. A house is considered to be luxurious if the number of floors in it is strictly greater than in all t... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class Main2 {
public static void main(String[] args) throws IOException {
File file = new File("in");
BufferedReader in;
if (file.exists()) {
in = new BufferedReader(new FileReader(file));
} else {
in = new BufferedReader(new InputStreamReader(Sys... | Java | ["5\n1 2 3 1 2", "4\n3 2 1 4"] | 1 second | ["3 2 0 2 0", "2 3 4 0"] | null | Java 7 | standard input | [
"implementation",
"math"
] | e544ed0904e2def0c1b2d91f94acbc56 | The first line of the input contains a single number n (1 ≤ n ≤ 105) — the number of houses in the capital of Berland. The second line contains n space-separated positive integers hi (1 ≤ hi ≤ 109), where hi equals the number of floors in the i-th house. | 1,100 | Print n integers a1, a2, ..., an, where number ai is the number of floors that need to be added to the house number i to make it luxurious. If the house is already luxurious and nothing needs to be added to it, then ai should be equal to zero. All houses are numbered from left to right, starting from one. | standard output | |
PASSED | a5766c92f7bebf3bb138a0ab8c3e3373 | train_000.jsonl | 1443430800 | The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.Let's enumerate all the houses from left to right, starting with one. A house is considered to be luxurious if the number of floors in it is strictly greater than in all t... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args)throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
String[]in = br.readLine().split(" ");
int[] arr = ... | Java | ["5\n1 2 3 1 2", "4\n3 2 1 4"] | 1 second | ["3 2 0 2 0", "2 3 4 0"] | null | Java 7 | standard input | [
"implementation",
"math"
] | e544ed0904e2def0c1b2d91f94acbc56 | The first line of the input contains a single number n (1 ≤ n ≤ 105) — the number of houses in the capital of Berland. The second line contains n space-separated positive integers hi (1 ≤ hi ≤ 109), where hi equals the number of floors in the i-th house. | 1,100 | Print n integers a1, a2, ..., an, where number ai is the number of floors that need to be added to the house number i to make it luxurious. If the house is already luxurious and nothing needs to be added to it, then ai should be equal to zero. All houses are numbered from left to right, starting from one. | standard output | |
PASSED | 79331bfcde9040a8049afc8397ba17d1 | train_000.jsonl | 1443430800 | The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.Let's enumerate all the houses from left to right, starting with one. A house is considered to be luxurious if the number of floors in it is strictly greater than in all t... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
long[] a = new long[n];
long[] b = new long[n];
for(int i = 0; i < n; i++)
{
... | Java | ["5\n1 2 3 1 2", "4\n3 2 1 4"] | 1 second | ["3 2 0 2 0", "2 3 4 0"] | null | Java 7 | standard input | [
"implementation",
"math"
] | e544ed0904e2def0c1b2d91f94acbc56 | The first line of the input contains a single number n (1 ≤ n ≤ 105) — the number of houses in the capital of Berland. The second line contains n space-separated positive integers hi (1 ≤ hi ≤ 109), where hi equals the number of floors in the i-th house. | 1,100 | Print n integers a1, a2, ..., an, where number ai is the number of floors that need to be added to the house number i to make it luxurious. If the house is already luxurious and nothing needs to be added to it, then ai should be equal to zero. All houses are numbered from left to right, starting from one. | standard output | |
PASSED | 2a7a680c378b5f0d04bf4d2e0b792216 | train_000.jsonl | 1443430800 | The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.Let's enumerate all the houses from left to right, starting with one. A house is considered to be luxurious if the number of floors in it is strictly greater than in all t... | 256 megabytes | import java.util.Scanner;
public class B {
public static void main(String args[]){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int a[] = new int[n];
for(int i = 0 ; i < n ; i++)
a[i] = in.nextInt();
int b[] = new int[n];int max=a[n-1];
for(... | Java | ["5\n1 2 3 1 2", "4\n3 2 1 4"] | 1 second | ["3 2 0 2 0", "2 3 4 0"] | null | Java 7 | standard input | [
"implementation",
"math"
] | e544ed0904e2def0c1b2d91f94acbc56 | The first line of the input contains a single number n (1 ≤ n ≤ 105) — the number of houses in the capital of Berland. The second line contains n space-separated positive integers hi (1 ≤ hi ≤ 109), where hi equals the number of floors in the i-th house. | 1,100 | Print n integers a1, a2, ..., an, where number ai is the number of floors that need to be added to the house number i to make it luxurious. If the house is already luxurious and nothing needs to be added to it, then ai should be equal to zero. All houses are numbered from left to right, starting from one. | standard output | |
PASSED | 24a115d0e08823ee333199204c6f09fe | train_000.jsonl | 1443430800 | The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.Let's enumerate all the houses from left to right, starting with one. A house is considered to be luxurious if the number of floors in it is strictly greater than in all t... | 256 megabytes | import java.io.*;
import java.util.*;
public class B
{
FastScanner in;
PrintWriter out;
int i = 0, j = 0;
void solve() {
/**************START**************/
int n = in.nextInt();
int[] seq = new int[n];
for (i = 0; i < n; i++)
{
seq[i] = in.nextInt();
}
int high = seq[n-1];
seq[n-1] = 0;
fo... | Java | ["5\n1 2 3 1 2", "4\n3 2 1 4"] | 1 second | ["3 2 0 2 0", "2 3 4 0"] | null | Java 7 | standard input | [
"implementation",
"math"
] | e544ed0904e2def0c1b2d91f94acbc56 | The first line of the input contains a single number n (1 ≤ n ≤ 105) — the number of houses in the capital of Berland. The second line contains n space-separated positive integers hi (1 ≤ hi ≤ 109), where hi equals the number of floors in the i-th house. | 1,100 | Print n integers a1, a2, ..., an, where number ai is the number of floors that need to be added to the house number i to make it luxurious. If the house is already luxurious and nothing needs to be added to it, then ai should be equal to zero. All houses are numbered from left to right, starting from one. | standard output | |
PASSED | 6f135f088305b518d5c4ea83bbca541e | train_000.jsonl | 1443430800 | The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.Let's enumerate all the houses from left to right, starting with one. A house is considered to be luxurious if the number of floors in it is strictly greater than in all t... | 256 megabytes | //package codeforces;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;
import java.util.StringTokenizer;
public class LuxuriousHouses
{
public static void main(String[] args)
{
MyScanner scan = new MyScanner();
int n = scan.nextInt();
int[]... | Java | ["5\n1 2 3 1 2", "4\n3 2 1 4"] | 1 second | ["3 2 0 2 0", "2 3 4 0"] | null | Java 7 | standard input | [
"implementation",
"math"
] | e544ed0904e2def0c1b2d91f94acbc56 | The first line of the input contains a single number n (1 ≤ n ≤ 105) — the number of houses in the capital of Berland. The second line contains n space-separated positive integers hi (1 ≤ hi ≤ 109), where hi equals the number of floors in the i-th house. | 1,100 | Print n integers a1, a2, ..., an, where number ai is the number of floors that need to be added to the house number i to make it luxurious. If the house is already luxurious and nothing needs to be added to it, then ai should be equal to zero. All houses are numbered from left to right, starting from one. | standard output | |
PASSED | bfe0deaaf2899e01600468b7c567407c | train_000.jsonl | 1443430800 | The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.Let's enumerate all the houses from left to right, starting with one. A house is considered to be luxurious if the number of floors in it is strictly greater than in all t... | 256 megabytes | //package TestOnly.Div2B_322.Code1;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Main
{
FastScanner in;
PrintWriter out;
public void solve() throws IOException
{
int n = in.nextInt();
in... | Java | ["5\n1 2 3 1 2", "4\n3 2 1 4"] | 1 second | ["3 2 0 2 0", "2 3 4 0"] | null | Java 7 | standard input | [
"implementation",
"math"
] | e544ed0904e2def0c1b2d91f94acbc56 | The first line of the input contains a single number n (1 ≤ n ≤ 105) — the number of houses in the capital of Berland. The second line contains n space-separated positive integers hi (1 ≤ hi ≤ 109), where hi equals the number of floors in the i-th house. | 1,100 | Print n integers a1, a2, ..., an, where number ai is the number of floors that need to be added to the house number i to make it luxurious. If the house is already luxurious and nothing needs to be added to it, then ai should be equal to zero. All houses are numbered from left to right, starting from one. | standard output | |
PASSED | e94072ad4e1fd203b7d61a4d5170e9ac | train_000.jsonl | 1443430800 | The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.Let's enumerate all the houses from left to right, starting with one. A house is considered to be luxurious if the number of floors in it is strictly greater than in all t... | 256 megabytes | //package TestOnly.Div2B_322.Code1;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Main
{
FastScanner in;
PrintWriter out;
/*
* public void solve() throws IOException { int n = in.nextInt(); ... | Java | ["5\n1 2 3 1 2", "4\n3 2 1 4"] | 1 second | ["3 2 0 2 0", "2 3 4 0"] | null | Java 7 | standard input | [
"implementation",
"math"
] | e544ed0904e2def0c1b2d91f94acbc56 | The first line of the input contains a single number n (1 ≤ n ≤ 105) — the number of houses in the capital of Berland. The second line contains n space-separated positive integers hi (1 ≤ hi ≤ 109), where hi equals the number of floors in the i-th house. | 1,100 | Print n integers a1, a2, ..., an, where number ai is the number of floors that need to be added to the house number i to make it luxurious. If the house is already luxurious and nothing needs to be added to it, then ai should be equal to zero. All houses are numbered from left to right, starting from one. | standard output | |
PASSED | f693a1d69123d3fa20ac282607e91eaf | train_000.jsonl | 1443430800 | The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.Let's enumerate all the houses from left to right, starting with one. A house is considered to be luxurious if the number of floors in it is strictly greater than in all t... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class LuxuriousHouses {
public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseIn... | Java | ["5\n1 2 3 1 2", "4\n3 2 1 4"] | 1 second | ["3 2 0 2 0", "2 3 4 0"] | null | Java 7 | standard input | [
"implementation",
"math"
] | e544ed0904e2def0c1b2d91f94acbc56 | The first line of the input contains a single number n (1 ≤ n ≤ 105) — the number of houses in the capital of Berland. The second line contains n space-separated positive integers hi (1 ≤ hi ≤ 109), where hi equals the number of floors in the i-th house. | 1,100 | Print n integers a1, a2, ..., an, where number ai is the number of floors that need to be added to the house number i to make it luxurious. If the house is already luxurious and nothing needs to be added to it, then ai should be equal to zero. All houses are numbered from left to right, starting from one. | standard output | |
PASSED | c1fdf09d30b8febceef5f7699f7716c1 | train_000.jsonl | 1443430800 | The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.Let's enumerate all the houses from left to right, starting with one. A house is considered to be luxurious if the number of floors in it is strictly greater than in all t... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.Random;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
im... | Java | ["5\n1 2 3 1 2", "4\n3 2 1 4"] | 1 second | ["3 2 0 2 0", "2 3 4 0"] | null | Java 7 | standard input | [
"implementation",
"math"
] | e544ed0904e2def0c1b2d91f94acbc56 | The first line of the input contains a single number n (1 ≤ n ≤ 105) — the number of houses in the capital of Berland. The second line contains n space-separated positive integers hi (1 ≤ hi ≤ 109), where hi equals the number of floors in the i-th house. | 1,100 | Print n integers a1, a2, ..., an, where number ai is the number of floors that need to be added to the house number i to make it luxurious. If the house is already luxurious and nothing needs to be added to it, then ai should be equal to zero. All houses are numbered from left to right, starting from one. | standard output | |
PASSED | 91cdb1caccd4e919b8e0f0009670776d | train_000.jsonl | 1443430800 | The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.Let's enumerate all the houses from left to right, starting with one. A house is considered to be luxurious if the number of floors in it is strictly greater than in all t... | 256 megabytes | import java.util.Scanner;
public class Ma {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int[] ArrIn= new int[N];
int[] ArrOut= new int[N];
int i=0;
for (int k=0; k<N; k++) {
ArrIn[k] = sc.nextInt();
... | Java | ["5\n1 2 3 1 2", "4\n3 2 1 4"] | 1 second | ["3 2 0 2 0", "2 3 4 0"] | null | Java 7 | standard input | [
"implementation",
"math"
] | e544ed0904e2def0c1b2d91f94acbc56 | The first line of the input contains a single number n (1 ≤ n ≤ 105) — the number of houses in the capital of Berland. The second line contains n space-separated positive integers hi (1 ≤ hi ≤ 109), where hi equals the number of floors in the i-th house. | 1,100 | Print n integers a1, a2, ..., an, where number ai is the number of floors that need to be added to the house number i to make it luxurious. If the house is already luxurious and nothing needs to be added to it, then ai should be equal to zero. All houses are numbered from left to right, starting from one. | standard output | |
PASSED | 366362d58bc433559364d2887e4e6e58 | train_000.jsonl | 1443430800 | The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.Let's enumerate all the houses from left to right, starting with one. A house is considered to be luxurious if the number of floors in it is strictly greater than in all t... | 256 megabytes | import java.io.*;
import java.util.*;
public class P581B{
static int[] run(int[] ar){
int[] max_ar = new int[ar.length];
for (int i=ar.length-1; i>-1; i--) {
if(i==ar.length-1)
max_ar[i] = 0;
else{
if(max_ar[i+1]>ar[i+1])
max_ar[i] = max_ar[i+1];
else
max_ar[i] = ar[i+1];
}
}
in... | Java | ["5\n1 2 3 1 2", "4\n3 2 1 4"] | 1 second | ["3 2 0 2 0", "2 3 4 0"] | null | Java 7 | standard input | [
"implementation",
"math"
] | e544ed0904e2def0c1b2d91f94acbc56 | The first line of the input contains a single number n (1 ≤ n ≤ 105) — the number of houses in the capital of Berland. The second line contains n space-separated positive integers hi (1 ≤ hi ≤ 109), where hi equals the number of floors in the i-th house. | 1,100 | Print n integers a1, a2, ..., an, where number ai is the number of floors that need to be added to the house number i to make it luxurious. If the house is already luxurious and nothing needs to be added to it, then ai should be equal to zero. All houses are numbered from left to right, starting from one. | standard output | |
PASSED | fbc361980452a66da09d06466e1ac246 | train_000.jsonl | 1443430800 | The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.Let's enumerate all the houses from left to right, starting with one. A house is considered to be luxurious if the number of floors in it is strictly greater than in all t... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class P581B {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
... | Java | ["5\n1 2 3 1 2", "4\n3 2 1 4"] | 1 second | ["3 2 0 2 0", "2 3 4 0"] | null | Java 7 | standard input | [
"implementation",
"math"
] | e544ed0904e2def0c1b2d91f94acbc56 | The first line of the input contains a single number n (1 ≤ n ≤ 105) — the number of houses in the capital of Berland. The second line contains n space-separated positive integers hi (1 ≤ hi ≤ 109), where hi equals the number of floors in the i-th house. | 1,100 | Print n integers a1, a2, ..., an, where number ai is the number of floors that need to be added to the house number i to make it luxurious. If the house is already luxurious and nothing needs to be added to it, then ai should be equal to zero. All houses are numbered from left to right, starting from one. | standard output | |
PASSED | b6c6f2a1737d0658ef6af8cf46a66071 | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | //babes, its gonna take time
import java.util.*;
import java.io.*;
public class codeforces
{
public static void main(String[] args)
{
FastReader s=new FastReader();
int t=s.nextInt();
while(t-->0)
{
int max=0;
int n=s.nextInt();
String str1=... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | f36ad37ce5497e74f84d53292adc6580 | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args)
{
Scanner s=new Scanner(System.in);
StringBuilder sb=new StringBuilder();
int t=s.nextInt();
for(int i=0;i<t;i++)
{
int n=s.nextInt();
String str1=s.next();
String str2=s.next();
int p=0;
... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | c879550a5dd8d94bf1a1a3c45357c95d | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.PriorityQueue;
imp... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | 295d2d0f0c5b7d84bdd7aeb23c082741 | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
public static void main(String[] args) throws Exception {
PrintWriter pw = new PrintWriter(System.out);
Scanner s = new Scanner(System.in);
int t = s.nextInt();
while(t--!=0) {
int n = s.nextInt();
String a = s.next()... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | ccbc9e4795c9941aa872e89651e8fb13 | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | import java.io.*;
import java.util.*;
public class C {
public static void main(String args[]) throws Exception {
BufferedReader bu = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(bu.readLine());
StringBuilder sb = new StringBuilder();
inner:while (t-... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | b09ea1306ae2a7ce86b94bb71d3805ea | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.io.*;
import java.math.*;
public class Main7{
static public void main(String args[])throws IOException{
int tt=i();
StringBuilder sb=new StringBuilder();
for(int ttt=1;ttt<=tt;ttt++){
int n=i();
String... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | b7f7e6357107cd789dbc88fb2d5d7c5e | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | import java.util.*;
import java.math.*;
public class Main{
public static int solve(String A,String B,int n){
char[] a = A.toCharArray();
char[] b = B.toCharArray();
String s = "abcdefghijklmnopqrst";
for(int i = 0 ; i < n ; i++){
if(a[i] > b[i]){
return -1... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | 10ae6207b7c39b6694eb4df5ec74f00b | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | import java.util.*;
import java.math.*;
public class Main{
public static int solve(String A,String B,int n){
char[] a = A.toCharArray();
char[] b = B.toCharArray();
String s = "abcdefghijklmnopqrst";
for(int i = 0 ; i < n ; i++){
if(a[i] > b[i]){
return -1... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | 5b0c636df35b9f9bb12ac08cb7654cf9 | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | import java.util.*;
import java.math.*;
public class Main{
public static int solve(String A,String B,int n){
char[] a = A.toCharArray();
char[] b = B.toCharArray();
String s = "abcdefghijklmnopqrst";
for(int i = 0 ; i < n ; i++){
if(a[i] > b[i]){
return -1... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | f9ae29152caa190a03ec2e2b4a406ca1 | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | import java.util.*;
import java.math.*;
public class Main{
public static int solve(String A,String B,int n){
char[] a = A.toCharArray();
char[] b = B.toCharArray();
String s = "abcdefghijklmnopqrst";
for(int i = 0 ; i < n ; i++){
if(a[i] > b[i]){
return -1... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | 4dd5463e61a0771e1b0f4a0885cd751c | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | import java.util.*;
import java.math.*;
public class Main{
public static int solve(String A,String B,int n){
char[] a = A.toCharArray();
char[] b = B.toCharArray();
String s = "abcdefghijklmnopqrst";
for(int i = 0 ; i < n ; i++){
if(a[i] > b[i]){
return -1... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | d7a7df220e5be8271e3eca9aa6fe9242 | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
static class node{
int a, b;
public node(int x, int y) {
a = x;
b = y;
}
}
static class Pair implements Comparable<Pair>{
int a;
int b;
// int ind;
// public Pair(int x, long y) {a = x;b=y;}
public Pair... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | bc90817123f389583c92af375bab0dc0 | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author sofiane
*/
public class Main {
public static void main(String[] arg... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | d90c832eee75166d316f8102c11c753f | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes |
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
public class TestClass {
static final class InputReader {
private final InputStream stream;
private final byte[] buf = new byte[1024];
private int curChar;
private int numChars;
public InputReader... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | 8fd26378f2316708258b0630fad6c31a | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
public final class C {
private static final class UnionFind {
private final int[] parent;
private final int[] size;
private int count;
private UnionFind(int n) {
parent = new i... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | 80d6fafe86f0b886005b4660743bc1ba | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.List;
import java.util.Set;
public class Main {
private sta... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | f46fcaf3c7397bd9e5f00127fa12f922 | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Main{
static long mod = (long)(1e9+7);
public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
public static void main(String sp[])throws IOException{
Scanner sc = new Scanner(System.in);
//FastReader sc = new ... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | 2153d0d58535fcd64fe1c776549e6610 | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static Scanner sc = new Scanner(System.in);
static PrintWriter out = new PrintWriter(System.out);
static char s[], t[];
static void solve() throws Exception{
int n = sc.nextInt(), ans = 0;
s = sc.nextLine().toCharArray();
t = sc.nextLine().toCharArr... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | a38e23eec146458b4ce5b0d3cf1497f5 | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.*;
/**
* Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10081-edutools
*/
public class Main {
public static void main(String[] args) ... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | 84a4ba6d346b8d01c771e949cc38efc5 | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Main{
static long mod = (long)(1e9+7);
public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
public static void main(String sp[])throws IOException{
Scanner sc = new Scanner(System.in);
//FastReader sc = new ... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | c57f0e507f39fe6a65a82db7ba021b51 | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | // https://codeforces.com/contest/1384/problem/C
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
public class Solution
{
static class FastReader
{
BufferedReader br;
StringTokeniz... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | 530da957e690daf88acb3aedfe4a429a | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | import java.util.*;
import java.io.*;
public class Question4 {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int t = sc.nextInt();
while(t-->0) {
solve();
}
}
public static void solve() {
int n = sc.nextInt();
char[] a = sc.next().toCharArray();
char[] b... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | ada9ca0c9c5eaa620c5048da06540535 | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | import java.util.*;
import java.io.*;
public class Question4 {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int t = sc.nextInt();
while(t-->0) {
solve();
}
}
public static void solve() {
int n = sc.nextInt();
char[] a = sc.next().toCharArray();
char[] b... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | 174f8472865d71644af294569d92bea2 | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class Task4 {
public static void main(String[] args) throws IOException {
new Task4().solve();
}
private void solve() throws IOException {
BufferedReader f = ne... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | 5f9cf5001924bb0c457d6a4ebc5e4d10 | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | import java.util.Scanner;
// https://codeforces.com/contest/1384/problem/C
public class C {
public static final Scanner INPUT = new Scanner(System.in);
public static void main(String[] args) {
int t = Integer.parseInt(INPUT.nextLine());
while (t > 0) {
t--;
int n = Integer.parseInt(INPUT.nextLine());
S... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | b43a95d102199b40dfb02e3de34f87aa | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
// https://codeforces.com/contest/1384/problem/C
public class C {
private static final int N_SIZE = 20;
public static final Scanner INPUT = new Scanner(System.in);
public static void main(String[] args) {
int t = Integer.parseInt(INPU... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | d55cdf2d55a25af6e3708e37f435bd2d | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | // package com.company.codeforces;
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int t=input.nextInt();
while (t-->0) {
int n = input.nextInt();
char a[] = new char[n];
... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | 2fc0d95697ee0da8f6640b2341f0b810 | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int t = scanner.nextInt();
while (t-- > 0) {
// Input
int n = scanner.nextInt();
char[] a = scanner.next().toCharArray();
... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | 709d6398dedbef92c4ddcc46e5c0dece | train_000.jsonl | 1595601300 | Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects must be strictly greater alphabetically than $$$x$$$ (read statement for better understanding). You can make hacks in these problems independently.Koa the Koa... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public cl... | Java | ["5\n3\naab\nbcc\n4\ncabc\nabcb\n3\nabc\ntsr\n4\naabd\ncccd\n5\nabcbd\nbcdda"] | 1 second | ["2\n-1\n3\n2\n-1"] | Note In the $$$1$$$-st test case Koa: selects positions $$$1$$$ and $$$2$$$ and sets $$$A_1 = A_2 = $$$ b ($$$\color{red}{aa}b \rightarrow \color{blue}{bb}b$$$). selects positions $$$2$$$ and $$$3$$$ and sets $$$A_2 = A_3 = $$$ c ($$$b\color{red}{bb} \rightarrow b\color{blue}{cc}$$$). In the $$$2$$$-nd test case ... | Java 11 | standard input | [
"greedy",
"graphs",
"dsu",
"sortings",
"dfs and similar",
"trees"
] | 7c6e8bc160a17dbc6d55c6dc40fe0988 | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of strings $$$A$$$ and $$$B$$$. The second line of each te... | 1,700 | For each test case: Print on a single line the smallest number of moves she has to do to make strings equal to each other ($$$A = B$$$) or $$$-1$$$ if there is no way to make them equal. | standard output | |
PASSED | 7890391087a9da218f15b5639bf37dc8 | train_000.jsonl | 1354960800 | Vasya is pressing the keys on the keyboard reluctantly, squeezing out his ideas on the classical epos depicted in Homer's Odysseus... How can he explain to his literature teacher that he isn't going to become a writer? In fact, he is going to become a programmer. So, he would take great pleasure in writing a program, b... | 256 megabytes | import java.io.*;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;
public class Main {
static int a[], n;
static int dist[][];
public static void main(String[] args) throws IOException, InterruptedException {
FastReader in = new FastReader(new File("... | Java | ["4\n2 1 6 4\n3 4 4 2", "4\n10 5 6 4\n1 11 4 2", "3\n10 1 10\n1 10 1 1"] | 1 second | ["3", "6", "3"] | NoteIn the first sample the editor contains four lines. Let's represent the cursor's possible positions in the line as numbers. Letter s represents the cursor's initial position, letter t represents the last one. Then all possible positions of the cursor in the text editor are described by the following table.12312123s... | Java 8 | input.txt | [
"greedy",
"graphs",
"shortest paths",
"data structures",
"dfs and similar"
] | d02e8f3499c4eca03e0ae9c23f80dc95 | The first line of the input contains an integer n (1 ≤ n ≤ 100) — the number of lines in the file. The second line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 105), separated by single spaces. The third line contains four integers r1, c1, r2, c2 (1 ≤ r1, r2 ≤ n, 1 ≤ c1 ≤ ar1 + 1, 1 ≤ c2 ≤ ar2 + 1). | 1,600 | Print a single integer — the minimum number of times Vasya should push a key to move the cursor from position (r1, c1) to position (r2, c2). | output.txt | |
PASSED | cec7ba74390464ea80b1cbfc9a6e086e | train_000.jsonl | 1354960800 | Vasya is pressing the keys on the keyboard reluctantly, squeezing out his ideas on the classical epos depicted in Homer's Odysseus... How can he explain to his literature teacher that he isn't going to become a writer? In fact, he is going to become a programmer. So, he would take great pleasure in writing a program, b... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.LinkedList;
import java.util.StringTokenizer;
public class cf253c {
static int n, xs, ys, xd, yd;
static int[] arr;
static boolean valid(pair p) {
if ... | Java | ["4\n2 1 6 4\n3 4 4 2", "4\n10 5 6 4\n1 11 4 2", "3\n10 1 10\n1 10 1 1"] | 1 second | ["3", "6", "3"] | NoteIn the first sample the editor contains four lines. Let's represent the cursor's possible positions in the line as numbers. Letter s represents the cursor's initial position, letter t represents the last one. Then all possible positions of the cursor in the text editor are described by the following table.12312123s... | Java 8 | input.txt | [
"greedy",
"graphs",
"shortest paths",
"data structures",
"dfs and similar"
] | d02e8f3499c4eca03e0ae9c23f80dc95 | The first line of the input contains an integer n (1 ≤ n ≤ 100) — the number of lines in the file. The second line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 105), separated by single spaces. The third line contains four integers r1, c1, r2, c2 (1 ≤ r1, r2 ≤ n, 1 ≤ c1 ≤ ar1 + 1, 1 ≤ c2 ≤ ar2 + 1). | 1,600 | Print a single integer — the minimum number of times Vasya should push a key to move the cursor from position (r1, c1) to position (r2, c2). | output.txt | |
PASSED | 17df4977891bc3f18d02bf5eba573f69 | train_000.jsonl | 1354960800 | Vasya is pressing the keys on the keyboard reluctantly, squeezing out his ideas on the classical epos depicted in Homer's Odysseus... How can he explain to his literature teacher that he isn't going to become a writer? In fact, he is going to become a programmer. So, he would take great pleasure in writing a program, b... | 256 megabytes | import java.util.*;
import java.io.*;
public class C253 {
static int n;
static int xs, ys, xf, yf;
static boolean vis[][];
static int[][] dist;
static int[] dx = {0, 0, 1, -1};
static int[] dy = {1, -1, 0, 0};
public static int bfs() {
Queue<Pair> qu = new LinkedList<>();
vis[xs][ys] = true;
qu.add(... | Java | ["4\n2 1 6 4\n3 4 4 2", "4\n10 5 6 4\n1 11 4 2", "3\n10 1 10\n1 10 1 1"] | 1 second | ["3", "6", "3"] | NoteIn the first sample the editor contains four lines. Let's represent the cursor's possible positions in the line as numbers. Letter s represents the cursor's initial position, letter t represents the last one. Then all possible positions of the cursor in the text editor are described by the following table.12312123s... | Java 8 | input.txt | [
"greedy",
"graphs",
"shortest paths",
"data structures",
"dfs and similar"
] | d02e8f3499c4eca03e0ae9c23f80dc95 | The first line of the input contains an integer n (1 ≤ n ≤ 100) — the number of lines in the file. The second line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 105), separated by single spaces. The third line contains four integers r1, c1, r2, c2 (1 ≤ r1, r2 ≤ n, 1 ≤ c1 ≤ ar1 + 1, 1 ≤ c2 ≤ ar2 + 1). | 1,600 | Print a single integer — the minimum number of times Vasya should push a key to move the cursor from position (r1, c1) to position (r2, c2). | output.txt | |
PASSED | c4bce8b8f994f9baa26ae1181a57a26c | train_000.jsonl | 1354960800 | Vasya is pressing the keys on the keyboard reluctantly, squeezing out his ideas on the classical epos depicted in Homer's Odysseus... How can he explain to his literature teacher that he isn't going to become a writer? In fact, he is going to become a programmer. So, he would take great pleasure in writing a program, b... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Euler {
static int n;
static int[] a;
static int[][] vis = new int[101][100001];
static int[][] dist = new int[101][100001];
static int[][] moves = {{1, 0},{-1, 0},{0, 1},{0, -1}};
static int r1, c1, r2, c2;
static FastReader in =new FastRe... | Java | ["4\n2 1 6 4\n3 4 4 2", "4\n10 5 6 4\n1 11 4 2", "3\n10 1 10\n1 10 1 1"] | 1 second | ["3", "6", "3"] | NoteIn the first sample the editor contains four lines. Let's represent the cursor's possible positions in the line as numbers. Letter s represents the cursor's initial position, letter t represents the last one. Then all possible positions of the cursor in the text editor are described by the following table.12312123s... | Java 8 | input.txt | [
"greedy",
"graphs",
"shortest paths",
"data structures",
"dfs and similar"
] | d02e8f3499c4eca03e0ae9c23f80dc95 | The first line of the input contains an integer n (1 ≤ n ≤ 100) — the number of lines in the file. The second line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 105), separated by single spaces. The third line contains four integers r1, c1, r2, c2 (1 ≤ r1, r2 ≤ n, 1 ≤ c1 ≤ ar1 + 1, 1 ≤ c2 ≤ ar2 + 1). | 1,600 | Print a single integer — the minimum number of times Vasya should push a key to move the cursor from position (r1, c1) to position (r2, c2). | output.txt | |
PASSED | 4719d1794177dbd693ee6e0951c0a57e | train_000.jsonl | 1354960800 | Vasya is pressing the keys on the keyboard reluctantly, squeezing out his ideas on the classical epos depicted in Homer's Odysseus... How can he explain to his literature teacher that he isn't going to become a writer? In fact, he is going to become a programmer. So, he would take great pleasure in writing a program, b... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class E {
public static void main(String[] args) throws IOException
{... | Java | ["4\n2 1 6 4\n3 4 4 2", "4\n10 5 6 4\n1 11 4 2", "3\n10 1 10\n1 10 1 1"] | 1 second | ["3", "6", "3"] | NoteIn the first sample the editor contains four lines. Let's represent the cursor's possible positions in the line as numbers. Letter s represents the cursor's initial position, letter t represents the last one. Then all possible positions of the cursor in the text editor are described by the following table.12312123s... | Java 8 | input.txt | [
"greedy",
"graphs",
"shortest paths",
"data structures",
"dfs and similar"
] | d02e8f3499c4eca03e0ae9c23f80dc95 | The first line of the input contains an integer n (1 ≤ n ≤ 100) — the number of lines in the file. The second line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 105), separated by single spaces. The third line contains four integers r1, c1, r2, c2 (1 ≤ r1, r2 ≤ n, 1 ≤ c1 ≤ ar1 + 1, 1 ≤ c2 ≤ ar2 + 1). | 1,600 | Print a single integer — the minimum number of times Vasya should push a key to move the cursor from position (r1, c1) to position (r2, c2). | output.txt | |
PASSED | 76e94daf3d95e330a91a903c3cf59850 | train_000.jsonl | 1354960800 | Vasya is pressing the keys on the keyboard reluctantly, squeezing out his ideas on the classical epos depicted in Homer's Odysseus... How can he explain to his literature teacher that he isn't going to become a writer? In fact, he is going to become a programmer. So, he would take great pleasure in writing a program, b... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static InputReader in = new InputReader(System.in);
static PrintWriter out = new PrintWriter(System.out);
static int MOD = 1000000007;
static int M = 505;
static int oo = (int)1e9;
static int[] di = {-1, 1, 0, 0};
static int[] dj = {0, 0, -1, 1};
... | Java | ["4\n2 1 6 4\n3 4 4 2", "4\n10 5 6 4\n1 11 4 2", "3\n10 1 10\n1 10 1 1"] | 1 second | ["3", "6", "3"] | NoteIn the first sample the editor contains four lines. Let's represent the cursor's possible positions in the line as numbers. Letter s represents the cursor's initial position, letter t represents the last one. Then all possible positions of the cursor in the text editor are described by the following table.12312123s... | Java 8 | input.txt | [
"greedy",
"graphs",
"shortest paths",
"data structures",
"dfs and similar"
] | d02e8f3499c4eca03e0ae9c23f80dc95 | The first line of the input contains an integer n (1 ≤ n ≤ 100) — the number of lines in the file. The second line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 105), separated by single spaces. The third line contains four integers r1, c1, r2, c2 (1 ≤ r1, r2 ≤ n, 1 ≤ c1 ≤ ar1 + 1, 1 ≤ c2 ≤ ar2 + 1). | 1,600 | Print a single integer — the minimum number of times Vasya should push a key to move the cursor from position (r1, c1) to position (r2, c2). | output.txt | |
PASSED | 57c877f848290300ae5b8f1f947bc976 | train_000.jsonl | 1354960800 | Vasya is pressing the keys on the keyboard reluctantly, squeezing out his ideas on the classical epos depicted in Homer's Odysseus... How can he explain to his literature teacher that he isn't going to become a writer? In fact, he is going to become a programmer. So, he would take great pleasure in writing a program, b... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static InputReader in = new InputReader(System.in);
static PrintWriter out = new PrintWriter(System.out);
static int MOD = 1000000007;
static int M = 505;
static int oo = (int)1e9;
public static void main(String[] args) throws IOException {
Buf... | Java | ["4\n2 1 6 4\n3 4 4 2", "4\n10 5 6 4\n1 11 4 2", "3\n10 1 10\n1 10 1 1"] | 1 second | ["3", "6", "3"] | NoteIn the first sample the editor contains four lines. Let's represent the cursor's possible positions in the line as numbers. Letter s represents the cursor's initial position, letter t represents the last one. Then all possible positions of the cursor in the text editor are described by the following table.12312123s... | Java 8 | input.txt | [
"greedy",
"graphs",
"shortest paths",
"data structures",
"dfs and similar"
] | d02e8f3499c4eca03e0ae9c23f80dc95 | The first line of the input contains an integer n (1 ≤ n ≤ 100) — the number of lines in the file. The second line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 105), separated by single spaces. The third line contains four integers r1, c1, r2, c2 (1 ≤ r1, r2 ≤ n, 1 ≤ c1 ≤ ar1 + 1, 1 ≤ c2 ≤ ar2 + 1). | 1,600 | Print a single integer — the minimum number of times Vasya should push a key to move the cursor from position (r1, c1) to position (r2, c2). | output.txt | |
PASSED | 5964bb86bafdab23838b1abe37ebb584 | train_000.jsonl | 1354960800 | Vasya is pressing the keys on the keyboard reluctantly, squeezing out his ideas on the classical epos depicted in Homer's Odysseus... How can he explain to his literature teacher that he isn't going to become a writer? In fact, he is going to become a programmer. So, he would take great pleasure in writing a program, b... | 256 megabytes | import java.awt.Point;
import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class TextEditor {
static class Solver {
int n,r1,c1,r2,c2;
int[] arr;
int[][] set = new int[105][(int)1e5 + 5];
public void solve(MyReader in, PrintWriter out) {
n = in.next... | Java | ["4\n2 1 6 4\n3 4 4 2", "4\n10 5 6 4\n1 11 4 2", "3\n10 1 10\n1 10 1 1"] | 1 second | ["3", "6", "3"] | NoteIn the first sample the editor contains four lines. Let's represent the cursor's possible positions in the line as numbers. Letter s represents the cursor's initial position, letter t represents the last one. Then all possible positions of the cursor in the text editor are described by the following table.12312123s... | Java 8 | input.txt | [
"greedy",
"graphs",
"shortest paths",
"data structures",
"dfs and similar"
] | d02e8f3499c4eca03e0ae9c23f80dc95 | The first line of the input contains an integer n (1 ≤ n ≤ 100) — the number of lines in the file. The second line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 105), separated by single spaces. The third line contains four integers r1, c1, r2, c2 (1 ≤ r1, r2 ≤ n, 1 ≤ c1 ≤ ar1 + 1, 1 ≤ c2 ≤ ar2 + 1). | 1,600 | Print a single integer — the minimum number of times Vasya should push a key to move the cursor from position (r1, c1) to position (r2, c2). | output.txt | |
PASSED | 80f668feb1fec8a4a5fffc83541806ea | train_000.jsonl | 1354960800 | Vasya is pressing the keys on the keyboard reluctantly, squeezing out his ideas on the classical epos depicted in Homer's Odysseus... How can he explain to his literature teacher that he isn't going to become a writer? In fact, he is going to become a programmer. So, he would take great pleasure in writing a program, b... | 256 megabytes | import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.*;
public class A_GENERAL {
// for fast output printing : use printwriter or str... | Java | ["4\n2 1 6 4\n3 4 4 2", "4\n10 5 6 4\n1 11 4 2", "3\n10 1 10\n1 10 1 1"] | 1 second | ["3", "6", "3"] | NoteIn the first sample the editor contains four lines. Let's represent the cursor's possible positions in the line as numbers. Letter s represents the cursor's initial position, letter t represents the last one. Then all possible positions of the cursor in the text editor are described by the following table.12312123s... | Java 8 | input.txt | [
"greedy",
"graphs",
"shortest paths",
"data structures",
"dfs and similar"
] | d02e8f3499c4eca03e0ae9c23f80dc95 | The first line of the input contains an integer n (1 ≤ n ≤ 100) — the number of lines in the file. The second line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 105), separated by single spaces. The third line contains four integers r1, c1, r2, c2 (1 ≤ r1, r2 ≤ n, 1 ≤ c1 ≤ ar1 + 1, 1 ≤ c2 ≤ ar2 + 1). | 1,600 | Print a single integer — the minimum number of times Vasya should push a key to move the cursor from position (r1, c1) to position (r2, c2). | output.txt | |
PASSED | b645f237db14a32585458f9ccfc00a4d | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
try {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 8 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | e4d83de2039db0b4d5a8c5cb7bd57ba1 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.awt.Point;
import java.io.*;
import java.util.*;
import javax.swing.*;
public class Xtend {
public static void main(String[] args)throws IOException{
BufferedReader x=new BufferedReader(new InputStreamReader(System.in));
int m=Integer.parseInt(x.readLine());
String []array=new String[m];
String result=... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 8 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | 9986d3da3c22604f2d39b8e779fa21b4 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
public class SinkingShip {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
List... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | 5902a278fc40aaaea5688a0f66ba63e4 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
ArrayList<String> rats = new ArrayList<String>();
ArrayList<String> womenOrChildren = new ArrayList<String>();
ArrayList<String> m... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | a660462452132cdfa4c74c813b971637 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
ob[] a = new ob[n];
for (int i = 0; i < a.length; i++) {
a[i] = new ob(in.next(), in.next());
}
for (int i = 0;... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | f088b8b58ce7124053b90c2b56426341 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Vector;
public class Main {
/**
* @param args
* @throws IOException
* @throws NumberFormatException
*/
public static void main(String[] args) throws NumberFormatException, IOException {
B... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | 1f5a5707334609a2d8fc578e474531f4 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
/**
* Sinking Ship
*
* The ship crashed into a reef and is sinking. Now the entire crew must be
* evacuated. All n crew members have already lined up in a row (for convenience
* let's label them all from left to right with positive... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | f7884f19aaf80200da1339e5ba34033a | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.util.Scanner;
public class SinkingShip {
private static Scanner in = new Scanner(System.in);
public static void main(String[] args) {
int n = in.nextInt();
String [][] ppl = new String [n][2];
String cap = "";
for (int i =0; i < n; i++) {
ppl[i][0] = in.n... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | 1f60b56cb61b1a2f3ba998aa7fe3289d | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.util.Scanner;
public class untitled {
public static void main (String [] ugh) {
Scanner in = new Scanner (System.in);
int x = in.nextInt();
String [] cok = new String [x+10];
String [] cuk = new String [x+10];
for (int i=0;i<x;++i) {
cok[i] = in.next();
cuk[i] = in.next();
}... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | 41ae01233416572e7fe12a0ae6e8cfca | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.io.File;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
Point[] arr = new Point[n];
for(int i=0; i<n; ++i) {
arr[... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | dda9ff310a3a379d4fea43328377e035 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
String name, status;
List<String> varios = new ArrayList<String>();
List<String> hombres = new ArrayList<String>();
String cap="";
for(int i=1;i<=n;i++) {
name ... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | f09fa82671a6c5eae5825aa59bb974e9 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.util.ArrayList;
import java.util.Iterator;
import java.util.Scanner;
public class SinkingShip {
public static void main(String[] args) {
ArrayList<String> rats = new ArrayList<String>();
ArrayList<String> wcs = new ArrayList<String>();
ArrayList<String> men = new A... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | d4678cc309489cb3e9fabc1035b5f40a | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Scanner;
public class first {
public static void main(String[] args) throws IOException {
Scanner s = new Scanner(new InputStreamReader(System.in));
BufferedRea... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | e69d5a76c702357a1674ad7e025a8d4a | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes |
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class SinkingShip {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
if (s.hasNext()) {
int count = Integer.parseInt(s.nextLine());
List<String> rats = new Arr... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | 1b00a0a17d88fabe0884087503277cbe | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.io.*;
import java.util.*;
public class Problem
{
BufferedReader in;
StringTokenizer st;
PrintWriter out;
static String INPUTFILE = "input.txt";
static String OUTPUTFILE = "output.txt";
class TeamMember {
public String Name;
public int W;
public TeamMember(String name, int weight)
{
Name ... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | 12c1f97c2097137a9d71e843dd1818c6 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class SinkingShip {
void run(){
try{
BufferedReader bfd = new BufferedReader(new InputStreamReader(System.in));
int n = new Integer(bfd.readLine());
ArrayList<String>[] a... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | 7a5849451556e466f94e8b79b52d30ba | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
public class A {
public static void main(String[] args) throws IOException {
A pro = new A();
pro.solve();
}
public void solve() throws NumberFormatException... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | 7be283aa34de79c26c9e5b64cc0a6e60 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.io.IOException;
import java.util.Scanner;
/**
*
* @author s3ood
*/
public class Main {
public static void main(String[] args)throws IOException
{
Scanner sc = new Scanner(System.in);
int nOm = sc.nextInt();
member [] crew = new member[nOm];
for(int i=0; i<nOm; i+... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | d4e5e0edc7d83c7f6c75697752675a04 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.StringTokenizer;
/**
*
* @author Hanif
*/
public class CodeForces
{
public static void main(String... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | 3346b09102ce781f4a63bc54c2215cc6 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scn = new Scanner (System.in);
int n=scn.nextInt();
crew[] cr = new crew[n];
for(int i=0;i<n;++i){
cr[i]=new crew();
cr[i].name=scn.next();
cr[i].type=... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | fe035995bff68b943608101bf8da0e5b | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class SinkingShip {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
BufferedReader r=new BufferedReader(new InputStreamReader(System.in));
S... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | ceba747c1c1800afda8b7fbd3100ba68 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes |
import java.util.ArrayList;
import java.util.Scanner;
/**
*
* @author vasudha
*/
public class NewClass {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
ArrayList<String> p = new ArrayList();
int n = sc.nextInt();
int i,j;
String s[] =... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | 8b12b2280bb5f61a38c3877cf3be84ca | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.pa... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | 700fa5d967dde82984d39f3d2ab5e901 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes |
import java.util.Scanner;
public class prog {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int s = scan.nextInt();
String a[]= new String[s];
String b[]=new String[s];
int check[]=new int[s];
for (int i = 0; i < 2*s ; i++) {
... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | 25f06af7c1ec909115708b7fbf22c975 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
FastScanner kb = new FastScanner(System.in);
PrintWriter out = new PrintWriter(System.out);
//
HashMap<String,Integer> mp = new HashMap<String, Integer>();
mp.put("captain", 3);
mp.put("man... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | a8999dbcc927c9b5c84bc36a01befb14 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
ArrayList<String>[]g = new ArrayList[4];
for (int i = 0; i < 4... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | 44a6db30105a440cc2a4e544cb0558c6 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes |
import java.io.File;
import java.io.IOException;
import java.util.Scanner;
public class SinkingShip {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
Scanner r=new Scanner(System.in);
int x=r.nextInt();
String c[][]... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | 591d069d30ea434eace926e3f6997277 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes |
import java.io.BufferedInputStream;
import java.util.Arrays;
import java.util.LinkedList;
public class C063A {
public void solve() throws Exception {
int n = nextInt();
String[] s = new String[n];
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
s[i] = nextWord();
String c = nextWord();
if (... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | a59664c216a5046c39a283cbff8ca180 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import static java.lang.Integer.parseInt;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.StringTokenizer;
public class NewClass {
static class escaner
... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | 27d5928ed40b3fb1c1802f48d7e2f8f7 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Collection;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
public class CF59A implements Runnable{
public static void main(String ... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | 49b281863f8764da9fe9c8d42ad6c59c | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.io.BufferedInputStream;
import java.io.IOException;
import java.util.Scanner;
//Mx
public class Main {
public static void main(String[] args)throws IOException {
Scanner scanner = new Scanner(new BufferedInputStream(System.in));
int crewMembers = scanner.nextInt();
Member [] crew... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | 9517541534841641478d86d393af159b | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes |
import java.io.BufferedInputStream;
import java.io.IOException;
import java.util.Scanner;
public class Main {
public static void main(String[] args)throws IOException {
Scanner scanner = new Scanner(new BufferedInputStream(System.in));
int crewMembers = scanner.nextInt();
Member [] crew = ... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | cfe699791c337301713274230f30fd8d | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.util.*;
public class SinkingShip {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input=new Scanner(System.in);
int n=input.nextInt();
String []s=new String[n];
String []s1=new String[n];
int []a=new int[n];
for(int i=0;i<n;i++){... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | ad9ad72b0702b025204ab9d8b8dd9d8a | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.util.Hashtable;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
String cad[] = new String[n];
String tipo[]=new String[n];
Hashtable<String, Integer>lista=new Hashtable<String,Integer>();
... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | 6d3649ab9d81d03dcb0253ea18c0b011 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.util.*;
public class Main {
public static void main (String [] arg) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
String [][] s = new String [N][2];
for (int i = 0; i<N; ++i) {
s[i][0] = sc.next();
s[i][1] = sc.next();
if... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | bcf6c15462b6a9f7900ab631f5b74879 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.util.*;
import java.math.*;
import java.io.*;
public class LOL {
public static void main(String[] args) throws Exception {
Scanner in = new Scanner(System.in);
int N = in.nextInt();
String[] names = new String[N];
String[] type = new String[N];
for (int i=0; i<N; ... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | cb8e6003559ab57bead09691844642ce | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner( System.in);
int n=sc.nextInt();
String [] s= new String [n+1];
String [] ss= new String [n+1];
for (int i = 1; i <=n; i++) {
s[i]=sc.next();
ss[i]=sc.next();
}
for (int i = 1; i <=n; ... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | 49fa666db227c125507512cd1f6a9fde | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.util.Scanner;
public class problem63A {
private static class Person {
public String name;
public int order;
public int type;
public Person(String name, int order, String type) {
this.name = name;
this.order = order;
if ("rat".equals(typ... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | df782578be82d0e49383157317b27163 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.util.Scanner;
public class SinkingShip {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
while (scan.hasNext()) {
int n = scan.nextInt();
Member[] array = new Member[n];
for (int i = 0; i < array.length; i++) {
array[i] = new Member(scan.next(), scan.next()... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | 0620cc1d9a02403680f58bbe7410d687 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.io.*;
import java.util.*;
public class sinkingship
{ static int n;
static String cap;
public static void main(String args[]) throws IOException
{
BufferedReader cin=new BufferedReader(new InputStreamReader(System.in));
n=Integer.parseInt(cin.readLine());
int f=n;
String[] ar... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | b319ae7d0d0ed3acee070dcae4c4e291 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Hashtable;
import java.util.Scanner;
import java.util.Comparator;
public class A59 {
public void solve() {
Scanner sc = new Scanner(System.in);
BufferedReader in = new BufferedReader(new Inpu... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | c83f10e57b15004efb774412cc0a0918 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes |
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Array... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | 0199f8313893ae9bdceed80881053998 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.io.*;
import java.util.*;
public class Round59Div2_A_ {
private void solve() throws IOException {
int n = Integer.parseInt(stdin.readLine());
ArrayList <String> rats = new ArrayList <String>();
ArrayList<String> women = new ArrayList<String>();
ArrayList<String> men = ne... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | 6e97d98f8737fa014b8178b9c1c22c0d | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class A063 {
static class guy implements Comparable<guy> {
String name, rank;
int pos;
public guy(String a, String b, int aa) {
name = a;
rank = b;
pos = aa;
}
public int compareTo(guy o) {
int p = priority(), po = o.priority();
if (... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | 95807a1a0f72677cc958659f6ba79cd5 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
public class SinkingShip {
public static void main( final String[] args ) throws IOException {
final BufferedReader br = new BufferedReader( new InputStrea... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | 9cb7395ad0ae5740ea8b55a32c7a5e42 | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.StringTokenizer;
public class B {
static class Scanner{
BufferedReader br=null;
StringTokenizer tk=null;
public Scanner(){
br=new BufferedReader(new InputStreamReade... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output | |
PASSED | f3dd6daeeefc904b3047c8426a699cde | train_000.jsonl | 1298908800 | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict o... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class JavaApplication11 {
public static void main(String[] args) throws IOException {
BufferedReader I = new BufferedReader(new InputStreamReader(System.in));
int n = In... | Java | ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman"] | 2 seconds | ["Teddy\nAlice\nBob\nJulia\nCharlie\nJack"] | null | Java 6 | standard input | [
"implementation",
"sortings",
"strings"
] | 753113fa5130a67423f2e205c97f8017 | The first line contains an integer n, which is the number of people in the crew (1 ≤ n ≤ 100). Then follow n lines. The i-th of those lines contains two words — the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the lin... | 900 | Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.