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 | f746b6e28c003dd651c4767a660a9c41 | train_002.jsonl | 1408116600 | Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main{
static ArrayList<Node>[] list;
static Node[] edge;
public static void main(String[] args){
Scan scan = new Scan();
int n = scan.nextInt();
int m = scan.nextInt();
list = new ArrayList[n];
// for(int i=0;i<n;i++) list[i] = new ArrayList<Node>();
e... | Java | ["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"] | 1 second | ["1", "3", "6"] | NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is . | Java 8 | standard input | [
"dp",
"sortings"
] | bac276604d67fa573b61075c1024865a | The first line contains two integers n, m (2 ≤ n ≤ 3·105; 1 ≤ m ≤ min(n·(n - 1), 3·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≤ ui, vi ≤ n; 1 ≤ wi ≤ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ... | 1,900 | Print a single integer — the answer to the problem. | standard output | |
PASSED | 0ef5994867146a4d458be26929d78a2a | train_002.jsonl | 1408116600 | Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap... | 256 megabytes | /*
Keep solving problems.
*/
import com.sun.javafx.geom.Edge;
import java.util.*;
import java.io.*;
public class CFA {
BufferedReader br;
PrintWriter out;
StringTokenizer st;
boolean eof;
final long MOD = 1000L * 1000L * 1000L + 7;
int[] dx = {1, 2, 1, 1};
int[] dy = {0, 0, -1, 1};
... | Java | ["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"] | 1 second | ["1", "3", "6"] | NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is . | Java 8 | standard input | [
"dp",
"sortings"
] | bac276604d67fa573b61075c1024865a | The first line contains two integers n, m (2 ≤ n ≤ 3·105; 1 ≤ m ≤ min(n·(n - 1), 3·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≤ ui, vi ≤ n; 1 ≤ wi ≤ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ... | 1,900 | Print a single integer — the answer to the problem. | standard output | |
PASSED | f6676a8ea6911b859d91b254a2b49780 | train_002.jsonl | 1408116600 | Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class Main
{
static final int mod = (int)1e9+7;
static int max = (int)1e5 + 1;
public static void main(String[] args) throws Exception
{
FastReader in = new FastReader();
PrintWriter out = new PrintWriter(System.out);
int n = in.nextI... | Java | ["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"] | 1 second | ["1", "3", "6"] | NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is . | Java 8 | standard input | [
"dp",
"sortings"
] | bac276604d67fa573b61075c1024865a | The first line contains two integers n, m (2 ≤ n ≤ 3·105; 1 ≤ m ≤ min(n·(n - 1), 3·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≤ ui, vi ≤ n; 1 ≤ wi ≤ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ... | 1,900 | Print a single integer — the answer to the problem. | standard output | |
PASSED | 403cf50f901067b20f23d745b68a96a5 | train_002.jsonl | 1408116600 | Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
import java.text.*;
public class Main
{
static class Reader
{
private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;}
publi... | Java | ["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"] | 1 second | ["1", "3", "6"] | NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is . | Java 8 | standard input | [
"dp",
"sortings"
] | bac276604d67fa573b61075c1024865a | The first line contains two integers n, m (2 ≤ n ≤ 3·105; 1 ≤ m ≤ min(n·(n - 1), 3·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≤ ui, vi ≤ n; 1 ≤ wi ≤ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ... | 1,900 | Print a single integer — the answer to the problem. | standard output | |
PASSED | 665f09c4836375a13a8069c01d068e78 | train_002.jsonl | 1408116600 | Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap... | 256 megabytes | import java.io.*;
import java.util.*;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] args) throws IOException {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
Reader in = new Reader();
in.init(inp... | Java | ["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"] | 1 second | ["1", "3", "6"] | NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is . | Java 8 | standard input | [
"dp",
"sortings"
] | bac276604d67fa573b61075c1024865a | The first line contains two integers n, m (2 ≤ n ≤ 3·105; 1 ≤ m ≤ min(n·(n - 1), 3·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≤ ui, vi ≤ n; 1 ≤ wi ≤ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ... | 1,900 | Print a single integer — the answer to the problem. | standard output | |
PASSED | eee1c22d732350d48d6485de77aec0d7 | train_002.jsonl | 1408116600 | Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap... | 256 megabytes | import java.util.*;
import java.io.*;
import static java.lang.System.in;
public class Main {
public static void main(String[] args)throws IOException{
//Scanner sc = new Scanner(System.in);
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String[] buf = reader.readLine... | Java | ["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"] | 1 second | ["1", "3", "6"] | NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is . | Java 8 | standard input | [
"dp",
"sortings"
] | bac276604d67fa573b61075c1024865a | The first line contains two integers n, m (2 ≤ n ≤ 3·105; 1 ≤ m ≤ min(n·(n - 1), 3·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≤ ui, vi ≤ n; 1 ≤ wi ≤ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ... | 1,900 | Print a single integer — the answer to the problem. | standard output | |
PASSED | d7abb972d2f6c9a492752c8d6b5f2716 | train_002.jsonl | 1408116600 | Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap... | 256 megabytes | import java.io.*;
import java.sql.Array;
import java.util.*;
public class E {
static class Pair<U extends Comparable<U>, V extends Comparable<V>>
implements Comparable<Pair<U,V>>{
public final U a;
public final V b;
private Pair(U a, V b) {
this.a = a;
... | Java | ["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"] | 1 second | ["1", "3", "6"] | NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is . | Java 8 | standard input | [
"dp",
"sortings"
] | bac276604d67fa573b61075c1024865a | The first line contains two integers n, m (2 ≤ n ≤ 3·105; 1 ≤ m ≤ min(n·(n - 1), 3·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≤ ui, vi ≤ n; 1 ≤ wi ≤ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ... | 1,900 | Print a single integer — the answer to the problem. | standard output | |
PASSED | a1559961f4532e1210d982f9878f77ad | train_002.jsonl | 1408116600 | Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.StringToke... | Java | ["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"] | 1 second | ["1", "3", "6"] | NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is . | Java 8 | standard input | [
"dp",
"sortings"
] | bac276604d67fa573b61075c1024865a | The first line contains two integers n, m (2 ≤ n ≤ 3·105; 1 ≤ m ≤ min(n·(n - 1), 3·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≤ ui, vi ≤ n; 1 ≤ wi ≤ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ... | 1,900 | Print a single integer — the answer to the problem. | standard output | |
PASSED | ade3f7e7f8aef2df4e7b0fd56bb6c51d | train_002.jsonl | 1408116600 | Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
public static void main(String[] args) throws IOException {
PrintWriter out = new PrintWriter(System.out);
//Scanner sc = new Scanner();
Reader in = new Reader();
Main solver = new Main();
solver.... | Java | ["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"] | 1 second | ["1", "3", "6"] | NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is . | Java 8 | standard input | [
"dp",
"sortings"
] | bac276604d67fa573b61075c1024865a | The first line contains two integers n, m (2 ≤ n ≤ 3·105; 1 ≤ m ≤ min(n·(n - 1), 3·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≤ ui, vi ≤ n; 1 ≤ wi ≤ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ... | 1,900 | Print a single integer — the answer to the problem. | standard output | |
PASSED | de2bc0ea9a52d515c192127a5c2f0650 | train_002.jsonl | 1421053200 | Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were the first integer is the number of vertices adjacent to vertex v, and the secon... | 256 megabytes | import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
import java.math.*;
import java.lang.*;
public class TaskC implements Runnable {
public void run() {
InputReader c = new InputReader(System.in);
PrintWriter w = new PrintWriter(System.out);
int n=c.nextInt();
pair... | Java | ["3\n2 3\n1 0\n1 0", "2\n1 1\n1 0"] | 1 second | ["2\n1 0\n2 0", "1\n0 1"] | NoteThe XOR sum of numbers is the result of bitwise adding numbers modulo 2. This operation exists in many modern programming languages. For example, in languages C++, Java and Python it is represented as "^", and in Pascal — as "xor". | Java 8 | standard input | [
"greedy",
"constructive algorithms",
"sortings",
"data structures",
"trees"
] | 14ad30e33bf8cad492e665b0a486008e | The first line contains integer n (1 ≤ n ≤ 216), the number of vertices in the graph. The i-th of the next lines contains numbers degreei and si (0 ≤ degreei ≤ n - 1, 0 ≤ si < 216), separated by a space. | 1,500 | In the first line print number m, the number of edges of the graph. Next print m lines, each containing two distinct numbers, a and b (0 ≤ a ≤ n - 1, 0 ≤ b ≤ n - 1), corresponding to edge (a, b). Edges can be printed in any order; vertices of the edge can also be printed in any order. | standard output | |
PASSED | d8c3bd4b7dcac87ae1c40ca32e302e04 | train_002.jsonl | 1421053200 | Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were the first integer is the number of vertices adjacent to vertex v, and the secon... | 256 megabytes |
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.List;
import java.util.Queue;
import java.util.StringTokenizer;
publi... | Java | ["3\n2 3\n1 0\n1 0", "2\n1 1\n1 0"] | 1 second | ["2\n1 0\n2 0", "1\n0 1"] | NoteThe XOR sum of numbers is the result of bitwise adding numbers modulo 2. This operation exists in many modern programming languages. For example, in languages C++, Java and Python it is represented as "^", and in Pascal — as "xor". | Java 8 | standard input | [
"greedy",
"constructive algorithms",
"sortings",
"data structures",
"trees"
] | 14ad30e33bf8cad492e665b0a486008e | The first line contains integer n (1 ≤ n ≤ 216), the number of vertices in the graph. The i-th of the next lines contains numbers degreei and si (0 ≤ degreei ≤ n - 1, 0 ≤ si < 216), separated by a space. | 1,500 | In the first line print number m, the number of edges of the graph. Next print m lines, each containing two distinct numbers, a and b (0 ≤ a ≤ n - 1, 0 ≤ b ≤ n - 1), corresponding to edge (a, b). Edges can be printed in any order; vertices of the edge can also be printed in any order. | standard output | |
PASSED | 7aac100b339d75870336ed067bed6207 | train_002.jsonl | 1421053200 | Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were the first integer is the number of vertices adjacent to vertex v, and the secon... | 256 megabytes | import java.util.*;
import java.io.*;
public class MishaandForest
{
/************************ SOLUTION STARTS HERE ***********************/
static class Pair {
int a , b;
Pair(int a , int b){
this.a = a;
this.b = b;
}
}
private static void solve(FastScanner s1, PrintWriter out){
int N = s1.nextIn... | Java | ["3\n2 3\n1 0\n1 0", "2\n1 1\n1 0"] | 1 second | ["2\n1 0\n2 0", "1\n0 1"] | NoteThe XOR sum of numbers is the result of bitwise adding numbers modulo 2. This operation exists in many modern programming languages. For example, in languages C++, Java and Python it is represented as "^", and in Pascal — as "xor". | Java 8 | standard input | [
"greedy",
"constructive algorithms",
"sortings",
"data structures",
"trees"
] | 14ad30e33bf8cad492e665b0a486008e | The first line contains integer n (1 ≤ n ≤ 216), the number of vertices in the graph. The i-th of the next lines contains numbers degreei and si (0 ≤ degreei ≤ n - 1, 0 ≤ si < 216), separated by a space. | 1,500 | In the first line print number m, the number of edges of the graph. Next print m lines, each containing two distinct numbers, a and b (0 ≤ a ≤ n - 1, 0 ≤ b ≤ n - 1), corresponding to edge (a, b). Edges can be printed in any order; vertices of the edge can also be printed in any order. | standard output | |
PASSED | 0d1be4dd85bbd99c4ed9d05cfc2e0e29 | train_002.jsonl | 1421053200 | Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were the first integer is the number of vertices adjacent to vertex v, and the secon... | 256 megabytes | import java.awt.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.List;
public class Ada {
public static void main(String[] args) throws IOException {
FastReader sc = new FastReader();
int n=sc.nextInt();
in... | Java | ["3\n2 3\n1 0\n1 0", "2\n1 1\n1 0"] | 1 second | ["2\n1 0\n2 0", "1\n0 1"] | NoteThe XOR sum of numbers is the result of bitwise adding numbers modulo 2. This operation exists in many modern programming languages. For example, in languages C++, Java and Python it is represented as "^", and in Pascal — as "xor". | Java 8 | standard input | [
"greedy",
"constructive algorithms",
"sortings",
"data structures",
"trees"
] | 14ad30e33bf8cad492e665b0a486008e | The first line contains integer n (1 ≤ n ≤ 216), the number of vertices in the graph. The i-th of the next lines contains numbers degreei and si (0 ≤ degreei ≤ n - 1, 0 ≤ si < 216), separated by a space. | 1,500 | In the first line print number m, the number of edges of the graph. Next print m lines, each containing two distinct numbers, a and b (0 ≤ a ≤ n - 1, 0 ≤ b ≤ n - 1), corresponding to edge (a, b). Edges can be printed in any order; vertices of the edge can also be printed in any order. | standard output | |
PASSED | 7efb2cb5562e09cb8662e419f5060d5a | train_002.jsonl | 1421053200 | Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were the first integer is the number of vertices adjacent to vertex v, and the secon... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.LinkedList;
public class _Misha_and_Trees {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputS... | Java | ["3\n2 3\n1 0\n1 0", "2\n1 1\n1 0"] | 1 second | ["2\n1 0\n2 0", "1\n0 1"] | NoteThe XOR sum of numbers is the result of bitwise adding numbers modulo 2. This operation exists in many modern programming languages. For example, in languages C++, Java and Python it is represented as "^", and in Pascal — as "xor". | Java 8 | standard input | [
"greedy",
"constructive algorithms",
"sortings",
"data structures",
"trees"
] | 14ad30e33bf8cad492e665b0a486008e | The first line contains integer n (1 ≤ n ≤ 216), the number of vertices in the graph. The i-th of the next lines contains numbers degreei and si (0 ≤ degreei ≤ n - 1, 0 ≤ si < 216), separated by a space. | 1,500 | In the first line print number m, the number of edges of the graph. Next print m lines, each containing two distinct numbers, a and b (0 ≤ a ≤ n - 1, 0 ≤ b ≤ n - 1), corresponding to edge (a, b). Edges can be printed in any order; vertices of the edge can also be printed in any order. | standard output | |
PASSED | 97003265e4a0806833bb45c47ef1a7f2 | train_002.jsonl | 1421053200 | Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were the first integer is the number of vertices adjacent to vertex v, and the secon... | 256 megabytes | import java.io.*;
import java.lang.*;
import java.util.*;
import java.math.*;
public class code {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new
InputStreamReader(System.in))... | Java | ["3\n2 3\n1 0\n1 0", "2\n1 1\n1 0"] | 1 second | ["2\n1 0\n2 0", "1\n0 1"] | NoteThe XOR sum of numbers is the result of bitwise adding numbers modulo 2. This operation exists in many modern programming languages. For example, in languages C++, Java and Python it is represented as "^", and in Pascal — as "xor". | Java 8 | standard input | [
"greedy",
"constructive algorithms",
"sortings",
"data structures",
"trees"
] | 14ad30e33bf8cad492e665b0a486008e | The first line contains integer n (1 ≤ n ≤ 216), the number of vertices in the graph. The i-th of the next lines contains numbers degreei and si (0 ≤ degreei ≤ n - 1, 0 ≤ si < 216), separated by a space. | 1,500 | In the first line print number m, the number of edges of the graph. Next print m lines, each containing two distinct numbers, a and b (0 ≤ a ≤ n - 1, 0 ≤ b ≤ n - 1), corresponding to edge (a, b). Edges can be printed in any order; vertices of the edge can also be printed in any order. | standard output | |
PASSED | cd716ce0e10b2ec05a7cae99290db37a | train_002.jsonl | 1421053200 | Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were the first integer is the number of vertices adjacent to vertex v, and the secon... | 256 megabytes | import java.io.*;
import java.lang.*;
import java.util.*;
import java.math.*;
public class code {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new
InputStreamReader(System.in))... | Java | ["3\n2 3\n1 0\n1 0", "2\n1 1\n1 0"] | 1 second | ["2\n1 0\n2 0", "1\n0 1"] | NoteThe XOR sum of numbers is the result of bitwise adding numbers modulo 2. This operation exists in many modern programming languages. For example, in languages C++, Java and Python it is represented as "^", and in Pascal — as "xor". | Java 8 | standard input | [
"greedy",
"constructive algorithms",
"sortings",
"data structures",
"trees"
] | 14ad30e33bf8cad492e665b0a486008e | The first line contains integer n (1 ≤ n ≤ 216), the number of vertices in the graph. The i-th of the next lines contains numbers degreei and si (0 ≤ degreei ≤ n - 1, 0 ≤ si < 216), separated by a space. | 1,500 | In the first line print number m, the number of edges of the graph. Next print m lines, each containing two distinct numbers, a and b (0 ≤ a ≤ n - 1, 0 ≤ b ≤ n - 1), corresponding to edge (a, b). Edges can be printed in any order; vertices of the edge can also be printed in any order. | standard output | |
PASSED | 08cee0003d2662e71bfbb893bb09867a | train_002.jsonl | 1421053200 | Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were the first integer is the number of vertices adjacent to vertex v, and the secon... | 256 megabytes |
import java.util.*;
public class Main {
public static void main(String args[]){
Scanner s = new Scanner(System.in);
int n= s.nextInt();
node[] u = new node[n];
list[] A = new list[2];
A[1]=new list();
A[0]=new list();
long m=0;
for(int... | Java | ["3\n2 3\n1 0\n1 0", "2\n1 1\n1 0"] | 1 second | ["2\n1 0\n2 0", "1\n0 1"] | NoteThe XOR sum of numbers is the result of bitwise adding numbers modulo 2. This operation exists in many modern programming languages. For example, in languages C++, Java and Python it is represented as "^", and in Pascal — as "xor". | Java 8 | standard input | [
"greedy",
"constructive algorithms",
"sortings",
"data structures",
"trees"
] | 14ad30e33bf8cad492e665b0a486008e | The first line contains integer n (1 ≤ n ≤ 216), the number of vertices in the graph. The i-th of the next lines contains numbers degreei and si (0 ≤ degreei ≤ n - 1, 0 ≤ si < 216), separated by a space. | 1,500 | In the first line print number m, the number of edges of the graph. Next print m lines, each containing two distinct numbers, a and b (0 ≤ a ≤ n - 1, 0 ≤ b ≤ n - 1), corresponding to edge (a, b). Edges can be printed in any order; vertices of the edge can also be printed in any order. | standard output | |
PASSED | 491426fda69a4fd964bd7a4e13ae0de9 | train_002.jsonl | 1421053200 | Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were the first integer is the number of vertices adjacent to vertex v, and the secon... | 256 megabytes | import java.util.LinkedList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner gimi = new Scanner(System.in);
LinkedList<Integer> queue = new LinkedList<Integer>();
StringBuilder result = new StringBuilder();
int n = gimi.nextInt();
int[] indeg = new int[n];
... | Java | ["3\n2 3\n1 0\n1 0", "2\n1 1\n1 0"] | 1 second | ["2\n1 0\n2 0", "1\n0 1"] | NoteThe XOR sum of numbers is the result of bitwise adding numbers modulo 2. This operation exists in many modern programming languages. For example, in languages C++, Java and Python it is represented as "^", and in Pascal — as "xor". | Java 8 | standard input | [
"greedy",
"constructive algorithms",
"sortings",
"data structures",
"trees"
] | 14ad30e33bf8cad492e665b0a486008e | The first line contains integer n (1 ≤ n ≤ 216), the number of vertices in the graph. The i-th of the next lines contains numbers degreei and si (0 ≤ degreei ≤ n - 1, 0 ≤ si < 216), separated by a space. | 1,500 | In the first line print number m, the number of edges of the graph. Next print m lines, each containing two distinct numbers, a and b (0 ≤ a ≤ n - 1, 0 ≤ b ≤ n - 1), corresponding to edge (a, b). Edges can be printed in any order; vertices of the edge can also be printed in any order. | standard output | |
PASSED | 2cc218c9a647a43c46a0c6a5c246fe4e | train_002.jsonl | 1421053200 | Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were the first integer is the number of vertices adjacent to vertex v, and the secon... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;
public class C {
public static int cnt = 0;
public static void main(String[] args) throws IOExceptio... | Java | ["3\n2 3\n1 0\n1 0", "2\n1 1\n1 0"] | 1 second | ["2\n1 0\n2 0", "1\n0 1"] | NoteThe XOR sum of numbers is the result of bitwise adding numbers modulo 2. This operation exists in many modern programming languages. For example, in languages C++, Java and Python it is represented as "^", and in Pascal — as "xor". | Java 8 | standard input | [
"greedy",
"constructive algorithms",
"sortings",
"data structures",
"trees"
] | 14ad30e33bf8cad492e665b0a486008e | The first line contains integer n (1 ≤ n ≤ 216), the number of vertices in the graph. The i-th of the next lines contains numbers degreei and si (0 ≤ degreei ≤ n - 1, 0 ≤ si < 216), separated by a space. | 1,500 | In the first line print number m, the number of edges of the graph. Next print m lines, each containing two distinct numbers, a and b (0 ≤ a ≤ n - 1, 0 ≤ b ≤ n - 1), corresponding to edge (a, b). Edges can be printed in any order; vertices of the edge can also be printed in any order. | standard output | |
PASSED | b921a4ad89a5b2455f11a7ba12708ac1 | train_002.jsonl | 1421053200 | Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were the first integer is the number of vertices adjacent to vertex v, and the secon... | 256 megabytes | import java.awt.List;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import... | Java | ["3\n2 3\n1 0\n1 0", "2\n1 1\n1 0"] | 1 second | ["2\n1 0\n2 0", "1\n0 1"] | NoteThe XOR sum of numbers is the result of bitwise adding numbers modulo 2. This operation exists in many modern programming languages. For example, in languages C++, Java and Python it is represented as "^", and in Pascal — as "xor". | Java 8 | standard input | [
"greedy",
"constructive algorithms",
"sortings",
"data structures",
"trees"
] | 14ad30e33bf8cad492e665b0a486008e | The first line contains integer n (1 ≤ n ≤ 216), the number of vertices in the graph. The i-th of the next lines contains numbers degreei and si (0 ≤ degreei ≤ n - 1, 0 ≤ si < 216), separated by a space. | 1,500 | In the first line print number m, the number of edges of the graph. Next print m lines, each containing two distinct numbers, a and b (0 ≤ a ≤ n - 1, 0 ≤ b ≤ n - 1), corresponding to edge (a, b). Edges can be printed in any order; vertices of the edge can also be printed in any order. | standard output | |
PASSED | 0a36759c720d7163328e1452a7273178 | train_002.jsonl | 1421053200 | Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were the first integer is the number of vertices adjacent to vertex v, and the secon... | 256 megabytes |
import java.io.*;
import java.util.*;
public class Cf501C {
public static void main(String args[]) throws IOException {
InputReader in = new InputReader(System.in);
PrintWriter w = new PrintWriter(System.out);
int n = in.nextInt();
Queue<Integer> q = new LinkedList<>();
... | Java | ["3\n2 3\n1 0\n1 0", "2\n1 1\n1 0"] | 1 second | ["2\n1 0\n2 0", "1\n0 1"] | NoteThe XOR sum of numbers is the result of bitwise adding numbers modulo 2. This operation exists in many modern programming languages. For example, in languages C++, Java and Python it is represented as "^", and in Pascal — as "xor". | Java 8 | standard input | [
"greedy",
"constructive algorithms",
"sortings",
"data structures",
"trees"
] | 14ad30e33bf8cad492e665b0a486008e | The first line contains integer n (1 ≤ n ≤ 216), the number of vertices in the graph. The i-th of the next lines contains numbers degreei and si (0 ≤ degreei ≤ n - 1, 0 ≤ si < 216), separated by a space. | 1,500 | In the first line print number m, the number of edges of the graph. Next print m lines, each containing two distinct numbers, a and b (0 ≤ a ≤ n - 1, 0 ≤ b ≤ n - 1), corresponding to edge (a, b). Edges can be printed in any order; vertices of the edge can also be printed in any order. | standard output | |
PASSED | 341a969beb9f04eab67c13c096cb18d4 | train_002.jsonl | 1421053200 | Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were the first integer is the number of vertices adjacent to vertex v, and the secon... | 256 megabytes | //package com.pb.codeforces.practice;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;
public class CF501C {
public static class F... | Java | ["3\n2 3\n1 0\n1 0", "2\n1 1\n1 0"] | 1 second | ["2\n1 0\n2 0", "1\n0 1"] | NoteThe XOR sum of numbers is the result of bitwise adding numbers modulo 2. This operation exists in many modern programming languages. For example, in languages C++, Java and Python it is represented as "^", and in Pascal — as "xor". | Java 8 | standard input | [
"greedy",
"constructive algorithms",
"sortings",
"data structures",
"trees"
] | 14ad30e33bf8cad492e665b0a486008e | The first line contains integer n (1 ≤ n ≤ 216), the number of vertices in the graph. The i-th of the next lines contains numbers degreei and si (0 ≤ degreei ≤ n - 1, 0 ≤ si < 216), separated by a space. | 1,500 | In the first line print number m, the number of edges of the graph. Next print m lines, each containing two distinct numbers, a and b (0 ≤ a ≤ n - 1, 0 ≤ b ≤ n - 1), corresponding to edge (a, b). Edges can be printed in any order; vertices of the edge can also be printed in any order. | standard output | |
PASSED | 0f739f2ed02e35271ffc6cf4cbd96315 | train_002.jsonl | 1421053200 | Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were the first integer is the number of vertices adjacent to vertex v, and the secon... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.Collection;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.Writer... | Java | ["3\n2 3\n1 0\n1 0", "2\n1 1\n1 0"] | 1 second | ["2\n1 0\n2 0", "1\n0 1"] | NoteThe XOR sum of numbers is the result of bitwise adding numbers modulo 2. This operation exists in many modern programming languages. For example, in languages C++, Java and Python it is represented as "^", and in Pascal — as "xor". | Java 8 | standard input | [
"greedy",
"constructive algorithms",
"sortings",
"data structures",
"trees"
] | 14ad30e33bf8cad492e665b0a486008e | The first line contains integer n (1 ≤ n ≤ 216), the number of vertices in the graph. The i-th of the next lines contains numbers degreei and si (0 ≤ degreei ≤ n - 1, 0 ≤ si < 216), separated by a space. | 1,500 | In the first line print number m, the number of edges of the graph. Next print m lines, each containing two distinct numbers, a and b (0 ≤ a ≤ n - 1, 0 ≤ b ≤ n - 1), corresponding to edge (a, b). Edges can be printed in any order; vertices of the edge can also be printed in any order. | standard output | |
PASSED | 0db964d11fa66ace6d04c588036980fd | train_002.jsonl | 1421053200 | Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were the first integer is the number of vertices adjacent to vertex v, and the secon... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.... | Java | ["3\n2 3\n1 0\n1 0", "2\n1 1\n1 0"] | 1 second | ["2\n1 0\n2 0", "1\n0 1"] | NoteThe XOR sum of numbers is the result of bitwise adding numbers modulo 2. This operation exists in many modern programming languages. For example, in languages C++, Java and Python it is represented as "^", and in Pascal — as "xor". | Java 8 | standard input | [
"greedy",
"constructive algorithms",
"sortings",
"data structures",
"trees"
] | 14ad30e33bf8cad492e665b0a486008e | The first line contains integer n (1 ≤ n ≤ 216), the number of vertices in the graph. The i-th of the next lines contains numbers degreei and si (0 ≤ degreei ≤ n - 1, 0 ≤ si < 216), separated by a space. | 1,500 | In the first line print number m, the number of edges of the graph. Next print m lines, each containing two distinct numbers, a and b (0 ≤ a ≤ n - 1, 0 ≤ b ≤ n - 1), corresponding to edge (a, b). Edges can be printed in any order; vertices of the edge can also be printed in any order. | standard output | |
PASSED | b8ebb61838ee811e0d7232d997596d11 | train_002.jsonl | 1421053200 | Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were the first integer is the number of vertices adjacent to vertex v, and the secon... | 256 megabytes | import java.util.*;import java.io.*;import java.math.*;
public class Main
{
public static void process()throws IOException
{
int n=ni();
int[]deg=new int[n];
int[]xor=new int[n];
Queue<Integer>q=new LinkedList<>();
ArrayList<String>ans=new ArrayList<>();
boolean v... | Java | ["3\n2 3\n1 0\n1 0", "2\n1 1\n1 0"] | 1 second | ["2\n1 0\n2 0", "1\n0 1"] | NoteThe XOR sum of numbers is the result of bitwise adding numbers modulo 2. This operation exists in many modern programming languages. For example, in languages C++, Java and Python it is represented as "^", and in Pascal — as "xor". | Java 8 | standard input | [
"greedy",
"constructive algorithms",
"sortings",
"data structures",
"trees"
] | 14ad30e33bf8cad492e665b0a486008e | The first line contains integer n (1 ≤ n ≤ 216), the number of vertices in the graph. The i-th of the next lines contains numbers degreei and si (0 ≤ degreei ≤ n - 1, 0 ≤ si < 216), separated by a space. | 1,500 | In the first line print number m, the number of edges of the graph. Next print m lines, each containing two distinct numbers, a and b (0 ≤ a ≤ n - 1, 0 ≤ b ≤ n - 1), corresponding to edge (a, b). Edges can be printed in any order; vertices of the edge can also be printed in any order. | standard output | |
PASSED | 6c3be5f1d974c8bccb8902c22cc2021d | train_002.jsonl | 1421053200 | Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were the first integer is the number of vertices adjacent to vertex v, and the secon... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Queue;
import java.util.LinkedList;
import java.io.InputStream;
/**
* Built using CHelper ... | Java | ["3\n2 3\n1 0\n1 0", "2\n1 1\n1 0"] | 1 second | ["2\n1 0\n2 0", "1\n0 1"] | NoteThe XOR sum of numbers is the result of bitwise adding numbers modulo 2. This operation exists in many modern programming languages. For example, in languages C++, Java and Python it is represented as "^", and in Pascal — as "xor". | Java 8 | standard input | [
"greedy",
"constructive algorithms",
"sortings",
"data structures",
"trees"
] | 14ad30e33bf8cad492e665b0a486008e | The first line contains integer n (1 ≤ n ≤ 216), the number of vertices in the graph. The i-th of the next lines contains numbers degreei and si (0 ≤ degreei ≤ n - 1, 0 ≤ si < 216), separated by a space. | 1,500 | In the first line print number m, the number of edges of the graph. Next print m lines, each containing two distinct numbers, a and b (0 ≤ a ≤ n - 1, 0 ≤ b ≤ n - 1), corresponding to edge (a, b). Edges can be printed in any order; vertices of the edge can also be printed in any order. | standard output | |
PASSED | b9716393c0996ee0301203aa6582c529 | train_002.jsonl | 1421053200 | Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were the first integer is the number of vertices adjacent to vertex v, and the secon... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util... | Java | ["3\n2 3\n1 0\n1 0", "2\n1 1\n1 0"] | 1 second | ["2\n1 0\n2 0", "1\n0 1"] | NoteThe XOR sum of numbers is the result of bitwise adding numbers modulo 2. This operation exists in many modern programming languages. For example, in languages C++, Java and Python it is represented as "^", and in Pascal — as "xor". | Java 8 | standard input | [
"greedy",
"constructive algorithms",
"sortings",
"data structures",
"trees"
] | 14ad30e33bf8cad492e665b0a486008e | The first line contains integer n (1 ≤ n ≤ 216), the number of vertices in the graph. The i-th of the next lines contains numbers degreei and si (0 ≤ degreei ≤ n - 1, 0 ≤ si < 216), separated by a space. | 1,500 | In the first line print number m, the number of edges of the graph. Next print m lines, each containing two distinct numbers, a and b (0 ≤ a ≤ n - 1, 0 ≤ b ≤ n - 1), corresponding to edge (a, b). Edges can be printed in any order; vertices of the edge can also be printed in any order. | standard output | |
PASSED | 349f1e54e9bc701bc2ad1416a4f43120 | train_002.jsonl | 1421053200 | Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were the first integer is the number of vertices adjacent to vertex v, and the secon... | 256 megabytes | import java.util.LinkedList;
import java.util.Arrays;
import java.util.ArrayList;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.AbstractSequentialList;
import java.io.BufferedReader;
import java.util.AbstractQueue;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.uti... | Java | ["3\n2 3\n1 0\n1 0", "2\n1 1\n1 0"] | 1 second | ["2\n1 0\n2 0", "1\n0 1"] | NoteThe XOR sum of numbers is the result of bitwise adding numbers modulo 2. This operation exists in many modern programming languages. For example, in languages C++, Java and Python it is represented as "^", and in Pascal — as "xor". | Java 8 | standard input | [
"greedy",
"constructive algorithms",
"sortings",
"data structures",
"trees"
] | 14ad30e33bf8cad492e665b0a486008e | The first line contains integer n (1 ≤ n ≤ 216), the number of vertices in the graph. The i-th of the next lines contains numbers degreei and si (0 ≤ degreei ≤ n - 1, 0 ≤ si < 216), separated by a space. | 1,500 | In the first line print number m, the number of edges of the graph. Next print m lines, each containing two distinct numbers, a and b (0 ≤ a ≤ n - 1, 0 ≤ b ≤ n - 1), corresponding to edge (a, b). Edges can be printed in any order; vertices of the edge can also be printed in any order. | standard output | |
PASSED | 1888006bd47d022346206b1b40b9b774 | train_002.jsonl | 1421053200 | Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were the first integer is the number of vertices adjacent to vertex v, and the secon... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class cSolution{
private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
public static void main(String args[]){
solve();
}
private static void solve(){
int ... | Java | ["3\n2 3\n1 0\n1 0", "2\n1 1\n1 0"] | 1 second | ["2\n1 0\n2 0", "1\n0 1"] | NoteThe XOR sum of numbers is the result of bitwise adding numbers modulo 2. This operation exists in many modern programming languages. For example, in languages C++, Java and Python it is represented as "^", and in Pascal — as "xor". | Java 8 | standard input | [
"greedy",
"constructive algorithms",
"sortings",
"data structures",
"trees"
] | 14ad30e33bf8cad492e665b0a486008e | The first line contains integer n (1 ≤ n ≤ 216), the number of vertices in the graph. The i-th of the next lines contains numbers degreei and si (0 ≤ degreei ≤ n - 1, 0 ≤ si < 216), separated by a space. | 1,500 | In the first line print number m, the number of edges of the graph. Next print m lines, each containing two distinct numbers, a and b (0 ≤ a ≤ n - 1, 0 ≤ b ≤ n - 1), corresponding to edge (a, b). Edges can be printed in any order; vertices of the edge can also be printed in any order. | standard output | |
PASSED | 7c37236c8803c04bba225ffcc5fda342 | train_002.jsonl | 1421053200 | Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were the first integer is the number of vertices adjacent to vertex v, and the secon... | 256 megabytes |
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import java.text.*;
public class Rough{
static PrintWriter w=new PrintWriter(System.out);
public static void main(String [] args){
DecimalFormat dm=new DecimalFormat("0.000000");
Scanner sc=new Scanner(System.in);... | Java | ["3\n2 3\n1 0\n1 0", "2\n1 1\n1 0"] | 1 second | ["2\n1 0\n2 0", "1\n0 1"] | NoteThe XOR sum of numbers is the result of bitwise adding numbers modulo 2. This operation exists in many modern programming languages. For example, in languages C++, Java and Python it is represented as "^", and in Pascal — as "xor". | Java 8 | standard input | [
"greedy",
"constructive algorithms",
"sortings",
"data structures",
"trees"
] | 14ad30e33bf8cad492e665b0a486008e | The first line contains integer n (1 ≤ n ≤ 216), the number of vertices in the graph. The i-th of the next lines contains numbers degreei and si (0 ≤ degreei ≤ n - 1, 0 ≤ si < 216), separated by a space. | 1,500 | In the first line print number m, the number of edges of the graph. Next print m lines, each containing two distinct numbers, a and b (0 ≤ a ≤ n - 1, 0 ≤ b ≤ n - 1), corresponding to edge (a, b). Edges can be printed in any order; vertices of the edge can also be printed in any order. | standard output | |
PASSED | 90b2063e42afdf7630c2af6590bf774f | train_002.jsonl | 1421053200 | Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were the first integer is the number of vertices adjacent to vertex v, and the secon... | 256 megabytes |
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;
public class C501 {
... | Java | ["3\n2 3\n1 0\n1 0", "2\n1 1\n1 0"] | 1 second | ["2\n1 0\n2 0", "1\n0 1"] | NoteThe XOR sum of numbers is the result of bitwise adding numbers modulo 2. This operation exists in many modern programming languages. For example, in languages C++, Java and Python it is represented as "^", and in Pascal — as "xor". | Java 8 | standard input | [
"greedy",
"constructive algorithms",
"sortings",
"data structures",
"trees"
] | 14ad30e33bf8cad492e665b0a486008e | The first line contains integer n (1 ≤ n ≤ 216), the number of vertices in the graph. The i-th of the next lines contains numbers degreei and si (0 ≤ degreei ≤ n - 1, 0 ≤ si < 216), separated by a space. | 1,500 | In the first line print number m, the number of edges of the graph. Next print m lines, each containing two distinct numbers, a and b (0 ≤ a ≤ n - 1, 0 ≤ b ≤ n - 1), corresponding to edge (a, b). Edges can be printed in any order; vertices of the edge can also be printed in any order. | standard output | |
PASSED | d3b79f8352fad720674450c3ba5dff80 | train_002.jsonl | 1421053200 | Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were the first integer is the number of vertices adjacent to vertex v, and the secon... | 256 megabytes | /*
Keep solving problems.
*/
import java.util.*;
import java.io.*;
public class CFA {
BufferedReader br;
PrintWriter out;
StringTokenizer st;
boolean eof;
final long MOD = 1000L * 1000L * 1000L + 7;
int[] dx = {0, -1, 0, 1};
int[] dy = {1, 0, -1, 0};
void solve() throws IOException {... | Java | ["3\n2 3\n1 0\n1 0", "2\n1 1\n1 0"] | 1 second | ["2\n1 0\n2 0", "1\n0 1"] | NoteThe XOR sum of numbers is the result of bitwise adding numbers modulo 2. This operation exists in many modern programming languages. For example, in languages C++, Java and Python it is represented as "^", and in Pascal — as "xor". | Java 8 | standard input | [
"greedy",
"constructive algorithms",
"sortings",
"data structures",
"trees"
] | 14ad30e33bf8cad492e665b0a486008e | The first line contains integer n (1 ≤ n ≤ 216), the number of vertices in the graph. The i-th of the next lines contains numbers degreei and si (0 ≤ degreei ≤ n - 1, 0 ≤ si < 216), separated by a space. | 1,500 | In the first line print number m, the number of edges of the graph. Next print m lines, each containing two distinct numbers, a and b (0 ≤ a ≤ n - 1, 0 ≤ b ≤ n - 1), corresponding to edge (a, b). Edges can be printed in any order; vertices of the edge can also be printed in any order. | standard output | |
PASSED | a3daa2fcf4b12a52398d3e037246fa46 | train_002.jsonl | 1562942100 | There are $$$n$$$ points on the plane, the $$$i$$$-th of which is at $$$(x_i, y_i)$$$. Tokitsukaze wants to draw a strange rectangular area and pick all the points in the area.The strange area is enclosed by three lines, $$$x = l$$$, $$$y = a$$$ and $$$x = r$$$, as its left side, its bottom side and its right side resp... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
//
public class cf1190d {
public static void main(String[] args) throws IOException {
int n = ri();
bit bit = new bit(n, Long::sum);
Map<Integer, Integer> idx = new TreeMap<>(), idy =... | Java | ["3\n1 1\n1 2\n1 3", "3\n1 1\n2 1\n3 1", "4\n2 1\n2 2\n3 1\n3 2"] | 3 seconds | ["3", "6", "6"] | NoteFor the first example, there is exactly one set having $$$k$$$ points for $$$k = 1, 2, 3$$$, so the total number is $$$3$$$.For the second example, the numbers of sets having $$$k$$$ points for $$$k = 1, 2, 3$$$ are $$$3$$$, $$$2$$$, $$$1$$$ respectively, and their sum is $$$6$$$.For the third example, as the follo... | Java 11 | standard input | [
"data structures",
"two pointers",
"sortings",
"divide and conquer"
] | a45a5a4b95f97a49960bc86953dd8723 | The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \times 10^5$$$) — the number of points on the plane. The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$, $$$y_i$$$ ($$$1 \leq x_i, y_i \leq 10^9$$$) — the coordinates of the $$$i$$$-th point. All points are distinct. | 2,000 | Print a single integer — the number of different non-empty sets of points she can obtain. | standard output | |
PASSED | c36d11386cc3efe0647b890a589ecb62 | train_002.jsonl | 1455116400 | You have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.Let number i be in positions xi, yi (xi < yi) in the permuted array a. Let's define the value di = yi - xi — the distance between the positions of the number i. Permute the numbers in array a to minimize the val... | 256 megabytes | import java.io.PrintWriter;
import java.util.Scanner;
public class OptimalNumberPermutation {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = scan.nextInt();
if(n%2 == 0){
for(int i = 1; i < n; i += 2) out.print(i+" ");... | Java | ["2", "1"] | 1 second | ["1 1 2 2", "1 1"] | null | Java 8 | standard input | [
"constructive algorithms"
] | c234cb0321e2bd235cd539a63364b152 | The only line contains integer n (1 ≤ n ≤ 5·105). | 1,900 | Print 2n integers — the permuted array a that minimizes the value of the sum s. | standard output | |
PASSED | 6283b36fe3e73beff09c6c40b03b5902 | train_002.jsonl | 1455116400 | You have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.Let number i be in positions xi, yi (xi < yi) in the permuted array a. Let's define the value di = yi - xi — the distance between the positions of the number i. Permute the numbers in array a to minimize the val... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.InputMismatchException;
public class Solution1 impleme... | Java | ["2", "1"] | 1 second | ["1 1 2 2", "1 1"] | null | Java 8 | standard input | [
"constructive algorithms"
] | c234cb0321e2bd235cd539a63364b152 | The only line contains integer n (1 ≤ n ≤ 5·105). | 1,900 | Print 2n integers — the permuted array a that minimizes the value of the sum s. | standard output | |
PASSED | 3c3c0a3c90d0ba013337fe346e2dcb3c | train_002.jsonl | 1455116400 | You have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.Let number i be in positions xi, yi (xi < yi) in the permuted array a. Let's define the value di = yi - xi — the distance between the positions of the number i. Permute the numbers in array a to minimize the val... | 256 megabytes | import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.List;
import java.util.*;
public class realfast implements Runnable
{
private static final int INF = (int) 1e9;
long in= 998244353;
long fac[]= new long[3000];
public void solv... | Java | ["2", "1"] | 1 second | ["1 1 2 2", "1 1"] | null | Java 8 | standard input | [
"constructive algorithms"
] | c234cb0321e2bd235cd539a63364b152 | The only line contains integer n (1 ≤ n ≤ 5·105). | 1,900 | Print 2n integers — the permuted array a that minimizes the value of the sum s. | standard output | |
PASSED | 3728dbfbb9e07ebd7bfe44ff25a744c1 | train_002.jsonl | 1455116400 | You have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.Let number i be in positions xi, yi (xi < yi) in the permuted array a. Let's define the value di = yi - xi — the distance between the positions of the number i. Permute the numbers in array a to minimize the val... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
/**
*
* @author Sourav Kumar Paul
*/
public class SolveDD {
public static void main(String[] args) throws IOException{
BufferedReader reader = new B... | Java | ["2", "1"] | 1 second | ["1 1 2 2", "1 1"] | null | Java 8 | standard input | [
"constructive algorithms"
] | c234cb0321e2bd235cd539a63364b152 | The only line contains integer n (1 ≤ n ≤ 5·105). | 1,900 | Print 2n integers — the permuted array a that minimizes the value of the sum s. | standard output | |
PASSED | 48c7f2a2af44cd9f01ce60c7a5ccbcbf | train_002.jsonl | 1455116400 | You have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.Let number i be in positions xi, yi (xi < yi) in the permuted array a. Let's define the value di = yi - xi — the distance between the positions of the number i. Permute the numbers in array a to minimize the val... | 256 megabytes | import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
public class Div2_622D {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int[] solution = solve(n);
StringBuilder answer = new StringBuilder(Integer.toString(solution[0]));
fo... | Java | ["2", "1"] | 1 second | ["1 1 2 2", "1 1"] | null | Java 8 | standard input | [
"constructive algorithms"
] | c234cb0321e2bd235cd539a63364b152 | The only line contains integer n (1 ≤ n ≤ 5·105). | 1,900 | Print 2n integers — the permuted array a that minimizes the value of the sum s. | standard output | |
PASSED | c429d67cd960686fc944e5548dd61df3 | train_002.jsonl | 1455116400 | You have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.Let number i be in positions xi, yi (xi < yi) in the permuted array a. Let's define the value di = yi - xi — the distance between the positions of the number i. Permute the numbers in array a to minimize the val... | 256 megabytes | import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
public class Div2_622D {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int[] solution = solve(n);
PrintWriter out = new PrintWriter(System.out, fal... | Java | ["2", "1"] | 1 second | ["1 1 2 2", "1 1"] | null | Java 8 | standard input | [
"constructive algorithms"
] | c234cb0321e2bd235cd539a63364b152 | The only line contains integer n (1 ≤ n ≤ 5·105). | 1,900 | Print 2n integers — the permuted array a that minimizes the value of the sum s. | standard output | |
PASSED | 938e3fb9b5f8cec11e00de91e32d1eba | train_002.jsonl | 1455116400 | You have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.Let number i be in positions xi, yi (xi < yi) in the permuted array a. Let's define the value di = yi - xi — the distance between the positions of the number i. Permute the numbers in array a to minimize the val... | 256 megabytes | import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
public class Div2_622D {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int[] solution = solve(n);
PrintWriter out = new PrintWriter(System.out);
... | Java | ["2", "1"] | 1 second | ["1 1 2 2", "1 1"] | null | Java 8 | standard input | [
"constructive algorithms"
] | c234cb0321e2bd235cd539a63364b152 | The only line contains integer n (1 ≤ n ≤ 5·105). | 1,900 | Print 2n integers — the permuted array a that minimizes the value of the sum s. | standard output | |
PASSED | d6030c074eddf02e3e1dc735f04d8f88 | train_002.jsonl | 1455116400 | You have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.Let number i be in positions xi, yi (xi < yi) in the permuted array a. Let's define the value di = yi - xi — the distance between the positions of the number i. Permute the numbers in array a to minimize the val... | 256 megabytes | import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
public class Div2_622D {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int[] solution = solve(n);
StringBuilder answer = new StringBuilder(Integer.toString(solution[0]));
fo... | Java | ["2", "1"] | 1 second | ["1 1 2 2", "1 1"] | null | Java 8 | standard input | [
"constructive algorithms"
] | c234cb0321e2bd235cd539a63364b152 | The only line contains integer n (1 ≤ n ≤ 5·105). | 1,900 | Print 2n integers — the permuted array a that minimizes the value of the sum s. | standard output | |
PASSED | a9d377d5ad1c188b56db37798c12e2d0 | train_002.jsonl | 1455116400 | You have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.Let number i be in positions xi, yi (xi < yi) in the permuted array a. Let's define the value di = yi - xi — the distance between the positions of the number i. Permute the numbers in array a to minimize the val... | 256 megabytes | import java.util.HashMap;
import java.util.Scanner;
public class Div2_622D {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
StringBuilder answer = new StringBuilder();
for(int num : solve(n)) {
answer.append(num).append(' ');
}
System.out.println... | Java | ["2", "1"] | 1 second | ["1 1 2 2", "1 1"] | null | Java 8 | standard input | [
"constructive algorithms"
] | c234cb0321e2bd235cd539a63364b152 | The only line contains integer n (1 ≤ n ≤ 5·105). | 1,900 | Print 2n integers — the permuted array a that minimizes the value of the sum s. | standard output | |
PASSED | dde9d9fa28196097c3cbff895826c634 | train_002.jsonl | 1455116400 | You have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.Let number i be in positions xi, yi (xi < yi) in the permuted array a. Let's define the value di = yi - xi — the distance between the positions of the number i. Permute the numbers in array a to minimize the val... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class D {
public static void main(String[] args) throws IOException
{
Scanner sc = new Scanner(Sy... | Java | ["2", "1"] | 1 second | ["1 1 2 2", "1 1"] | null | Java 8 | standard input | [
"constructive algorithms"
] | c234cb0321e2bd235cd539a63364b152 | The only line contains integer n (1 ≤ n ≤ 5·105). | 1,900 | Print 2n integers — the permuted array a that minimizes the value of the sum s. | standard output | |
PASSED | 5d9c042da5f0839125ce2f2d02b94d9f | train_002.jsonl | 1455116400 | You have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.Let number i be in positions xi, yi (xi < yi) in the permuted array a. Let's define the value di = yi - xi — the distance between the positions of the number i. Permute the numbers in array a to minimize the val... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;
@SuppressWarnings("unchecked")
public class P622D {
int n, n2;
int [] a = null;
BitSet p = null;
boolean doit(int num) {
if (num == n) {
return true;
}
for (int pi = p.nextClearBit((num & 1) * n + num / 2)... | Java | ["2", "1"] | 1 second | ["1 1 2 2", "1 1"] | null | Java 8 | standard input | [
"constructive algorithms"
] | c234cb0321e2bd235cd539a63364b152 | The only line contains integer n (1 ≤ n ≤ 5·105). | 1,900 | Print 2n integers — the permuted array a that minimizes the value of the sum s. | standard output | |
PASSED | b359e659f6c1fada2f428a69aa05679a | train_002.jsonl | 1455116400 | You have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.Let number i be in positions xi, yi (xi < yi) in the permuted array a. Let's define the value di = yi - xi — the distance between the positions of the number i. Permute the numbers in array a to minimize the val... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;
@SuppressWarnings("unchecked")
public class P622D {
public void run() throws Exception {
int n = nextInt();
int [] a = new int [n << 1];
for (int i = 1; i < n; i++) {
a[(i & 1) * n + i / 2] = a[(i & 1) * n + i / ... | Java | ["2", "1"] | 1 second | ["1 1 2 2", "1 1"] | null | Java 8 | standard input | [
"constructive algorithms"
] | c234cb0321e2bd235cd539a63364b152 | The only line contains integer n (1 ≤ n ≤ 5·105). | 1,900 | Print 2n integers — the permuted array a that minimizes the value of the sum s. | standard output | |
PASSED | fe223ec58cca123ba2e1962905e19f54 | train_002.jsonl | 1455116400 | You have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.Let number i be in positions xi, yi (xi < yi) in the permuted array a. Let's define the value di = yi - xi — the distance between the positions of the number i. Permute the numbers in array a to minimize the val... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
/**
*
* @author Saju
*
*/
public class Main {
private static int dx[] = { 1, 0, -1, 0 };
private static int dy[] = { 0, -1, 0, 1 };
private static final long INF = Long.MAX_VALUE;
private static final int INT_INF = Integer.MAX_VALUE;
... | Java | ["2", "1"] | 1 second | ["1 1 2 2", "1 1"] | null | Java 8 | standard input | [
"constructive algorithms"
] | c234cb0321e2bd235cd539a63364b152 | The only line contains integer n (1 ≤ n ≤ 5·105). | 1,900 | Print 2n integers — the permuted array a that minimizes the value of the sum s. | standard output | |
PASSED | ef60fd3f32c94709ae011c4041e9e2a3 | train_002.jsonl | 1455116400 | You have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.Let number i be in positions xi, yi (xi < yi) in the permuted array a. Let's define the value di = yi - xi — the distance between the positions of the number i. Permute the numbers in array a to minimize the val... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
static BufferedReader in;
static PrintWriter out;
static StringTokenizer buffer;
public static void solve() {
in... | Java | ["2", "1"] | 1 second | ["1 1 2 2", "1 1"] | null | Java 8 | standard input | [
"constructive algorithms"
] | c234cb0321e2bd235cd539a63364b152 | The only line contains integer n (1 ≤ n ≤ 5·105). | 1,900 | Print 2n integers — the permuted array a that minimizes the value of the sum s. | standard output | |
PASSED | 7147ef1ae6cfab813482cbf9eb15af0e | train_002.jsonl | 1455116400 | You have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.Let number i be in positions xi, yi (xi < yi) in the permuted array a. Let's define the value di = yi - xi — the distance between the positions of the number i. Permute the numbers in array a to minimize the val... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class Main {
public static final int MAXIMUM_VALUE = (int)1e6;
public static void main(String[] args) throws Exception {
BufferedReader in = new BufferedReader(new InputStre... | Java | ["2", "1"] | 1 second | ["1 1 2 2", "1 1"] | null | Java 8 | standard input | [
"constructive algorithms"
] | c234cb0321e2bd235cd539a63364b152 | The only line contains integer n (1 ≤ n ≤ 5·105). | 1,900 | Print 2n integers — the permuted array a that minimizes the value of the sum s. | standard output | |
PASSED | 8290d899d07d8b2d51363c87b754a2c6 | train_002.jsonl | 1455116400 | You have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.Let number i be in positions xi, yi (xi < yi) in the permuted array a. Let's define the value di = yi - xi — the distance between the positions of the number i. Permute the numbers in array a to minimize the val... | 256 megabytes |
import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Double.parseDouble;
import static java.lang.String.*;
public class Main {
public static void main(String[] args) ... | Java | ["2", "1"] | 1 second | ["1 1 2 2", "1 1"] | null | Java 8 | standard input | [
"constructive algorithms"
] | c234cb0321e2bd235cd539a63364b152 | The only line contains integer n (1 ≤ n ≤ 5·105). | 1,900 | Print 2n integers — the permuted array a that minimizes the value of the sum s. | standard output | |
PASSED | 34cd8a8ef48d29f1cfc862cfa7771704 | train_002.jsonl | 1455116400 | You have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.Let number i be in positions xi, yi (xi < yi) in the permuted array a. Let's define the value di = yi - xi — the distance between the positions of the number i. Permute the numbers in array a to minimize the val... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.LinkedList;
public class Solution123 implements Run... | Java | ["2", "1"] | 1 second | ["1 1 2 2", "1 1"] | null | Java 8 | standard input | [
"constructive algorithms"
] | c234cb0321e2bd235cd539a63364b152 | The only line contains integer n (1 ≤ n ≤ 5·105). | 1,900 | Print 2n integers — the permuted array a that minimizes the value of the sum s. | standard output | |
PASSED | 24a68d1cf3d41fc4a1e35f7545637ed3 | train_002.jsonl | 1455116400 | You have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.Let number i be in positions xi, yi (xi < yi) in the permuted array a. Let's define the value di = yi - xi — the distance between the positions of the number i. Permute the numbers in array a to minimize the val... | 256 megabytes |
/**
*
* @author meashish
*/
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.PrintStream;
import java.io.Serializable;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection... | Java | ["2", "1"] | 1 second | ["1 1 2 2", "1 1"] | null | Java 8 | standard input | [
"constructive algorithms"
] | c234cb0321e2bd235cd539a63364b152 | The only line contains integer n (1 ≤ n ≤ 5·105). | 1,900 | Print 2n integers — the permuted array a that minimizes the value of the sum s. | standard output | |
PASSED | 15f6e06abee7149076d789bc9b71bbc4 | train_002.jsonl | 1455116400 | You have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.Let number i be in positions xi, yi (xi < yi) in the permuted array a. Let's define the value di = yi - xi — the distance between the positions of the number i. Permute the numbers in array a to minimize the val... | 256 megabytes |
/**
*
* @author sarthak
*/
import java.util.*;
import java.math.*;
import java.io.*;
public class eduRnd_7_D {
static class FastScanner {
BufferedReader br;
StringTokenizer st;
public FastScanner(InputStream is) {
br = new BufferedReader(new InputStreamReader(is));
... | Java | ["2", "1"] | 1 second | ["1 1 2 2", "1 1"] | null | Java 8 | standard input | [
"constructive algorithms"
] | c234cb0321e2bd235cd539a63364b152 | The only line contains integer n (1 ≤ n ≤ 5·105). | 1,900 | Print 2n integers — the permuted array a that minimizes the value of the sum s. | standard output | |
PASSED | effa3eacc19048c14edf356aac40893e | train_002.jsonl | 1455116400 | You have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.Let number i be in positions xi, yi (xi < yi) in the permuted array a. Let's define the value di = yi - xi — the distance between the positions of the number i. Permute the numbers in array a to minimize the val... | 256 megabytes | import java.io.*;
import java.util.*;
public class CF622D {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int[] aa = new int[n + n];
for (int k = 1; k + k <= n; k++)
aa[k] = aa[n... | Java | ["2", "1"] | 1 second | ["1 1 2 2", "1 1"] | null | Java 8 | standard input | [
"constructive algorithms"
] | c234cb0321e2bd235cd539a63364b152 | The only line contains integer n (1 ≤ n ≤ 5·105). | 1,900 | Print 2n integers — the permuted array a that minimizes the value of the sum s. | standard output | |
PASSED | 39d48efe685a454a9f69e9e1bbe906c4 | train_002.jsonl | 1455116400 | You have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.Let number i be in positions xi, yi (xi < yi) in the permuted array a. Let's define the value di = yi - xi — the distance between the positions of the number i. Permute the numbers in array a to minimize the val... | 256 megabytes | import java.io.*;
import java.util.*;
public class Test
{
static PrintWriter pw = new PrintWriter(System.out);
public static void main(String[] args)throws Exception
{
Reader.init(System.in);
int n = Reader.nextInt();
StringBuilder s1 = new StringBuilder();
StringBuilde... | Java | ["2", "1"] | 1 second | ["1 1 2 2", "1 1"] | null | Java 8 | standard input | [
"constructive algorithms"
] | c234cb0321e2bd235cd539a63364b152 | The only line contains integer n (1 ≤ n ≤ 5·105). | 1,900 | Print 2n integers — the permuted array a that minimizes the value of the sum s. | standard output | |
PASSED | c4a3feb1ce49cd36d5cae9f9fe37b285 | train_002.jsonl | 1455116400 | You have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.Let number i be in positions xi, yi (xi < yi) in the permuted array a. Let's define the value di = yi - xi — the distance between the positions of the number i. Permute the numbers in array a to minimize the val... | 256 megabytes | import java.io.*;
public class OptimalNumberPermutation {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int numbers = Integer.parseInt(br.readLine());
int answer[] = new int[numbers * 2 + 1];
int odd... | Java | ["2", "1"] | 1 second | ["1 1 2 2", "1 1"] | null | Java 8 | standard input | [
"constructive algorithms"
] | c234cb0321e2bd235cd539a63364b152 | The only line contains integer n (1 ≤ n ≤ 5·105). | 1,900 | Print 2n integers — the permuted array a that minimizes the value of the sum s. | standard output | |
PASSED | 81c1d0c8b04c6dece018b25e8947f30f | train_002.jsonl | 1455116400 | You have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.Let number i be in positions xi, yi (xi < yi) in the permuted array a. Let's define the value di = yi - xi — the distance between the positions of the number i. Permute the numbers in array a to minimize the val... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
public class D {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out), true);... | Java | ["2", "1"] | 1 second | ["1 1 2 2", "1 1"] | null | Java 8 | standard input | [
"constructive algorithms"
] | c234cb0321e2bd235cd539a63364b152 | The only line contains integer n (1 ≤ n ≤ 5·105). | 1,900 | Print 2n integers — the permuted array a that minimizes the value of the sum s. | standard output | |
PASSED | d959d62a53491655cd59b43d6a4e46cc | train_002.jsonl | 1455116400 | You have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.Let number i be in positions xi, yi (xi < yi) in the permuted array a. Let's define the value di = yi - xi — the distance between the positions of the number i. Permute the numbers in array a to minimize the val... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
FastReader scn;
PrintWriter out;
String INPUT = "";
void solve() {
int n = scn.nextInt();
int[] arr = new int[2 * n + 1];
for (int i = 1, p = 1; i < n; i += 2) {
if (arr[p] == 0) {
arr[p] = i;
arr[p + n - i] = i;
} else {
p++;
i... | Java | ["2", "1"] | 1 second | ["1 1 2 2", "1 1"] | null | Java 8 | standard input | [
"constructive algorithms"
] | c234cb0321e2bd235cd539a63364b152 | The only line contains integer n (1 ≤ n ≤ 5·105). | 1,900 | Print 2n integers — the permuted array a that minimizes the value of the sum s. | standard output | |
PASSED | 76205de88d4848e283f6a8c4e7a16291 | train_002.jsonl | 1455116400 | You have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.Let number i be in positions xi, yi (xi < yi) in the permuted array a. Let's define the value di = yi - xi — the distance between the positions of the number i. Permute the numbers in array a to minimize the val... | 256 megabytes | import static java.lang.Math.*;
import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
BufferedReader in;
PrintWriter out;
StringTokenizer st;
String next() {
while (st==null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(in.readLine());
} catch (Exception e) {}
... | Java | ["2", "1"] | 1 second | ["1 1 2 2", "1 1"] | null | Java 8 | standard input | [
"constructive algorithms"
] | c234cb0321e2bd235cd539a63364b152 | The only line contains integer n (1 ≤ n ≤ 5·105). | 1,900 | Print 2n integers — the permuted array a that minimizes the value of the sum s. | standard output | |
PASSED | 3aa1d4613edcc234c077d945bc7e8a18 | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) {
Kattio in = new Kattio(System.in);
int n = in.nextInt();
char[] arr = in.next().toCharArray();
for (int i = 0; i < n; ++i) {
char c = arr[i];
}
i... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | 297e0faf7cd2074bf2cdf9bd6b7a1213 | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Scanner;
public class GameWithTelephoneNumbers {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method s... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | 3ab7219d139ab079a66ae7dccb5749ba | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 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 Main
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
FastReader sc=new FastReader();
int n=sc.I();
char[] c=sc.nextLine().to... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | 4c8ac5f67275d3c5eec50c06e30eda7a | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 256 megabytes | import java.util.*;
public class _1155B {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
StringBuilder s = new StringBuilder(sc.next());
int eight = 0;
for (int i = 0; i < n-10 ; i++) {
if (s.charAt(i) == '8... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | a872168cc90870e4050a1cedabb4636a | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 256 megabytes | import java.util.*;
import java.io.*;
public class TeleGame{
public static void main(String arg[]) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int sum=0, j, i, t, n;
n=Integer.parseInt(br.readLine());
String str = br.readLine();
St... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | d7a46cc93ec500d987cd277b896e8dcd | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Jenish
*/
public class Ma... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | f0f983181997f2e7cb5ef39c3da3110b | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 256 megabytes | import java.io.*;
import java.util.*;
public class EduA {
public static void main(String[] args) {
FastScanner s = new FastScanner();
int n = s.nextInt(), c=0;
char[] arr = s.nextString().toCharArray();
int x = n - 11 , index = -1;
x=x/2;
boolean[] mark = new boolean[n];
for(int i = 0;i < n ;i++)
... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | 341c24701007389e31a74c5d3ef4c278 | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 256 megabytes |
import java.io.*;
import java.util.Scanner;
public class Main{
public static void main(String[] args) throws IOException{
Scanner reader = new Scanner(System.in);
int n = reader.nextInt();
StringBuilder stringBuilder = new StringBuilder(reader.next());
int turns = (n - 11) / 2;
... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | d7eeb32129813fcdd6b2262aabfbbb58 | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 256 megabytes | import java.io.*;
import java.util.*;
public class tr1 {
static PrintWriter out;
static StringBuilder sb;
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
out = new PrintWriter(System.out);
int n=sc.nextInt();
String h=sc.nextLine();
boolean can=false;
//... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | 22bbd9fdbed3960f23708d35b511c1d0 | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int numCount = in.nextInt();
in.nextLine();
String number = in.nextLine();
int cycleCount = (numCount - 11) / 2;
int count8 = (int) number.cha... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | 817250579bd3b45b2a63d0d801c87d11 | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 256 megabytes | //created by Whiplash99
import java.io.*;
import java.util.*;
public class B
{
public static void main(String[] args) throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int i,N;
N=Integer.parseInt(br.readLine().trim());
char str[]=br.re... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | baa5edbd8e3b4ed46b279abf660d1c81 | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 256 megabytes | //created by Whiplash99
import java.io.*;
import java.util.*;
public class B
{
public static void main(String[] args) throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int i,N;
N=Integer.parseInt(br.readLine().trim());
char str[]=br.re... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | 4730af327c8a1addf81907a93d167452 | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 256 megabytes | import java.util.Scanner;
public final class GameWithTelePhoneCF {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
String s=sc.next();
int count=0,last=0;
int diff=s.length()-11;
int kth=0;
for(int i=0;i<n;i++){... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | a7875276a9d9f27ac93fd64eac4627a8 | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 256 megabytes | import javax.print.DocFlavor;
import javax.swing.plaf.basic.BasicInternalFrameTitlePane;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.nio.Buffer;
import java.sql.BatchUpdateException;
import java.util.*;
import java.util.stream.Stream;
import java.util.Vector;
import java.i... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | 663529f89891ef5662e18797be29ce7b | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.lang.management.MemoryType;
import java.math.BigInteger;
import java.util.*;
public class Main {
static final int INF = Integer.MAX_VALUE;
static i... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | 1a6659f13a065f7ac100c296f98bfd8e | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 256 megabytes |
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.StringTokenizer;
public class GameWithTelephoneNumbers implements Closeable {
private InputRea... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | 7709c09c2201c5f1107b7e0fcda2755c | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 256 megabytes | import java.util.ArrayList;
import java.util.Scanner;
public class TelephoneGame {
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int n;
String s;
/*int t;
t = sc.nextInt();
while(t > 0)
{*/
n = sc.nextInt();
s = sc.next();
char str[] = new char[n]... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | b0e6c3e0145fe55aaefb77d21f1548d4 | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 256 megabytes | import java.io.*;
import java.util.*;
public class Cony {
static long mat[][] ;
static int lastocc[] ;
public static void main(String[] args) throws IOException
{
BufferedReader jk = new BufferedReader(new InputStreamReader(System.in)) ;
PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | 99918e0a7355efcf3804a0d0b2a72f63 | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 256 megabytes | /**
* @author cplayer on 2018/6/23.
* @version 1.0
*/
import java.util.*;
import java.util.stream.IntStream;
import java.io.*;
import java.lang.*;
import java.math.BigInteger;
public class Main {
public static void main(String[] args) {
try {
InputReader in;
PrintWriter out;
... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | d1f5bd9fcaee926805c59210aae89cf0 | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
/**
* Author : joney_000[developer.jaswant@gmail.com]
* Algorithm : Extended Euclid Algo: find 3 things X, Y, GCD(A, B) Such that X * A + Y * B = GCD(A, B)
* Time : O(MAX(A, B)) Space : O(MAX(A, B))
* Platform : Codeforce... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | d7951807f409a841f2c3d829533980d7 | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 256 megabytes | import java.util.*;
import javax.xml.ws.AsyncHandler;
import java.io.*;
public class codeforces {
public static long GCD(long a, long b) {
return b == 0 ? a : GCD(b, a % b);
}
public static long C(int a, int b, long[][] s) {
int m = (int) 1e9 + 7;
if (s[a][b] >= 0) {
return s[a][b];
} else if (a <... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | f84e10ade3ebe6187f9e2064265a36eb | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 256 megabytes | import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class ProbB {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int length = sc.nextInt();
String str = sc.next();
int counts =0;
Set<Integer> st = new HashSe... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | e17676d2410d503a88e6d3e554a4fc4a | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 256 megabytes | /* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc=new Sc... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | f969b710c56366768ae7d0a03ef6d8fa | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 256 megabytes | import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class B {
public static void main(String[] args) throws Exception {
FastScanner scanner = new FastScanner();
int n = scanner.nextInt();
char[] line = scanner.nextLine().toCharArray();
int count = 0;
... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | f182a626aaf95f5f3b5deadf5a0872ba | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 256 megabytes | import java.util.*;
public class CodeForces1155B{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
String s = input.next();
int count = 0;
int index = -1;
ArrayList<Integer> arr = new ArrayList<>();
for(int i = 0;i<n;i++){
if(s.charAt(i) == '8'... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | d687a685bdfa071d07b89c9e8beff6b5 | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 256 megabytes |
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class EducationalRound63A {
public static void main(String[] args) {
// TODO Auto-generated method stub
out=new P... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | 7eca25284a6e7a48550f0830a501879e | train_002.jsonl | 1555943700 | A telephone number is a sequence of exactly $$$11$$$ digits such that its first digit is 8.Vasya and Petya are playing a game. Initially they have a string $$$s$$$ of length $$$n$$$ ($$$n$$$ is odd) consisting of digits. Vasya makes the first move, then players alternate turns. In one move the player must choose a char... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Prac {
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
... | Java | ["13\n8380011223344", "15\n807345619350641"] | 1 second | ["YES", "NO"] | NoteIn the first example Vasya needs to erase the second character. Then Petya cannot erase a character from the remaining string 880011223344 so that it does not become a telephone number.In the second example after Vasya's turn Petya can erase one character character 8. The resulting string can't be a telephone numbe... | Java 8 | standard input | [
"implementation",
"greedy",
"games"
] | 99f37936b243907bf4ac1822dc547a61 | The first line contains one integer $$$n$$$ ($$$13 \le n < 10^5$$$, $$$n$$$ is odd) — the length of string $$$s$$$. The second line contains the string $$$s$$$ ($$$|s| = n$$$) consisting only of decimal digits. | 1,200 | If Vasya has a strategy that guarantees him victory, print YES. Otherwise print NO. | standard output | |
PASSED | a279583b703cbaf4b77e606cfe876946 | train_002.jsonl | 1379691000 | It is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as follows. First, they get a set of n distinct integers. And then they take turns to make the following moves. During each move, either Alice or Bob (the player whose turn is the current) can choose two di... | 256 megabytes | import java.io.*;
import java.util.*;
public class Contest201C {
public static void main(String[] args) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
//BufferedReader in = new BufferedReader(new FileReader("201C.in"));
int n = Integer.parseInt(in.readLine());
St... | Java | ["2\n2 3", "2\n5 3", "3\n5 6 7"] | 2 seconds | ["Alice", "Alice", "Bob"] | NoteConsider the first test sample. Alice moves first, and the only move she can do is to choose 2 and 3, then to add 1 to the set. Next Bob moves, there is no valid move anymore, so the winner is Alice. | Java 6 | standard input | [
"number theory",
"games",
"math"
] | 3185ae6b4b681a10a21d02e67f08fd19 | The first line contains an integer n (2 ≤ n ≤ 100) — the initial number of elements in the set. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the elements of the set. | 1,600 | Print a single line with the winner's name. If Alice wins print "Alice", otherwise print "Bob" (without quotes). | standard output | |
PASSED | 4802c78b252063a3986c76857658eba6 | train_002.jsonl | 1379691000 | It is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as follows. First, they get a set of n distinct integers. And then they take turns to make the following moves. During each move, either Alice or Bob (the player whose turn is the current) can choose two di... | 256 megabytes | import java.util.*;
import java.io.*;
public class a {
static long mod = 1000000007;
public static void main(String[] args) throws IOException {
// Scanner input = new Scanner(new File("input.txt"));
// PrintWriter out = new PrintWriter(new File("output.txt"));
input.init(System.in);
... | Java | ["2\n2 3", "2\n5 3", "3\n5 6 7"] | 2 seconds | ["Alice", "Alice", "Bob"] | NoteConsider the first test sample. Alice moves first, and the only move she can do is to choose 2 and 3, then to add 1 to the set. Next Bob moves, there is no valid move anymore, so the winner is Alice. | Java 6 | standard input | [
"number theory",
"games",
"math"
] | 3185ae6b4b681a10a21d02e67f08fd19 | The first line contains an integer n (2 ≤ n ≤ 100) — the initial number of elements in the set. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the elements of the set. | 1,600 | Print a single line with the winner's name. If Alice wins print "Alice", otherwise print "Bob" (without quotes). | standard output | |
PASSED | 13221377fa7a3fff01f7f0bf3d7ad4e7 | train_002.jsonl | 1379691000 | It is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as follows. First, they get a set of n distinct integers. And then they take turns to make the following moves. During each move, either Alice or Bob (the player whose turn is the current) can choose two di... | 256 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;
/**
* Built using CHe... | Java | ["2\n2 3", "2\n5 3", "3\n5 6 7"] | 2 seconds | ["Alice", "Alice", "Bob"] | NoteConsider the first test sample. Alice moves first, and the only move she can do is to choose 2 and 3, then to add 1 to the set. Next Bob moves, there is no valid move anymore, so the winner is Alice. | Java 6 | standard input | [
"number theory",
"games",
"math"
] | 3185ae6b4b681a10a21d02e67f08fd19 | The first line contains an integer n (2 ≤ n ≤ 100) — the initial number of elements in the set. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the elements of the set. | 1,600 | Print a single line with the winner's name. If Alice wins print "Alice", otherwise print "Bob" (without quotes). | standard output | |
PASSED | 495ac2531dbf791afa5e3d832ee7463d | train_002.jsonl | 1379691000 | It is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as follows. First, they get a set of n distinct integers. And then they take turns to make the following moves. During each move, either Alice or Bob (the player whose turn is the current) can choose two di... | 256 megabytes | import static java.lang.Math.*;
import static java.lang.System.currentTimeMillis;
import static java.lang.System.exit;
import static java.lang.System.arraycopy;
import static java.util.Arrays.sort;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.fill;
import java.util.*;
import java.io.*;
p... | Java | ["2\n2 3", "2\n5 3", "3\n5 6 7"] | 2 seconds | ["Alice", "Alice", "Bob"] | NoteConsider the first test sample. Alice moves first, and the only move she can do is to choose 2 and 3, then to add 1 to the set. Next Bob moves, there is no valid move anymore, so the winner is Alice. | Java 6 | standard input | [
"number theory",
"games",
"math"
] | 3185ae6b4b681a10a21d02e67f08fd19 | The first line contains an integer n (2 ≤ n ≤ 100) — the initial number of elements in the set. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the elements of the set. | 1,600 | Print a single line with the winner's name. If Alice wins print "Alice", otherwise print "Bob" (without quotes). | standard output | |
PASSED | 6aad472e83208b6f2bf4f8875db96f2c | train_002.jsonl | 1379691000 | It is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as follows. First, they get a set of n distinct integers. And then they take turns to make the following moves. During each move, either Alice or Bob (the player whose turn is the current) can choose two di... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayL... | Java | ["2\n2 3", "2\n5 3", "3\n5 6 7"] | 2 seconds | ["Alice", "Alice", "Bob"] | NoteConsider the first test sample. Alice moves first, and the only move she can do is to choose 2 and 3, then to add 1 to the set. Next Bob moves, there is no valid move anymore, so the winner is Alice. | Java 6 | standard input | [
"number theory",
"games",
"math"
] | 3185ae6b4b681a10a21d02e67f08fd19 | The first line contains an integer n (2 ≤ n ≤ 100) — the initial number of elements in the set. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the elements of the set. | 1,600 | Print a single line with the winner's name. If Alice wins print "Alice", otherwise print "Bob" (without quotes). | standard output | |
PASSED | 3d7c075d43135df86cf1483311231cf1 | train_002.jsonl | 1379691000 | It is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as follows. First, they get a set of n distinct integers. And then they take turns to make the following moves. During each move, either Alice or Bob (the player whose turn is the current) can choose two di... | 256 megabytes |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import static java.lang.Math.*;
import java.util.ArrayList;
import java.util.StringTokenizer;
/**
*
* @author pttrung
*/
public class C {
public static long Mod = 1000000007;
public static void main(String[] a... | Java | ["2\n2 3", "2\n5 3", "3\n5 6 7"] | 2 seconds | ["Alice", "Alice", "Bob"] | NoteConsider the first test sample. Alice moves first, and the only move she can do is to choose 2 and 3, then to add 1 to the set. Next Bob moves, there is no valid move anymore, so the winner is Alice. | Java 6 | standard input | [
"number theory",
"games",
"math"
] | 3185ae6b4b681a10a21d02e67f08fd19 | The first line contains an integer n (2 ≤ n ≤ 100) — the initial number of elements in the set. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the elements of the set. | 1,600 | Print a single line with the winner's name. If Alice wins print "Alice", otherwise print "Bob" (without quotes). | standard output | |
PASSED | 761c30029f59ab500150bb7396a8421c | train_002.jsonl | 1379691000 | It is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as follows. First, they get a set of n distinct integers. And then they take turns to make the following moves. During each move, either Alice or Bob (the player whose turn is the current) can choose two di... | 256 megabytes | import java.util.*;
import java.io.*;
public class Solution{
public static void main(String []args){
Solution ob = new Solution();
ob.go();
}
void pr(String s)
{
System.out.print(s);
}
void go(){
Scanner sc=new Scanner (System.in);
... | Java | ["2\n2 3", "2\n5 3", "3\n5 6 7"] | 2 seconds | ["Alice", "Alice", "Bob"] | NoteConsider the first test sample. Alice moves first, and the only move she can do is to choose 2 and 3, then to add 1 to the set. Next Bob moves, there is no valid move anymore, so the winner is Alice. | Java 6 | standard input | [
"number theory",
"games",
"math"
] | 3185ae6b4b681a10a21d02e67f08fd19 | The first line contains an integer n (2 ≤ n ≤ 100) — the initial number of elements in the set. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the elements of the set. | 1,600 | Print a single line with the winner's name. If Alice wins print "Alice", otherwise print "Bob" (without quotes). | standard output | |
PASSED | 1cbb458f978be6d94feff10b0d5bd508 | train_002.jsonl | 1379691000 | It is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as follows. First, they get a set of n distinct integers. And then they take turns to make the following moves. During each move, either Alice or Bob (the player whose turn is the current) can choose two di... | 256 megabytes |
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;
public class TC1
{
static int N;
static int[] arr;
static int MAX=-1;
private static int gcd( int a, int... | Java | ["2\n2 3", "2\n5 3", "3\n5 6 7"] | 2 seconds | ["Alice", "Alice", "Bob"] | NoteConsider the first test sample. Alice moves first, and the only move she can do is to choose 2 and 3, then to add 1 to the set. Next Bob moves, there is no valid move anymore, so the winner is Alice. | Java 6 | standard input | [
"number theory",
"games",
"math"
] | 3185ae6b4b681a10a21d02e67f08fd19 | The first line contains an integer n (2 ≤ n ≤ 100) — the initial number of elements in the set. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the elements of the set. | 1,600 | Print a single line with the winner's name. If Alice wins print "Alice", otherwise print "Bob" (without quotes). | standard output | |
PASSED | 26c5e470bf969610853e597d262f4392 | train_002.jsonl | 1379691000 | It is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as follows. First, they get a set of n distinct integers. And then they take turns to make the following moves. During each move, either Alice or Bob (the player whose turn is the current) can choose two di... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Main {
public static void main(String[] args) throws IOException {
Solution sol = new Solution();
System.out.println(sol.solution());
}
}
class Solution{
private int gcd(int a, i... | Java | ["2\n2 3", "2\n5 3", "3\n5 6 7"] | 2 seconds | ["Alice", "Alice", "Bob"] | NoteConsider the first test sample. Alice moves first, and the only move she can do is to choose 2 and 3, then to add 1 to the set. Next Bob moves, there is no valid move anymore, so the winner is Alice. | Java 6 | standard input | [
"number theory",
"games",
"math"
] | 3185ae6b4b681a10a21d02e67f08fd19 | The first line contains an integer n (2 ≤ n ≤ 100) — the initial number of elements in the set. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the elements of the set. | 1,600 | Print a single line with the winner's name. If Alice wins print "Alice", otherwise print "Bob" (without quotes). | standard output | |
PASSED | 836130ed2b4c72691ffe50265619e1d4 | train_002.jsonl | 1379691000 | It is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as follows. First, they get a set of n distinct integers. And then they take turns to make the following moves. During each move, either Alice or Bob (the player whose turn is the current) can choose two di... | 256 megabytes | import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.lang.*;
public class A {
public static void main(String[] args) {
A a = new A();
a.run();
}
int MAX = 999999999;
Scanner sc = new Scanner(System.in);
PrintWriter... | Java | ["2\n2 3", "2\n5 3", "3\n5 6 7"] | 2 seconds | ["Alice", "Alice", "Bob"] | NoteConsider the first test sample. Alice moves first, and the only move she can do is to choose 2 and 3, then to add 1 to the set. Next Bob moves, there is no valid move anymore, so the winner is Alice. | Java 6 | standard input | [
"number theory",
"games",
"math"
] | 3185ae6b4b681a10a21d02e67f08fd19 | The first line contains an integer n (2 ≤ n ≤ 100) — the initial number of elements in the set. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the elements of the set. | 1,600 | Print a single line with the winner's name. If Alice wins print "Alice", otherwise print "Bob" (without quotes). | standard output | |
PASSED | 9b990f3251f4e9b5dd8cc6628a47d2b0 | train_002.jsonl | 1379691000 | It is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as follows. First, they get a set of n distinct integers. And then they take turns to make the following moves. During each move, either Alice or Bob (the player whose turn is the current) can choose two di... | 256 megabytes | import java.io.*;
import java.util.*;
public class third
{
static long fast_power(long a,long n,long m)
{
if(n==1)
{
return a%m;
}
if(n%2==1)
{
long power = fast_power(a,(n-1)/2,m)%m;
return ((a%m) * ((power*power)%m))%m;
}
long power = fast_power(a,n/2,m)%m;
return (power*power)%m;
... | Java | ["2\n2 3", "2\n5 3", "3\n5 6 7"] | 2 seconds | ["Alice", "Alice", "Bob"] | NoteConsider the first test sample. Alice moves first, and the only move she can do is to choose 2 and 3, then to add 1 to the set. Next Bob moves, there is no valid move anymore, so the winner is Alice. | Java 6 | standard input | [
"number theory",
"games",
"math"
] | 3185ae6b4b681a10a21d02e67f08fd19 | The first line contains an integer n (2 ≤ n ≤ 100) — the initial number of elements in the set. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the elements of the set. | 1,600 | Print a single line with the winner's name. If Alice wins print "Alice", otherwise print "Bob" (without quotes). | standard output | |
PASSED | c19a404f41ff66573abbc9307eabe36b | train_002.jsonl | 1379691000 | It is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as follows. First, they get a set of n distinct integers. And then they take turns to make the following moves. During each move, either Alice or Bob (the player whose turn is the current) can choose two di... | 256 megabytes | import java.util.Scanner;
/**
* User: chen
*/
public class AliceAndBob {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] num = new int[n];
int maxNum = 0;
for (int i = 0; i < n; i++) {
num[i] = in.nextIn... | Java | ["2\n2 3", "2\n5 3", "3\n5 6 7"] | 2 seconds | ["Alice", "Alice", "Bob"] | NoteConsider the first test sample. Alice moves first, and the only move she can do is to choose 2 and 3, then to add 1 to the set. Next Bob moves, there is no valid move anymore, so the winner is Alice. | Java 6 | standard input | [
"number theory",
"games",
"math"
] | 3185ae6b4b681a10a21d02e67f08fd19 | The first line contains an integer n (2 ≤ n ≤ 100) — the initial number of elements in the set. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the elements of the set. | 1,600 | Print a single line with the winner's name. If Alice wins print "Alice", otherwise print "Bob" (without quotes). | standard output | |
PASSED | c3659714cdb6bef98bb07fa3d42259cf | train_002.jsonl | 1379691000 | It is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as follows. First, they get a set of n distinct integers. And then they take turns to make the following moves. During each move, either Alice or Bob (the player whose turn is the current) can choose two di... | 256 megabytes | import java.util.*;
public class cf347C{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int n =sc.nextInt();
int[] arr =new int[n];
int max = -1;
arr[0] = sc.nextInt();
int prev = arr[0];
if(max < arr[0])
max = arr[0];
for(int i=1; i<n; i++)
{
a... | Java | ["2\n2 3", "2\n5 3", "3\n5 6 7"] | 2 seconds | ["Alice", "Alice", "Bob"] | NoteConsider the first test sample. Alice moves first, and the only move she can do is to choose 2 and 3, then to add 1 to the set. Next Bob moves, there is no valid move anymore, so the winner is Alice. | Java 6 | standard input | [
"number theory",
"games",
"math"
] | 3185ae6b4b681a10a21d02e67f08fd19 | The first line contains an integer n (2 ≤ n ≤ 100) — the initial number of elements in the set. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the elements of the set. | 1,600 | Print a single line with the winner's name. If Alice wins print "Alice", otherwise print "Bob" (without quotes). | standard output | |
PASSED | 33339f45a9de5c2304cba51b456abee6 | train_002.jsonl | 1379691000 | It is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as follows. First, they get a set of n distinct integers. And then they take turns to make the following moves. During each move, either Alice or Bob (the player whose turn is the current) can choose two di... | 256 megabytes | import java.util.Scanner;
public class C {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] a = new int[n];
a[0]=sc.nextInt();
a[1]= sc.ne... | Java | ["2\n2 3", "2\n5 3", "3\n5 6 7"] | 2 seconds | ["Alice", "Alice", "Bob"] | NoteConsider the first test sample. Alice moves first, and the only move she can do is to choose 2 and 3, then to add 1 to the set. Next Bob moves, there is no valid move anymore, so the winner is Alice. | Java 6 | standard input | [
"number theory",
"games",
"math"
] | 3185ae6b4b681a10a21d02e67f08fd19 | The first line contains an integer n (2 ≤ n ≤ 100) — the initial number of elements in the set. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the elements of the set. | 1,600 | Print a single line with the winner's name. If Alice wins print "Alice", otherwise print "Bob" (without quotes). | standard output | |
PASSED | 82f9b49a16880afd2a811061e9fad47d | train_002.jsonl | 1379691000 | It is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as follows. First, they get a set of n distinct integers. And then they take turns to make the following moves. During each move, either Alice or Bob (the player whose turn is the current) can choose two di... | 256 megabytes | import java.util.HashSet;
import java.util.Scanner;
import java.util.TreeSet;
public class L {
public static void main(String[] args) throws Exception {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
TreeSet<Integer> nums = new TreeSet<Integer>();
for(int i = 0; i < n; i+... | Java | ["2\n2 3", "2\n5 3", "3\n5 6 7"] | 2 seconds | ["Alice", "Alice", "Bob"] | NoteConsider the first test sample. Alice moves first, and the only move she can do is to choose 2 and 3, then to add 1 to the set. Next Bob moves, there is no valid move anymore, so the winner is Alice. | Java 6 | standard input | [
"number theory",
"games",
"math"
] | 3185ae6b4b681a10a21d02e67f08fd19 | The first line contains an integer n (2 ≤ n ≤ 100) — the initial number of elements in the set. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the elements of the set. | 1,600 | Print a single line with the winner's name. If Alice wins print "Alice", otherwise print "Bob" (without quotes). | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.