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
ed8c8a3889fd5c83235b8916ab5b15e9
train_001.jsonl
1424190900
Drazil created a following problem about putting 1 × 2 tiles into an n × m grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1 × 2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d...
256 megabytes
import java.util.LinkedList; import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.util.Collection; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Queue; import java.io.IOException; import java.util.StringTokenizer; /** * Built using CHelpe...
Java
["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"]
2 seconds
["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"]
NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique".
Java 8
standard input
[ "constructive algorithms", "greedy" ]
9465c37b6f948da14e71cc96ac24bb2e
The first line contains two integers n and m (1 ≤ n, m ≤ 2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied.
2,000
If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1 × 2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa...
standard output
PASSED
91f42542e14a3d593f188b7ebc9da9c3
train_001.jsonl
1424190900
Drazil created a following problem about putting 1 × 2 tiles into an n × m grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1 × 2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d...
256 megabytes
import java.util.LinkedList; import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.util.Collection; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Queue; import java.io.IOException; import java.util.StringTokenizer; /** * Built using CHelpe...
Java
["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"]
2 seconds
["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"]
NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique".
Java 8
standard input
[ "constructive algorithms", "greedy" ]
9465c37b6f948da14e71cc96ac24bb2e
The first line contains two integers n and m (1 ≤ n, m ≤ 2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied.
2,000
If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1 × 2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa...
standard output
PASSED
946d662e811abd98afda14db5ff0b0ab
train_001.jsonl
1424190900
Drazil created a following problem about putting 1 × 2 tiles into an n × m grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1 × 2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d...
256 megabytes
import java.util.*; /** * Created by zephyr on 2/19/15. */ public class DrazilandTiles { static Deque<Integer> deque = new ArrayDeque<>(); public static void main(String args[]) { Scanner cin = new Scanner(System.in); int n = cin.nextInt(), m = cin.nextInt(); grid = new char[n][m]; ...
Java
["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"]
2 seconds
["Not unique", "&lt;&gt;**\n*^&lt;&gt;\n*v**\n&lt;&gt;&lt;&gt;", "*&lt;&gt;*\n&lt;&gt;&lt;&gt;", "Not unique", "*"]
NoteIn the first case, there are indeed two solutions:&lt;&gt;^^*vv&lt;&gt;and^&lt;&gt;v*^&lt;&gt;vso the answer is "Not unique".
Java 8
standard input
[ "constructive algorithms", "greedy" ]
9465c37b6f948da14e71cc96ac24bb2e
The first line contains two integers n and m (1 ≤ n, m ≤ 2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied.
2,000
If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1 × 2 tiles. Use characters "&lt;&gt;" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa...
standard output
PASSED
e119043c38c4389021a0dd37e2967dfb
train_001.jsonl
1424190900
Drazil created a following problem about putting 1 × 2 tiles into an n × m grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1 × 2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d...
256 megabytes
import java.util.ArrayDeque; import java.util.Scanner; public class Solver { Solver(){ Scanner in = new Scanner(System.in); n = in.nextInt(); m = in.nextInt(); grid = new char[n][m]; for(int i = 0; i<n; i++) grid[i] = in.next().toCharArray(); q = new Arr...
Java
["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"]
2 seconds
["Not unique", "&lt;&gt;**\n*^&lt;&gt;\n*v**\n&lt;&gt;&lt;&gt;", "*&lt;&gt;*\n&lt;&gt;&lt;&gt;", "Not unique", "*"]
NoteIn the first case, there are indeed two solutions:&lt;&gt;^^*vv&lt;&gt;and^&lt;&gt;v*^&lt;&gt;vso the answer is "Not unique".
Java 8
standard input
[ "constructive algorithms", "greedy" ]
9465c37b6f948da14e71cc96ac24bb2e
The first line contains two integers n and m (1 ≤ n, m ≤ 2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied.
2,000
If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1 × 2 tiles. Use characters "&lt;&gt;" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa...
standard output
PASSED
9446b8dae052a711890ad5364b3907f6
train_001.jsonl
1424190900
Drazil created a following problem about putting 1 × 2 tiles into an n × m grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1 × 2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d...
256 megabytes
import java.util.*; /** * Created by zephyr on 2/19/15. */ public class DrazilandTiles { public static void main(String args[]) { Scanner cin = new Scanner(System.in); int n = cin.nextInt(), m = cin.nextInt(); char[][] grid = new char[n][m]; for (int i = 0; i < n; i++) { ...
Java
["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"]
2 seconds
["Not unique", "&lt;&gt;**\n*^&lt;&gt;\n*v**\n&lt;&gt;&lt;&gt;", "*&lt;&gt;*\n&lt;&gt;&lt;&gt;", "Not unique", "*"]
NoteIn the first case, there are indeed two solutions:&lt;&gt;^^*vv&lt;&gt;and^&lt;&gt;v*^&lt;&gt;vso the answer is "Not unique".
Java 8
standard input
[ "constructive algorithms", "greedy" ]
9465c37b6f948da14e71cc96ac24bb2e
The first line contains two integers n and m (1 ≤ n, m ≤ 2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied.
2,000
If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1 × 2 tiles. Use characters "&lt;&gt;" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa...
standard output
PASSED
a4c0ac0a575e154f168f2df5d1614075
train_001.jsonl
1424190900
Drazil created a following problem about putting 1 × 2 tiles into an n × m grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1 × 2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d...
256 megabytes
import java.util.*; import java.io.*; public class MainClass { static int n, m; static char[][] A; static int[] dx = {1, -1, 0, 0}; static int[] dy = {0, 0, 1, -1}; public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(Sy...
Java
["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"]
2 seconds
["Not unique", "&lt;&gt;**\n*^&lt;&gt;\n*v**\n&lt;&gt;&lt;&gt;", "*&lt;&gt;*\n&lt;&gt;&lt;&gt;", "Not unique", "*"]
NoteIn the first case, there are indeed two solutions:&lt;&gt;^^*vv&lt;&gt;and^&lt;&gt;v*^&lt;&gt;vso the answer is "Not unique".
Java 8
standard input
[ "constructive algorithms", "greedy" ]
9465c37b6f948da14e71cc96ac24bb2e
The first line contains two integers n and m (1 ≤ n, m ≤ 2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied.
2,000
If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1 × 2 tiles. Use characters "&lt;&gt;" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa...
standard output
PASSED
5b32eb8e724e5a59e11ce69c39e2e93e
train_001.jsonl
1424190900
Drazil created a following problem about putting 1 × 2 tiles into an n × m grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1 × 2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Bit...
Java
["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"]
2 seconds
["Not unique", "&lt;&gt;**\n*^&lt;&gt;\n*v**\n&lt;&gt;&lt;&gt;", "*&lt;&gt;*\n&lt;&gt;&lt;&gt;", "Not unique", "*"]
NoteIn the first case, there are indeed two solutions:&lt;&gt;^^*vv&lt;&gt;and^&lt;&gt;v*^&lt;&gt;vso the answer is "Not unique".
Java 8
standard input
[ "constructive algorithms", "greedy" ]
9465c37b6f948da14e71cc96ac24bb2e
The first line contains two integers n and m (1 ≤ n, m ≤ 2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied.
2,000
If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1 × 2 tiles. Use characters "&lt;&gt;" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa...
standard output
PASSED
576e6f7b55602d736ac817e5539c0530
train_001.jsonl
1424190900
Drazil created a following problem about putting 1 × 2 tiles into an n × m grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1 × 2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d...
256 megabytes
import java.io.BufferedInputStream; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.Arrays; public class D292 { static final int[] dr = {-1,0,1,0}, dc = {0,-1,0,1}; static final char[] dir = {'v','>','^','<'}; static int R, C; static char[][] mat; public stati...
Java
["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"]
2 seconds
["Not unique", "&lt;&gt;**\n*^&lt;&gt;\n*v**\n&lt;&gt;&lt;&gt;", "*&lt;&gt;*\n&lt;&gt;&lt;&gt;", "Not unique", "*"]
NoteIn the first case, there are indeed two solutions:&lt;&gt;^^*vv&lt;&gt;and^&lt;&gt;v*^&lt;&gt;vso the answer is "Not unique".
Java 8
standard input
[ "constructive algorithms", "greedy" ]
9465c37b6f948da14e71cc96ac24bb2e
The first line contains two integers n and m (1 ≤ n, m ≤ 2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied.
2,000
If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1 × 2 tiles. Use characters "&lt;&gt;" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa...
standard output
PASSED
f30e003ebad1a6ebc7e2579003cb54db
train_001.jsonl
1424190900
Drazil created a following problem about putting 1 × 2 tiles into an n × m grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1 × 2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.PriorityQueue; import java.util.StringTokenizer; /* public class _515D { } */ public cl...
Java
["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"]
2 seconds
["Not unique", "&lt;&gt;**\n*^&lt;&gt;\n*v**\n&lt;&gt;&lt;&gt;", "*&lt;&gt;*\n&lt;&gt;&lt;&gt;", "Not unique", "*"]
NoteIn the first case, there are indeed two solutions:&lt;&gt;^^*vv&lt;&gt;and^&lt;&gt;v*^&lt;&gt;vso the answer is "Not unique".
Java 8
standard input
[ "constructive algorithms", "greedy" ]
9465c37b6f948da14e71cc96ac24bb2e
The first line contains two integers n and m (1 ≤ n, m ≤ 2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied.
2,000
If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1 × 2 tiles. Use characters "&lt;&gt;" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa...
standard output
PASSED
18355e3ffa651b1bdc4caf05fec65238
train_001.jsonl
1424190900
Drazil created a following problem about putting 1 × 2 tiles into an n × m grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1 × 2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d...
256 megabytes
//package codeForcesTry; import java.io.BufferedReader; import java.io.Closeable; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class D515_DrazilTiles implements Closeable { BufferedReader reader = new BufferedReader(new InputStream...
Java
["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"]
2 seconds
["Not unique", "&lt;&gt;**\n*^&lt;&gt;\n*v**\n&lt;&gt;&lt;&gt;", "*&lt;&gt;*\n&lt;&gt;&lt;&gt;", "Not unique", "*"]
NoteIn the first case, there are indeed two solutions:&lt;&gt;^^*vv&lt;&gt;and^&lt;&gt;v*^&lt;&gt;vso the answer is "Not unique".
Java 8
standard input
[ "constructive algorithms", "greedy" ]
9465c37b6f948da14e71cc96ac24bb2e
The first line contains two integers n and m (1 ≤ n, m ≤ 2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied.
2,000
If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1 × 2 tiles. Use characters "&lt;&gt;" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa...
standard output
PASSED
ae1a9bba9529794d89114a80da239210
train_001.jsonl
1424190900
Drazil created a following problem about putting 1 × 2 tiles into an n × m grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1 × 2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d...
256 megabytes
import java.io.*; import java.util.*; public class D { public D() { Scanner s = new Scanner(); boolean debug = false; int n = s.nextInt(); int m = s.nextInt(); char [][] chars = new char[n][m]; for (int i = 0; i < n; i++) { String str = s.next(); for (int j = 0; j < m ;j++) { chars[i]...
Java
["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"]
2 seconds
["Not unique", "&lt;&gt;**\n*^&lt;&gt;\n*v**\n&lt;&gt;&lt;&gt;", "*&lt;&gt;*\n&lt;&gt;&lt;&gt;", "Not unique", "*"]
NoteIn the first case, there are indeed two solutions:&lt;&gt;^^*vv&lt;&gt;and^&lt;&gt;v*^&lt;&gt;vso the answer is "Not unique".
Java 8
standard input
[ "constructive algorithms", "greedy" ]
9465c37b6f948da14e71cc96ac24bb2e
The first line contains two integers n and m (1 ≤ n, m ≤ 2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied.
2,000
If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1 × 2 tiles. Use characters "&lt;&gt;" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa...
standard output
PASSED
af97b43b1212baaaef1c0eaacfa4a8a9
train_001.jsonl
1558884900
Toad Ivan has $$$m$$$ pairs of integers, each integer is between $$$1$$$ and $$$n$$$, inclusive. The pairs are $$$(a_1, b_1), (a_2, b_2), \ldots, (a_m, b_m)$$$. He asks you to check if there exist two integers $$$x$$$ and $$$y$$$ ($$$1 \leq x &lt; y \leq n$$$) such that in each given pair at least one integer is equal ...
256 megabytes
import java.util.*;import java.io.*;import java.math.*; public class Main { static class Pair{ int a,b; Pair(int a,int b){ this.a=a; this.b=b; } } public static void process()throws IOException { int n=ni(),m=ni(); Pair arr[]=new Pair[m+1]; for(int i=1;i<=m;i++) arr[i]=new ...
Java
["4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 4\n1 2\n2 3\n3 4\n4 5", "300000 5\n1 2\n1 2\n1 2\n1 2\n1 2"]
2 seconds
["NO", "YES", "YES"]
NoteIn the first example, you can't choose any $$$x$$$, $$$y$$$ because for each such pair you can find a given pair where both numbers are different from chosen integers.In the second example, you can choose $$$x=2$$$ and $$$y=4$$$.In the third example, you can choose $$$x=1$$$ and $$$y=2$$$.
Java 11
standard input
[ "implementation", "graphs" ]
60af9947ed99256a2820814f1bf1c6c6
The first line contains two space-separated integers $$$n$$$ and $$$m$$$ ($$$2 \leq n \leq 300\,000$$$, $$$1 \leq m \leq 300\,000$$$) — the upper bound on the values of integers in the pairs, and the number of given pairs. The next $$$m$$$ lines contain two integers each, the $$$i$$$-th of them contains two space-separ...
1,500
Output "YES" if there exist two integers $$$x$$$ and $$$y$$$ ($$$1 \leq x &lt; y \leq n$$$) such that in each given pair at least one integer is equal to $$$x$$$ or $$$y$$$. Otherwise, print "NO". You can print each letter in any case (upper or lower).
standard output
PASSED
05fb52aea60a44751d7df442d4ea5e68
train_001.jsonl
1558884900
Toad Ivan has $$$m$$$ pairs of integers, each integer is between $$$1$$$ and $$$n$$$, inclusive. The pairs are $$$(a_1, b_1), (a_2, b_2), \ldots, (a_m, b_m)$$$. He asks you to check if there exist two integers $$$x$$$ and $$$y$$$ ($$$1 \leq x &lt; y \leq n$$$) such that in each given pair at least one integer is equal ...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; public class GFG { static class edge{ int s,d,w; public edge(int s,int d,int w) { this.s=s; this.d=d; this.w=w; } } static class graph{ int v; LinkedLis...
Java
["4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 4\n1 2\n2 3\n3 4\n4 5", "300000 5\n1 2\n1 2\n1 2\n1 2\n1 2"]
2 seconds
["NO", "YES", "YES"]
NoteIn the first example, you can't choose any $$$x$$$, $$$y$$$ because for each such pair you can find a given pair where both numbers are different from chosen integers.In the second example, you can choose $$$x=2$$$ and $$$y=4$$$.In the third example, you can choose $$$x=1$$$ and $$$y=2$$$.
Java 11
standard input
[ "implementation", "graphs" ]
60af9947ed99256a2820814f1bf1c6c6
The first line contains two space-separated integers $$$n$$$ and $$$m$$$ ($$$2 \leq n \leq 300\,000$$$, $$$1 \leq m \leq 300\,000$$$) — the upper bound on the values of integers in the pairs, and the number of given pairs. The next $$$m$$$ lines contain two integers each, the $$$i$$$-th of them contains two space-separ...
1,500
Output "YES" if there exist two integers $$$x$$$ and $$$y$$$ ($$$1 \leq x &lt; y \leq n$$$) such that in each given pair at least one integer is equal to $$$x$$$ or $$$y$$$. Otherwise, print "NO". You can print each letter in any case (upper or lower).
standard output
PASSED
419545118bca3d86896f1c1182aaf562
train_001.jsonl
1558884900
Toad Ivan has $$$m$$$ pairs of integers, each integer is between $$$1$$$ and $$$n$$$, inclusive. The pairs are $$$(a_1, b_1), (a_2, b_2), \ldots, (a_m, b_m)$$$. He asks you to check if there exist two integers $$$x$$$ and $$$y$$$ ($$$1 \leq x &lt; y \leq n$$$) such that in each given pair at least one integer is equal ...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; // printArr() - prints the array // intList, doubleList, longList // nextIntArray /* stuff you should look for * int overflow, array bounds * special cases (n=1?) * do smth instead of nothing and stay organized * WRITE STUFF DOWN */ public class current ...
Java
["4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 4\n1 2\n2 3\n3 4\n4 5", "300000 5\n1 2\n1 2\n1 2\n1 2\n1 2"]
2 seconds
["NO", "YES", "YES"]
NoteIn the first example, you can't choose any $$$x$$$, $$$y$$$ because for each such pair you can find a given pair where both numbers are different from chosen integers.In the second example, you can choose $$$x=2$$$ and $$$y=4$$$.In the third example, you can choose $$$x=1$$$ and $$$y=2$$$.
Java 11
standard input
[ "implementation", "graphs" ]
60af9947ed99256a2820814f1bf1c6c6
The first line contains two space-separated integers $$$n$$$ and $$$m$$$ ($$$2 \leq n \leq 300\,000$$$, $$$1 \leq m \leq 300\,000$$$) — the upper bound on the values of integers in the pairs, and the number of given pairs. The next $$$m$$$ lines contain two integers each, the $$$i$$$-th of them contains two space-separ...
1,500
Output "YES" if there exist two integers $$$x$$$ and $$$y$$$ ($$$1 \leq x &lt; y \leq n$$$) such that in each given pair at least one integer is equal to $$$x$$$ or $$$y$$$. Otherwise, print "NO". You can print each letter in any case (upper or lower).
standard output
PASSED
d409b62f11a03578c6fa55effdbdda78
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main { public static void main(String[] args) { new Thread(null, new Runnable() { public void run() { solve(); } }, "1", 1 ...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
0a31e415d5471214e9f5577b2977b02f
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
/**/ import java.io.*; import java.util.*; import java.text.*; import java.lang.*; import java.math.*; public class Main{ /*********************************************Constants***********************************/ static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out)); ...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
e9d10545e6e45099c774eb641b812034
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
// Working program with FastReader import java.io.*; import java.util.*; public class ProblemB { static PrintWriter out; static FastReader sc; static class FastReader { BufferedReader br; StringTokenizer st; public FastReader(){ br = new BufferedReader(new Inp...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
9e85e7d591b312640581841e8b2dc09b
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.io.*; import java.util.*; public class Solution { public static void main(String[]args) { Scanner sc=new Scanner(System.in); while(sc.hasNext()) { int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); String s=sc.next(); ...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
b290f34573378f89490a6436f7fd1723
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.util.*; import java.io.*; import java.text.*; public class CF_1428_B{ //SOLUTION BEGIN void pre() throws Exception{} void solve(int TC) throws Exception{ int N = ni(); String s = n(); int ans = 0; int mask = 0; for(int i = 0; i< N; i++){ if(s....
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
9e30f1d45b593e0399031577e69a224d
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
/* ⣿⣿⣿⣿⣿⣿⡷⣯⢿⣿⣷⣻⢯⣿⡽⣻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠸⣿⣿⣆⠹⣿⣿⢾⣟⣯⣿⣿⣿⣿⣿⣿⣽⣻⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣻⣽⡿⣿⣎⠙⣿⣞⣷⡌⢻⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⡄⠹⣿⣿⡆⠻⣿⣟⣯⡿⣽⡿⣿⣿⣿⣿⣽⡷⣯⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣷⣿⣿⣿⡀⠹⣟⣾⣟⣆⠹⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢠⡘⣿⣿⡄⠉⢿⣿⣽⡷⣿⣻⣿⣿⣿⣿⡝⣷⣯⢿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣯⢿⣾⢿⣿⡄⢄⠘⢿⣞⡿⣧⡈⢷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣧⠘⣿⣷⠈⣦⠙⢿⣽⣷⣻⣽⣿⣿⣿⣿⣌⢿⣯⢿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣯⣿⢿⣿⡆⢸⡷⡈⢻⡽⣷⡷⡄⠻⣽⣿⣿⡿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣏⢰⣯⢷⠈⣿⡆⢹⢷⡌⠻⡾⢋⣱⣯⣿⣿⣿⣿⡆⢻⡿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⡎...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
e3d2d82a7ed489d5686603ce01fce471
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; public class Codeforces{ BufferedReader br =new BufferedReader(new InputStreamReader(System.in)); PrintWriter out =new PrintWriter(System.out); StringTokenizer st =new StringTokenizer(""); String next(){ if(!st.hasMoreTokens()){ ...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
68f692dcde9bbf6824af2cef86138263
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.util.*; public class Beltedroom { public static void main(String[] args) { Scanner scan=new Scanner(System.in); int t=scan.nextInt(); while (t-->0) { int n=scan.nextInt(); Set<Integer> set=new HashSet<>(); String s=scan.next(); Set<Character> ch=new HashSet<>(); for(int i=0;i<n;i++) {...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
091600290c3895c212e9f6eb3fc22587
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { Scanner sc = new Scanner(System.in); P...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
2d7b6b3ef0054f43e4b0eca2cc3f3803
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.io.*; import java.util.*; public class B { public static void main(String[] args) throws IOException { FastScanner in = new FastScanner(System.in); PrintWriter out = new PrintWriter(System.out); int t = in.nextInt(); for (int g = 0; g < t; g++) { int n = in...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
57831eecc43cc4bc66f9d32d4671905b
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
// Utilities import java.io.*; import java.util.*; public class Main { static int T; static int N; static char[] ch; static Boolean[] b; static int cntAntiClockwise, cntClockwise, cntZ; static int cnt; public static void main(String[] args) throws IOException { T = in.iscan(); while (T-- > 0) { N = in....
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
d5c732821feadf8a473567b0204b1a54
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.util.*; import java.io.*; public class _1428B { static int[] MODS = {1000000007, 998244353}; static int MOD = MODS[0]; public static void main(String[] args) { sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); int t = sc.nextInt(); ...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
1f169f683858dbe7130af3a9225fc7ee
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.util.Scanner; public class Snake { public static void main(String[] args) { Scanner in=new Scanner(System.in); int t=in.nextInt(); int m[]=new int [t]; int i,j; for(i=0;i<t;i++) { int x=in.nextInt(); int f=0; int d=0,e=0...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
72ba0cddfd02bf74825eb8641cde00bb
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.io.*; import java.util.*; public class BeltedRooms { public static void main(String[] args) { FastScanner in = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int t = in.nextInt(); while(t-->0) { int n = in.nextInt(); char ch[] = in.nex...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
8a565f263f871aa1159db637ca379025
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.io.*; import java.util.*; public class Rough{ static PrintWriter ww = new PrintWriter(System.out); static boolean check(char arr[]){ for(int i = 1 ; i < arr.length ; i++){ if(arr[i] != arr[i - 1])return false; } return true; } public static void mai...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
6fe699a044a109754d3769b05e49a302
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.math.BigInteger; public final class codeforces { static StringBuilder ans=new StringBuilder();; static FastReader in=new FastReader(); static ArrayList<ArrayList<Integer>> g=new ArrayList<ArrayList<Integer>>(); static long mod=100...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
2726a271da42e62d42b590ce1ec6b409
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.Random; import java.util.StringTokenizer; public class H { public static void main(String[] args) { FastReader scan = new FastReader(); PrintWriter out = new PrintWriter(System.out); Task solver = new Task(); int t = scan....
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
adcaca86829a491abd8fff5eb2bc1154
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s=new Scanner(System.in); int t=s.nextInt(); for(int i=0;i<t;i++) { int n=s.nextInt(); String str=s.next(); int l=0; int r=0; for(int j=0;j<n;j++) { if(str.charAt(j)=='>') ...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
33110f070ade1c9fdf8bd47a0234c2ac
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.util.*; import java.io.*; public class BeltedRooms { InputStream is; PrintWriter out; String INPUT = ""; void solve() throws IOException { int t= ni(); for(int ii=0;ii<t;ii++) { int n= ni(); char[] ch= ns(n); boolean clock= false...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
14e494bc97aa8f1ad5c8b39aa8dbcb76
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.Stack; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { FastScanner sc =n...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
32d9a527e7779e71ce48cdbe39f01cf6
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static final int mod=1000000007; public static void main(String[] args) throws IOException { //File filein = new File("input.txt"); //BufferedReader sc=new BufferedReader(new FileReader(filein)); //PrintWriter out=new PrintWriter(new FileWrit...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
6f5be23ec4021a4209feee96ce28bd84
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.util.*; public class square{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int p=1;p<=t;p++) { int n=sc.nextInt(); String s=sc.next(); int[] a=new int[n];int clock=0,anti=0,off=0; for(int i=0;i<n;i++) ...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
66aed7cd9f63d5adaa3ece5c26db9e0b
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.util.*; public class Solution { public static int beltedRooms(String s, int n) { int count = 0; boolean one = true; boolean two = true; for (int i=0; i<n; i++) { if (s.charAt(i) == '<') one = false; if (s.charAt(i) == '>') ...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
21d19fbee2de287c30033ce1707b4656
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.util.*; public class Random { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); while(N>0){ int n = sc.nextInt(); String s = sc.next(); int countDash = 0 ; int countanti = ...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
02341e35583b4c765d7209c2201f9e13
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.math.BigInteger; import java.util.*; /** * @author Mubtasim Shahriar */ public class BeltRoom { public static void main(String[] args) { InputStream inputStream = System.in; ...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
9d0ea57476157194fe3ca607ed7f7da8
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.math.BigInteger; import java.util.*; /** * @author Mubtasim Shahriar */ public class BeltedRooms { public static void main(String[] args) { InputStream inputStream = System.in; ...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
203314602c6f5276a65f69fd282e85af
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class B { static boolean found=false; public static void main(String[] args) throws IOException { FastScanner fs=new FastScanner(); PrintWriter out = new PrintWriter(System.out); // int T = 1; int T=fs.nextInt(); ...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
02709219ae449d234c51b1541291e013
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.util.*; import java.io.*; public class b { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int i = 0; i < t; i++) { int n = sc.nextInt(); sc.nextLine(); char[] conveyor ...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
7f5e78b355fd4b707ec53d929fd7ad86
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.util.Scanner; public class B1428 { private final static Scanner scanner = new Scanner(System.in); public static void main(String[] args) { int groups = scanner.nextInt(); for (int i = 0; i < groups; i++) { inner(); } } private static void inner(){ ...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
aa5dbe3d8384317f78ca1e9440f1d927
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.util.Scanner; public class B1428 { private final static Scanner scanner = new Scanner(System.in); public static void main(String[] args) { int groups = scanner.nextInt(); for (int i = 0; i < groups; i++) { inner(); } } private static void inner(){ ...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
e7eed7bdd4c0137b1ba8b657ddffdc79
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.io.IOException; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class BeltedRooms{ public static void main(String[] args) throws IOException{ Reader.init(System.in); int t =...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
0b03d49b813245b052d9ca8b24303f0d
train_001.jsonl
1602939900
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$...
256 megabytes
import java.util.*; public class Solution{ public static void main(String args[])throws java.lang.Exception { Scanner sc = new Scanner(System.in); int testcase= sc.nextInt(); while(testcase-->0) { int n=sc.nextInt(); char dir[] = sc.next().toCharArray(); boolean c=false,a=false; for(int i=0;i<n;i++)...
Java
["4\n4\n-&gt;&lt;-\n5\n&gt;&gt;&gt;&gt;&gt;\n3\n&lt;--\n2\n&lt;&gt;"]
1 second
["3\n5\n3\n0"]
NoteIn the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement. In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
Java 8
standard input
[ "implementation", "graphs" ]
f82685f41f4ba1146fea8e1eb0c260dc
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows. The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms. The...
1,200
For each test case, output the number of returnable rooms.
standard output
PASSED
460b45a0c49fb691ca7dbb8c667204c8
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
import java.io.*; import java.util.*; public class Simple { public static void main(String[] args) { Scanner in = new Scanner(System.in); int num = in.nextInt(); Stack<Integer> prgIndecis = new Stack<Integer>(); Stack<Integer> mathIndecis = new Stack<Integer>(); Stack<Integer> peIndecis = new Stac...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
e6fccf9b5eabdc22c7c692e58adabd3b
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int w = scan.nextInt(); int[] a = new int[w]; for(int i=0 ; i < w ; i++){ a[i] = scan.nextInt(); } int l=0,m=0,n=0,p=0,q=0; for(int i=0 ; i<w...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
d803a1cf43902e8e90fc79ddf58ba428
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
import java.util.*; public class Olympiad { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int len = sc.nextInt(); int[] arr = new int[len]; ArrayList<Integer> l1 = new ArrayList<>(); ArrayList<Integer> l2 = new ArrayList<>(); Arr...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
16c190303150bbb79985083a0bccd89d
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
import java.util.*; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); ArrayList<Integer> a1 = new ArrayList<Integer>(); ArrayList<Integer> a2 = new ArrayList<Integer>(); ArrayList<Integer> a3 = new Ar...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
b1b23e0ba5f0f6479a7ff6ff1ee3fcae
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
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.Scanner; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStrea...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
34e23b969bb84d57650b48f933cdedc4
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
/* package codechef; // don't place package name! https://codeforces.com/problemset/status?my=on */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exce...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
c87b58c10140ee95ca67eaca0ab93fc9
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
import java.util.*; public class file { public static void main(String args[]) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int a[]=new int[n]; int a1[]=new int[n]; int a2[]=new int[n]; int a3[]=new int[n]; int k, l, m; k=l=m=0; for...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
e7215468dfcdc3819df6f1e41bb5c1ef
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
import java.util.Scanner; import java.util.ArrayList; public class E { public static void main(String[]args){ Scanner input=new Scanner(System.in) ; int n=input.nextInt(); // ArrayList<Integer> arr= new ArrayList<>(); // ArrayList<Integer> index= new ArrayList<>(); int arr[]=new int[n]; ...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
7dae6c41673e60346086e1b7c9d5b599
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
import java.io.BufferedReader; import java.io.InputStream; import java.io.OutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; public class A490 { public static void main(String [] args) { InputStream inputReader = System...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
ad372e785e48caedc796e1cdfc5e8deb
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
import java.io.*; public class TeamOlympiad { public static void main(String args[])throws IOException { BufferedReader rd = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(rd.readLine()); String s = rd.readLine(); int t1 = 0, t2 = 0, t3 = 0; ...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
cb267a74dbae7d9bfc2a2ec22bc521f5
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
import java.io.*; public class TeamOlympiad { public static void main(String args[])throws IOException { BufferedReader rd = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(rd.readLine()); String s = rd.readLine(); int t1 = 0, t2 = 0, t3 = 0; ...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
8038ecec008151edb79f6feb79a67ee4
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
import java.io.*; public class TeamOlympiad { public static void main(String args[])throws IOException { BufferedReader rd = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(rd.readLine()); String s = rd.readLine(); int t1 = 0, t2 = 0, t3 = 0; ...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
38b39b4d81bf85b4afd51466e0327d75
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int n = scn.nextInt(); int[] arr = new int[n]; for(int i =0;i< n;i++){ arr[i] = scn.nextInt(); } int c =0; boolean[] visit = new boolean[n]; boo...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
7af9979c934ecd9d129e8e5cb7f47200
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args)throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int arr[] = new int[n]; String line = br.readLine(); // to read multiple in...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
d06b309782f354b3a1c57f1d86c6275b
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
import java.util.*; public class MainScreen{ public static void main(String[] args){ Scanner in = new Scanner(System.in); int n = in.nextInt(); int k=0; int iMathStudents=0; int iProgrammingStudents=0; int iSportsStudents=0; int iNumOfTeams=0; int array[]=new int [n]; for(int i=0;i<n;i++) { array[...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
fe7bb8e7130dc13fe6b391c892934129
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
import java.util.*; public class TeamOlympiad { public static void main(String args []) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); HashMap<Integer, ArrayList<Integer>> students = new HashMap<>(); students.put(1, new ArrayList<Integer>()); students.put(2, new ArrayList<Integer>(...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
d40dd2be18a9b3bde29386b2e5fc4375
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class ss { public static void main(String[] args) { Scanner in=new Scanner(System.in); int len=in.nextInt(); int arr[]=new int[len]; int a1=0;int b1=0;int c1=0; ArrayList<Integer> li1=new ArrayList<Integer>(); ArrayList<...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
540555de073d5bdf91c6eeba5bca4286
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.List; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.io.InputStream; ...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
5ac36d15261cf35744bd4316f0006b2a
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.List; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.io.InputStream; ...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
b183e2f1ed8154eb3920903dc59f65e6
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
import java.io.*; import java.util.*; public final class GFG { public static void main (String[] args) { //System.out.println("GfG!"); Scanner scan=new Scanner(System.in); int n=scan.nextInt(); int count=0; int flag=0; int col1=0,col2=0,col3=0; int teams=n/3; if(teams==0) {System.out.println("0")...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
97fda789a281ea4ea8df6578bca4633a
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
import java.util.*; public class teamolympiad { public static void main(String args[]) { Scanner in=new Scanner(System.in); int n=in.nextInt(); int a[]=new int[n+1]; int b[]=new int[4]; int s[]=new int[5000]; int s1[]=new int[5000]; int s2[]=new int[5000];...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
996ec0ac2a8bae66ae24a9fa15570027
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
import java.util.Scanner; import java.util.Arrays; import java.util.*; import java.math.*; import java.io.*; import java.util.Set; import static java.lang.Math.*; public class Competitive { public static void main(String[] args) { Scanner s = new Scanner(System.in); int a = s.nextInt(); ArrayList<Integer...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
6160d852370f4dc0fb3c389e94bb5ed5
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
import java.util.Scanner; import java.util.Arrays; import java.util.*; import java.math.*; import java.io.*; import java.util.Set; import static java.lang.Math.*; public class Competitive { public static void main(String[] args) { Scanner s = new Scanner(System.in); int a = s.nextInt(); ArrayList<Integer...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
60e939b02cee4d5c3598c47f74a9279e
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.StringTokenizer; public class Team_Olympiad_490A { public static void main(String[] args) { input in = new input(); int n = in.nextInt(); int c1=0,c2=0,...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
e991e0f2235ea3f592d1c363fab2b1b9
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.util.HashMap; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayLi...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
69a13c04b7b2611d8ca2fc3b7f201dea
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
import java.util.Scanner; public class Main{ private static int CountElements(String line, char separate_element){ String number = ""; int counter = 0; char character = ' '; for(int index = 0; index < line.length(); index++){ character = line.charAt(index); i...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
3bcabd3ad6b83d2233525efc289f5e99
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class Alaaa { public static void main (String[]args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); String s = sc.nextLine(); ArrayList<Integer> Ones = new ArrayList<>() ; ArrayList<Integer> Twos = new ArrayList<>(...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
ad82c57b4c7b783408a0198e3ac1a950
train_001.jsonl
1416733800
The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value ti: ti = 1, if the i-th child is good at programming, ti = 2,...
256 megabytes
import java.util.Scanner; /** * * @author Kuari */ public class Teamolempics { public static int one,two,three,num,x=1,y=0,z=1,min,arr1=0,arr2=0,arr3=0; public static String s,s2; /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code applicat...
Java
["7\n1 3 1 3 2 1 2", "4\n2 1 1 2"]
1 second
["2\n3 5 2\n6 7 4", "0"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
c014861f27edf35990cc065399697b10
The first line contains integer n (1 ≤ n ≤ 5000) — the number of children in the school. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 3), where ti describes the skill of the i-th child.
800
In the first line output integer w — the largest possible number of teams. Then print w lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from 1 to n in...
standard output
PASSED
b53e677cd5e55477d832d22812da0d03
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
import java.io.*; import java.util.*; public class a281{ public static void main(String[] args) { MyScanner obj = new MyScanner(); String h=obj.nextLine(); String a=obj.nextLine(); int arr[][]=new int[2][100]; int ar[][]=new int[2][100]; Arrays.fill(arr[0],0); Arrays.fill(ar...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
68805858c5c45a173c090d0c1291274a
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
import java.util.Scanner; public class a { public static void main(String[] args) { Scanner input = new Scanner(System.in); String team1 = input.nextLine(); String team2 = input.nextLine(); int n = Integer.parseInt(input.next()); int [] players1 = new int [100]; int [] players2 = new int [100];...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
9a8360bec0ad89867ecd1cb49a921ed5
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.IOException; public class Problem493A { private static int[] home = new int[99]; private static int[] away = new int[99]; private static String hom...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
86d52e877e5d03e9ee69dbb25493116a
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { String team[] = new String[2]; String map = "ha"; String card = "yr"; Scanner sc = new Scanner(System.in); for(int i = 0; i < 2; i++) { team[i] = sc.next(); } int member[][] = new int[2][100]; int N = sc.nextInt...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
70cf43f837ff96b03320a7e8ce5248cf
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
import java.awt.Point; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; import java.util.StringTokenizer; import java.util.TreeSet; public class A_Div2_281 { public static void main(String[]arg) throws IOException ...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
eda04d8036d5a426a6c4ea9aadacdc96
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
import static java.lang.Integer.parseInt; import java.io.BufferedReader; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.StringTokenizer; public class con281_A { static BufferedReader br = new BufferedReader( new InputStreamReader(System.in, Sta...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
e9e3f4e1c51f3852af389572fd6042e4
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String args[]){ Scanner s=new Scanner(System.in); ArrayList<Integer> t1=new ArrayList<Integer>(); ArrayList<Integer> t2=new ArrayList<Integer>(); ArrayList<Integer> t3=new ArrayList<Integer>(); ArrayList<Intege...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
fa12fba29f595ba925219c755fdc717c
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
import java.util.*; public class VasyaAndFootball { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String home = sc.nextLine(); String away = sc.nextLine(); int n = Integer.parseInt(sc.nextLine()); String line, player, team; String[] ret; // System.out.println("home : " +...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
188667fa92e27b402b59268613ac849d
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
import java.util.Scanner; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author Madi */ public class A493 { public static void main(String[] args) { Scanner...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
95e5947e5393a67931c81d5828bfef6a
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; /**Vasya and Football */ public class VF { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
0c409a56ccbd9e62bedbc2e8f0a6faf6
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
/** * Created by sreenidhisreesha on 12/8/14. */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; /**Vasya and Football */ public class VF { public static void main(String[] args) throws IOException { BufferedReader br = new ...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
3b5c174eb38ece57a692c0b90066831a
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
import java.util.*; public class fouls { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String tm1 = sc.nextLine(); String tm2 = sc.nextLine(); int fls = Integer.valueOf(sc.nextLine()); Map<Integer, prof> map1 = new HashMap<Integer, prof>(); Map<Integer, prof> map2 = new H...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
705673ea2df27907d57907290a691e5b
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class CF_493A { public static void main(String[] args) { Scanner in = new Scanner(System.in); String homeTeamName = in.nextLine(); String AwayTeamName = in.nextLine(); int n = in.nextInt(); in.nex...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
14f7edcbefa9097b1f06d3420bf2568c
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.util.HashMap; import java.io.OutputStream; import java.io.PrintWriter; import java.util.NoSuchElementException; import java.io.Writer; import java.math.BigInteger; import ja...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
7159be2242b2165b9945ef6149dcd240
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Comparator; import java.util.PriorityQueue; public class Trial { static public void main(String[] args)throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String hTea...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
e2ec66424d376f05c105229ebf460ad4
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Iterator; import java.util.Scanner; public class A_Vasya_and_Football_Round281 { public static class falou { public int min, num; public String team, type; } public static class out implements Comparator<ou...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
bb325aa68fb6a7cf491f50888e1ea73c
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.*; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.math.BigInteger; /** * Ashesh Vidyut (Drift King) * *...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
302f062ed1c16f9b7ce56adfee9a58a9
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
import java.util.Scanner; public class _493A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String home = sc.next(); String nohome = sc.next(); int h[] = new int[100]; int n[] = new int[100]; boolean hjjj[] = new boolean[100]; boolean njjj[] = new boolean[100]; int am ...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
78d7f2ad464652fa5ded2dc9c4a48a79
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
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 s=new Sca...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
9e2d65e9cc440e1fc5d1a5decb03a86b
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
import java.io.*; import java.util.*; public class Main { static PrintWriter out = new PrintWriter(new BufferedWriter( new OutputStreamWriter(System.out))); public static void main(String[] args) throws IOException { // PrintStream out = new PrintStream(new // FileOutputStream("out.out")); Scan scan = new ...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
0c136acda4880ec5b6aa6ccd18a57438
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
import java.util.Scanner; public class Contest_281 { public static void main(String args[]){ Scanner in = new Scanner(System.in); String home = "", away = ""; home = in.next(); away = in.next(); int n = in.nextInt(); int m1[] = new int[101]; ...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
c6a5368c001ab2fc6a6749a821c66d41
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
//package Codeforces.Div2A_281.Code1; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.StringTokenizer; /* * some cheeky quote */ public class Main { FastScanner in; PrintWriter out; Arr...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
34a4620e4eb6af5826c4c3f66d4307ca
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Scanner; /** * Created by ramasamy on 12/3/2014. */ public class VFootball { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String homeTeam = sc.nextLine(); ...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
78d70cff4a79d6b9eb25ce226093dba9
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
import java.util.HashMap; import java.util.Scanner; public class P493A { public P493A() { // TODO Auto-generated constructor stub Scanner scan = new Scanner(System.in); String teamA = scan.nextLine(); String teamB = scan.nextLine(); int fouls = Integer.parseInt(scan.nextLine()); HashMap<String, Integer> ...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
d07a442356f80d27775dcfa2780657c7
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.Scanner; import java.util.SortedSet; import java.util.TreeSet; /* import doge.wow.Shibeforces; ░░░░░░░░░▄░░░░░░░░░░░░░░▄░░░░ ░░░░░░░░▌▒█░░░░░░░░░░░▄▀▒▌░░░ ░░░░░░░░▌▒▒█░░░░░░░░▄▀▒▒▒▐░░░ ░░░░░░░▐▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐░░░ ░░░░░▄▄▀▒░▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐░...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
ba9e14fe33b981a423f713e30e65ed63
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[]args){ Scanner in = new Scanner(System.in); String h = in.next(); String a = in.next(); int f = in.nextInt(); int[]cnt = new int[100]; int[]cnt1 = n...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output