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 | 67173d9376a4aa8710851f8c9475e58f | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.util.Scanner;
public class PrincessesAndPrinces {
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
while (t > 0) {
int n = in.nextInt();
boolean[] princes = new boolean[n];
int notSatisfiedDa... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 699f308c3e67b56f64f592669975e3c2 | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.io.*;
import java.util.*;
public class code {
public static void main(String[] args) throws Exception {
Scanner sc= new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int t=sc.nextInt();
while(t-->0) {
int n=sc.nextInt();
HashSet<Integer> prince= new HashSet<Integer>();
... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 715f2082aca29ca7bc05ad7f2b25ff14 | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.io.*;
import java.util.Arrays;
public class BMarry {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int t=Integer.parseInt(br.readLine().trim());
while(t-->0) {
... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 2368cfe687627ae8fa23a85907e3085c | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.io.*;
import java.util.*;
public class Princesses_and_Princes
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
InputStreamReader(System.in));
... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 269c70ed58bffaf53989eee3b757da04 | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes |
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Two2 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt();
// System.out.println("n = "+n);
int[] princess = new int[n];
fo... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 310f5e890d48a5075a7ba5a74e582a3b | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class Solve {
FastScanner in;
PrintWriter out;
void solve() {
int T = in.nextInt();
while (0 < T--) {
int n = in.nextInt();
boolean[] a = new boolean[n];
boolean[] b = new boolean[n];
... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 4891cddcc08df876c480f0450c4cdb43 | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class Solve {
FastScanner in;
PrintWriter out;
void solve() {
int T = in.nextInt();
while (0 < T--) {
int n = in.nextInt();
boolean[] a = new boolean[n];
boolean[] b = new boolean[n];
... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | c45a33090749541cf9b3351551246d31 | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class Solve {
FastScanner in;
PrintWriter out;
void solve() {
int T = in.nextInt();
while (0 < T--) {
int n = in.nextInt();
boolean[] a = new boolean[n+1];
boolean[] b = new boolean[n+1];
... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 9618ae63a3af2eefdefe7bcaa6ed3c13 | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class PrincessesAndPrinces {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int t = s.nextInt();
while (t-- > 0) {
int n = s.nextInt();
int [][] arr = new i... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | e5c874bc0a6e84acf9d1b83aeabefdc6 | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
StringBuffer out = new StringBuffer();
int t=in.nextInt();
HashSet<Integer> set = new HashSet<>();
label2:
while(t--!=0) {
int n = in.nextInt(... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | e45cd08fa1504b2448fc4e3cfd2f5dab | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes |
import java.util.*;
import java.io.*;
public class PrincessesAndPrinces {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
// Scanner scan = new Scanner(System.in);
FastIO scan = new FastIO(System.i... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | b5746cef40b60a4da7f3f6de518e92ea | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.io.*;
import java.util.*;
public class Friend {
public static void main(String[] args) throws Exception{
// TODO Auto-generated method stub
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int t=Integer.parseInt(br.readLine());
while (t>0)
{
int n=Integer.parseInt(br.r... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 65673ba7688ed4c11e372d597eb62923 | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
import java.util.stream.IntStream;
public class _E84_B implements Runnable{
public static void main(String[] args) {
new Thread(null, new _E84_B(),"Main",1<<27).start()... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | a0e2400d18f62c6e460ee3b2dc6ce4b5 | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.io.PrintWriter;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import java.util.Scanner;
public class TaskA {
static Scanner in = new Scanner(System.in);
static PrintWriter w = new PrintWriter(System.out);
public static void main(String[] args) {
... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 2049ace15743e1cc62865b5ba503c441 | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes |
//package graphtheory;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import j... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | ec08b01a620e2c9a65e471cd409599b7 | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.util.*;
import java.io.*;
public class main
{
public static void main(String args[])throws java.lang.Exception
{
BufferedReader inp = new BufferedReader (new InputStreamReader(System.in));
int n=Integer.parseInt(inp.readLine());
while(n-->0)
{
int a=I... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 1844b07d8ffd8bf197c71bedc47cde03 | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.io.*;
import java.util.*;
public class B {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
sc.nextLine();
for(int x = 0; x < t; x++) {
int n = sc.nextInt();
sc.nextLine();
ArrayList<Integer>[] sets = new Ar... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 29188d38d6257b8e5412c20d2bd62c64 | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
for(int j=0;j<t;j++)
{
int n=sc.nextInt();
ArrayList<ArrayList<Integer>> a=new ArrayList<ArrayList<Integer>>(n);
for(int w=0;w<n;w++){
int k=sc.nextInt();
... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 0ea380727a57ecf0732600af4fc1a8eb | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
so... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 7f62449a504282028bf2bc4aaeefdb40 | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.Math;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader b1 = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(b1.readLine());
t: while(t-->0) {
int n = Integer.parseInt(b1... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 10958096a2e45dce4bbe4e5b97a818fe | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.util.Set;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 246d67b35288408b7659d0726b4672ce | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.util.Map;
import java.util.Set;
import java.util.HashMap;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | e1779ce9b1052c9efaf9cbfc586eb94a | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.util.*;
import java.lang.*;
// https://codeforces.com/problemset/problem/1327/B
public class B1327 {
static Scanner sc;
public static void solve() {
int n = sc.nextInt();
boolean[] d = new boolean[n+1];
boolean[] p = new boolean[n+1];
int missing = -1;
for(int i = 1; i <= n; i++) {
int x =... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | a960d8080658416daaa7c405b274d512 | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes |
import java.util.*;
public class A_B_and_team_trainin{
public static void main(String[] args){
Scanner dek = new Scanner(System.in);
int t = dek.nextInt();
StringBuilder res = new StringBuilder();
while (t-- > 0) {
for(int ll=0;ll<2;ll++){
int aa=2+2*2;
}
int mn = dek.nextInt();
HashSet<Integer> mset = ne... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | c393770400d8703e8a58acd60f8a0d7f | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.util.*;
import java.util.ArrayList;
public class Main{
public static void main(String[] args){
Scanner param = new Scanner(System.in);
int end=param.nextInt();
while(end-->0){
int n=param.nextInt();
int arr[]=new int[n];
int p=-1;
boolean b=false... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 9f4def1ec9de97e6e6d0ad48d2f4c933 | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.StringTokenizer;
public class B_Princesses {
public static void main(String[] args) {
M... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | e525fb2bc6a343da4692444a7574f13a | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | //package com.company;
import java.io.*;
import java.util.*;
import java.lang.*;
public class Main{
public static class FastReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private SpaceCharFilter filter;
... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 67e548489bcb182bbf05be36a10d3698 | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes |
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
public static void main (String[] args) throws java.lang.Exception
{
int saif = 13;
//hehe
Scanner ab=new Scanner(System.in);
int tc=ab.nextInt();
while(tc-->0)
{
int ss=ab.nextInt();
int min=(int)1e6;int ind=-1;
Link... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | fbd67c1344dff90594f294ebf54741ff | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 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 q2
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 8e7fed76d9df32dbe5a5389ee29b4e85 | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.util.*;
public class BigPP {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0) {
int n = sc.nextInt();
int l = -1;
ArrayList<Boolean> m = new ArrayList<Boolean>();
for(int i=0;i<n;i++)
... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 3ac9c2d82bdb394ff77f6a286c2bc746 | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;
import java.util.Set;
public class code12 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scn = new Scanner(System.in);
int t = scn.nextInt();
while(t-->0) {
int n = scn.nextInt();
Ha... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 0d525e576d99444734ded2531fe0dd93 | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes |
import java.util.*;
import java.io.*;
public class graph1 {
public static void main(String args[])throws IOException {
Scanner s=new Scanner(System.in);
int mod=998244353;
int t=s.nextInt();
while(t-->0) {
int n=s.nextInt();
int[] vis=new int[n+1];
ArrayList<Integer> jj[]=new ArrayList[n+1];
... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 017c79ef0faf7299e1af6bff78803261 | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.util.*;
public class Princesses_and_Princes {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int t = s.nextInt();
while(t-->0) {
int n = s.nextInt();
ArrayList<ArrayList<Integer>> al= new ArrayList<>();
for(int i =0;i<n;i++) {
int x = s.nextInt();
Array... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 4216c1ca4c92cda589b862f49a8ff363 | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes |
import java.io.*;
import java.util.*;
public class Princesses {
public static void main(String[] args) {
FastReader in = new FastReader();
int numTrials = in.nextInt();
while(numTrials --> 0) {
int numDaughters = in.nextInt();
ArrayDeque<Int... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 9a8e9f86f65be934be3d8d788b9e9956 | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class B {
public static void main (String[] args) throws java.lang.Exception {
new Solution();
}
}
class Solution {
Reader reader;
public Solution() {
reader = new Reader();
int t = reader.ni();
while (reader.hasNext()) {
run_case();
}
... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | b25416adb9151f0df202356fb2f07b1e | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class B {
public static void main (String[] args) throws java.lang.Exception {
new Solution();
}
}
class Solution {
Reader reader;
public Solution() {
reader = new Reader();
int t = reader.ni();
while (reader.hasNext()) {
run_case();
}
... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | c411dbbfedb8f008acb40b965f42e3ae | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class B {
public static void main (String[] args) throws java.lang.Exception {
new Solution();
}
}
class Solution {
Reader reader;
public Solution() {
reader = new Reader();
int t = reader.ni();
while (reader.hasNext()) {
run_case();
}
... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 4f438ac0d4b73549bd37eb72abb6ea1c | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.io.*;
import java.util.*;
public class B {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
int T = sc.nextInt();
while(T-->0){
int n = sc.nextInt();
HashSet<Integer> set = new HashSet<>();
int ar[] = new int[n];
... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 1293d73897b5c477ddb4b0a267a3302f | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.io.*;
import java.util.*;
public class Princess_And_Princes {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
int T = sc.nextInt();
while(T-->0){
int n = sc.nextInt();
// Optimal solution
HashSet<Integer> set = n... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 0bcf8162f68a5752389b321daaff0558 | train_002.jsonl | 1584974100 | The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well.So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and the... | 256 megabytes | import java.io.*;
import java.util.*;
public class B {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
int T = sc.nextInt();
while(T-->0){
int n = sc.nextInt();
HashSet<Integer> set = new HashSet<>();
int ar[] = new int[n];
... | Java | ["5\n4\n2 2 3\n2 1 2\n2 3 4\n1 3\n2\n0\n0\n3\n3 1 2 3\n3 1 2 3\n3 1 2 3\n1\n1 1\n4\n1 1\n1 2\n1 3\n1 4"] | 2 seconds | ["IMPROVE\n4 4\nIMPROVE\n1 1\nOPTIMAL\nOPTIMAL\nOPTIMAL"] | NoteThe first test case is depicted in the statement. Adding the fourth kingdom to the list of the fourth daughter makes her marry the prince of the fourth kingdom.In the second test case any new entry will increase the number of marriages from $$$0$$$ to $$$1$$$.In the third and the fourth test cases there is no way t... | Java 8 | standard input | [
"greedy",
"graphs",
"brute force"
] | 38911652b3c075354aa8adb2a4c6e362 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of daughters and the number of kingdoms. Each of the next $$$n$$$ lines contains ... | 1,200 | For each test case print the answer to it. Print "IMPROVE" in the first line if Polycarp LXXXIV can add some kingdom to some of his daughter's list so that the total number of married couples increases. The second line then should contain two integers — the index of the daughter and the index of the kingdom Polycarp LX... | standard output | |
PASSED | 1a6730e62f00ccd947dc9addcf9b3808 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.Scanner;
public class CF344A_Magnets {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int count = 1;
boolean curPos = false;
for (int i = 0; i < n; i++) {
boolean pos = readLine(in).startsWith(... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 71bcdd696831f18e01acc0f31f18f3c4 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.Scanner;
public class Magnets {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int nr = sc.nextInt();
int x, old = 0, groups = 0;
for(int i = 0; i < nr; i++) {
x = sc.nextInt();
if(x != old) {
groups++;
}
old = x;
}
System.out.println(groups... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 8f448f5633d5a5ddc12e86c90156838b | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class A {
BufferedReader in;
StringTokenizer st;
PrintWriter out;
public void Solution() throws IOExcept... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 79cf794abfc70aafdffc322d3932b48b | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.*;
public class Main{
public static void main(String [] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a[]= new int[n];
for(int i=0;i<n;i++){
a[i]=sc.nextInt();
}
int t=1;
int temp=a[0];
for(int i=1;i<n;... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 0152cf1ceac278b4d42e04ae6f4c6348 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.*;
public class NumberOne {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = in.nextInt();
}
int islands = 1;
for (int i = 1; i < n; i++) {
if (a[i - 1] != a[i]) {
isl... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | c987393733d5c75953e6edcff2719c5f | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.io.*;
public class Main
{
public static void main(String[] args) throws IOException
{
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
//BufferedReader input = new BufferedReader(new FileReader("Sample Input.txt"));
//StringBuilder output = new Str... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 1808879b7c7b77faf07efd23409e894c | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.Scanner;
public class A344 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int N = in.nextInt();
int acc=0;
int prev=0;
for(int i=0;i<N;i++) {
int x = in.nextInt();
if(prev!=x) {
prev=x;
acc++;
}
}
System.out.println(acc);
}
}
| Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | c4565fd35396d9403626812aeebde0fa | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.io.*;
public class task344a {
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
int n = Integer.parseInt(br.readLine());
int count = 0;
String cur = "ss";
String str;
for (int i = 0; i < n; i++) {
str = br.readLi... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 9f412c4c1059a39b47e99d70e742d20f | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.Scanner;
public class ContestTeam1 {
/**
* @param args
*/
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
int count = 0;
while (console.hasNext()) {
int n = console.nextInt();
... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 94a32896ce2b8d5c5a8225752916d61b | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.Scanner;
public class A344 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
String []dominoes = new String[n];
for(int i = 0; i < n; ++i){
dominoes[i] = scanner.next();
}
int count = 1;
for(int i = 1; i < n; ++i){
if(d... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 5a7de80bcc6fa25caaca70885ddaab84 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
String str = "";
int count = 0;
for(int i=0; i<n; i++) {
String tmp = s.next();
if(!tmp.equals(str)) {
... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 55f5619ba16bdf2323fe2eaa2d5b9f7c | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int numOfMang = sc.nextInt();
int []magPos = new int[100000];
for(int i =0;i<numOfMang;++i)
{
magPos[i] = sc.nextInt();
}
int count = 0;
for(int i =1;i<numOfMang;++i){
i... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 5bd54ec7a76e4fac9f26ff010cca1f89 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int count = 1;
int x = in.nextInt(); int temp;
while(n>1) {
temp = x;
x = in.nextInt();
if(temp!=x)... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 7614df98e612716b28a09b73d04de94b | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.Scanner;
public class Magnets {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
// while (scanner.hasNext()) {
int n = scanner.nextInt();
int old = 0;
int count = 0;
int maxCount = 0;
for (int i = 0; i < n... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 0cc3c43fc2f2e2a9e3f03b45db9b888d | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes |
import java.util.Scanner;
public class A344 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int count = 1;
scan.nextLine();
String str1 = scan.nextLine();
String str2 = "";
for (int i = 1; i < n; i++... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 4b26853987c7588bd9aaa33224b3509a | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
int n = Integer.parseInt(cin.nextLine());
String c = "";
int r = 0;
for (int i = 0; i < n; i++) {
String input = cin.nextLine();
if (!input.equals(c))
r++;
c = input;
}... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 460e6965905370d28424c26a8bbf0c3b | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String args[]) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = t_int(br);
StringBuilder out = new StringBuilder();
while (n-- > 0) {
ou... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 9d4b12948d77c604302f15a04a6ec33a | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.Scanner;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
while(cin.hasNext()){
int numberOfMagnets = cin.nextInt();
char ultimoSigno='a';
int contador = 1;
for(int i=0;i<numberOfMagnets;i++){
String ma... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 3b8e097e1e5cc8555afe1ed89572ff0f | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class Main{
private static Scanner in = new Scanner(System.in);
private static int task;
private static String[] stArr;
private static int[] inArr;
private static void solve() {
int z = Integer.parseInt(in.nextLine());
int ... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | a24a168902c189a9c696dc03f19e5f58 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int z = Integer.parseInt(in.nextLine());
int cou = 1;
String[] dom = in.nextLine().split("");
String[] pol;
for (int i = 0; i < z - 1; i++) ... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 0bfec6d802016ced864ddc25aad08c7d | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.io.PrintWriter;
import java.util.Scanner;
public class n344A {
Scanner in;
PrintWriter out;
void solve() {
int n = in.nextInt();
in.nextLine();
StringBuilder sb = new StringBuilder("");
for (int i = 0; i < n; i++) {
sb.append(in.nextLine());
... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | b4ba6117eca422ed893e3ff7239056ce | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
int x = input.nextInt();
String s; int num = 1;
char[] c = new char[x+1];
for(int i = 1; i<= x; i++)
{
s = input.next(... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 698ef61075cc5e1b9c778763976de60e | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
/*
br = new BufferedReader(new FileReader("input.txt"));
pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
br = new BufferedReader(new InputStreamReade... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 13b902ad88017563aa68aedffa124419 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
public class taskA {
Scanner in;
PrintWriter out;
void solve() {
int n = in.nextInt();
int one = in.nextInt();
int two;
int col = 1;
for (int i = 1; i < n; i++) {
two = in.ne... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | fb79ec45437914bfaf13b0045287a125 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author jupiter
*/
import java.util.Scanner;
import java.math.BigInteger;
import java.util.Arrays;
public class main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 7d8c7a9640971f9d5eaa3dfc8c799d1e | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int N =Integer.parseInt(in.readLine());
int cant = 1;
int ant = ... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | df59d9db61fd7b8fdc0404748d7bffb0 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.io.*;
public class Main{
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int t=Integer.parseInt(br.readLine());
t--;
int d=1;
int a=Integ... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 038c0210ff5c84fcf6ce8d0b8c702dc3 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.Scanner;
public class CF200_Div2_A {
static Scanner sc=new Scanner(System.in);
public static void main(String[] args){
int n=sc.nextInt();
int ans=1;
String[] a=new String[n];
for(int i=0;i<n;i++)a[i]=sc.next();
for(int i=0;i<n-1;i++)if(!a[i].equals(a[i+1]))ans++;
System.out.println(a... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 698aa0481d950626b26ffb28299f2461 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.Scanner;
public class A {
/**
* @param args
*/
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int prev = in.nextInt();
int count = 1;
for (int i = 1; i < n; i++) {
int m = in.nex... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 6f480d42f65e8ac3b8fd08382feaf90a | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.io.*;
import java.util.*;
public class main
{
public static void main(String[] args) throws IOException
{
Scanner in = new Scanner(System.in);
int ans = 0;
int n = in.nextInt();
String prev = "";
for(int i = 0; i < n; i++)
{
String cur = in.next();
if(cur.compareTo(prev) != 0... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 23f7a75363871ba05ed0fd75fcf71568 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scanner e=new Scanner(System.in);
int n=e.nextInt();
int sw=0;
String aux="00";
int c=0;
e.nextLine();
for (int i = 0; i < n; i++)
{
String cad=e.nextLine();
//System.out.println("** "+i+" "+cad+" * "+aux+"... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 7ed7c591d93b525876c51296b6c4f984 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | /**
* @(#)Magnets.java
*
*
* @author
* @version 1.00 2013/10/17
*/
import java.util.Scanner;
public class Magnets {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
int k = 0;
int j;
int count = 0;
for (int i = 0; i < n... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | ecab751faee447d7cd51faaf16066cda | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.Scanner;
public class Magnets {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt(); s.nextLine();
StringBuilder str = new StringBuilder("");
for(int z = 0; z < n; z++){
str.append(s.nextLine());
}
... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 33bdcfe5c57886b4c1e633bf5b1e8f96 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.Scanner;
public class A344 {
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
String prev = "";
int ret = 0;
int n = in.nextInt();
for (int i = 0; i < n; i++)
{
String cur = in.next();
i... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 212fc7549e75997a0dfeefa74a7506cc | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.io.PrintWriter;
import java.util.Scanner;
public class A {
static Scanner in; static int next() throws Exception {return in.nextInt();};
// static StreamTokenizer in; static int next() throws Exception {in.nextToken(); return (int) in.nval;}
// static BufferedReader in;
static PrintWriter out;
... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 0444663d076bfe35e686017ea253de95 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.io.*;
import java.util.*;
public class A implements Runnable {
private void solve() throws IOException {
int n = nextInt();
String[] s = new String[n];
for (int i = 0; i < n; i++) s[i] = nextToken();
int ans = 1;
for (int i = 1; i < n; i++) if (s[i].charAt(0) == s[i-1].charAt(1)) ans++;
print... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | d93bedfade0bbe18171c09b8bd66e566 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.*;
public class Magnet {
static String pm = "01", mp = "10", bf = "00";
public static void main(String[] args) {
System.out.println(cal(args));
}
static int cal(String[] args) {
int group = 0;
Scanner in = new Scanner(System.in);
int num= in.nextInt();
if ... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 38c1b307d68a299db9bc102eb3f67432 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.io.*;
import java.util.*;
public class Magnets {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
try{
BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
PrintWri... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | aaeb88abf10fea0fc9e1ceabad6aaa0d | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.io.*;
public class Magnets {
/**
* @param args
*/
public static void main(String[] args) throws IOException{
// TODO Auto-generated method stub
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int n=Integer.parseInt(br.readLine());
if(n>=1&&n<=100000){
String []a=new... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 6012f1f02dbc5d5b8f8767ae8c9ad14d | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import static java.lang.System.out;
import java.util.Scanner;
import java.lang.StringBuilder;
public class Main2{
public static void main(String[] args){
Scanner kb = new Scanner(System.in);
int n = kb.nextInt();
String[] s = new String[n];
s[0] = kb.next();
int cnt = 0;
for(int i = 1; i < n; ... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 31c1140d092bd39754202448b2e0c388 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
public class Magnits {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int numberDataInArray = sc.nextInt();
StringBuilder data = new StringBuilder();
int countZero = 0;
... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | a187dcfc8d9db778808cebc1ba93b1a5 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.Scanner;
public class A {
public static void main(String[]args){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
String[]array=new String[n];
for(int i=0;i<n;i++)
array[i]=sc.next();
int count=1;
for(int i=0;i<n-1;i++){
if(!array[i].equals(array[i+1])... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 4e078e1642a593609369ac4304951f3d | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class MagnetMike {
public static int t = 0;
public static BufferedReader in;
public static StringTokenizer st;
public s... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 9da0af0578c47ed91bc6a3e5707c89c2 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.*;
public class A344 {
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int a[] = new int[n];
for (int i = 0; i < n; i++) {
a[i] = in.nextInt();
}
int count = 1;
for (int i = 1; i... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 433cf23e49e294420538baf81383d1b8 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.*;
public class Main{
public static void main(String[]args){
Scanner input=new Scanner(System.in);
int n=input.nextInt();int p=1;
int[]a=new int[n];
for(int i=0;i<n;i++){
a[i]=input.nextInt();
}
for(int i=0;i<n-1;i++){
if(a[i]==a[i+1]){continue;}
else{p++;}
}
System.out.println(p);... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | e5270a9ff2a23f486371a92d78c76fda | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
int [] x = new int[n];
x[0]=input.nextInt();
int count = 1 ;
for(int i=1 ;i<n; i++){
x[i]=input.nextInt();
if(x[i]!= x[i-1... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | d81dddee6cf10ff6edbd637b8813e250 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.*;
public class magnets {
public static void main(String[] agrs){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int number = in.nextInt();
int endPre = number % 10;
int start;
int count = 1;
for (int i = 0; i < n -1 ; i++)
{
number = in.nextInt();
start = number/10;... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | e3a51ce472a61aea76f2e7db1d339928 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.Scanner;
public class Problem344A {
public static void main(String[] args) throws Exception {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
String l=scanner.next();
int groups = 1;
for(int i=0; i<n-1; i++){
String m = scanner.next();
if(l.charAt(1)==m.charAt(0))... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 21c616d08e405c6f88dd39eb6a3165bd | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int ans =0;
String temp ="";
while(n-->=0){
String s = in.nextLine();
if(!temp.equals(s)){
... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 39969d98aa209849c0d43faf97c49fd0 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.Scanner;
public class JavaApplication1 {
public static void main(String[] args) {
Scanner scanner = new Scanner( System.in );
int n = scanner.nextInt();
int count=0;
String last=scanner.nextLine();
String temp;
for (int i=0;i<n;i++){
tem... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | fd313b94bdf4d35f37768a08c36e96b0 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.io.*;
import java.util.*;
public class Smile {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
int ans = n;
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = in.nextInt();
}
... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 608169f9d5e2bec786fee73617e6c80c | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes |
import java.io.*;
import java.util.*;
public final class TestClass{
static ArrayList<String> arr1 = new ArrayList<String>();
static ArrayList<Integer> arr2 = new ArrayList<Integer>();
public static void main(String[] args) throws Exception{
BufferedReader br = new BufferedReader(new InputStrea... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 5bf98eab870671e2872498deb3c1e407 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.io.*;
public class Contest200A {
public static void main(String[] args) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
//BufferedReader in = new BufferedReader(new FileReader("200A.in"));
int count = 1;
char current = '9';
int n = Integer.parseIn... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | bb8334d12513add45ae69f0324db9323 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.*;
import java.io.*;
public class cfa {
static long mod = 1000000009;
static class Pair1 implements Comparable<Pair1>
{
int a, b, i;
public Pair1(int aa, int bb, int ii)
{
a = aa; b = bb; i = ii;
}
@Override
public int compareTo(P... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | e7b844de48ac1223c1a8216d74870a7c | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.io.PrintWriter;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
String[] m = new String[n];
int cnt = 1;
for (... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 6b0e6cd320ea52487120886caf6ea885 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class A {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in))... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 32e65c67e915160ce007d1c9216687ab | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int n , ans=1;
Scanner input = new Scanner(System.in);
n=input.nextInt();
String arr[]=new String[n];
for(int i=0 ; i<n ; i++){
String st;
st=input.next();
arr[i]=... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 503cae218ff769394561eaa42a01d1f8 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int ans = 1;
int a = 0, b = 0;
b = sc.nextInt();
for (int i = 0; i < n-1; i++) {
a = sc.nextInt();
if(a != b){
ans++;
}
b = a;
}
System.out.pri... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 9293e682552a8329e91341b695290e82 | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes |
import java.io.*;
import java.util.*;
import java.lang.*;
import java.math.*;
import static java.lang.Math.*;
public class Solution implements Runnable {
public void solve() throws Exception {
int n = sc.nextInt();
int lst = -1;
int ans = 0;
while (n-- > 0){
... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output | |
PASSED | 0f1028f05fc0d06411676689be5d0afd | train_002.jsonl | 1379172600 | Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo... | 256 megabytes | import java.io.*;
import java.util.*;
public class _344_A implements Runnable {
private BufferedReader br = null;
private PrintWriter pw = null;
private StringTokenizer stk = new StringTokenizer("");
public static void main(String[] args) {
new Thread(new _344_A()).run();
// TODO Auto... | Java | ["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"] | 1 second | ["3", "2"] | NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets. | Java 6 | standard input | [
"implementation"
] | 6c52df7ea24671102e4c0eee19dc6bba | The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position. | 800 | On the single line of the output print the number of groups of magnets. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.