This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Comparator; | |
import java.util.PriorityQueue; | |
public class MahdiJumping { | |
public long minDis(int n, int A, int B, int a, int b) { | |
long[] dist = new long[n]; | |
for (int i = 0; i < n; i++) { | |
dist[i] = Long.MAX_VALUE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.junit.Before; | |
import org.junit.Test; | |
import static org.junit.Assert.*; | |
public class MahdiJumpingTest { | |
private MahdiJumping sut; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package codeforces.contests1101_1200.problemset1108; | |
import java.util.HashMap; | |
import java.util.Map; | |
class Solution { | |
private class DisjointSet { | |
private int[] root, size; | |
private DisjointSet(int n) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution { | |
private class DisjointSet { | |
private int[] root, size; | |
private DisjointSet(int n) { | |
root = new int[n]; | |
size = new int[n]; | |
for (int i = 0; i < n; i++) { | |
root[i] = i; | |
size[i] = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Comparator; | |
import java.util.PriorityQueue; | |
import java.util.Scanner; | |
class GFG { | |
private PriorityQueue<Integer> min = new PriorityQueue<>(), max = new PriorityQueue<>(Comparator.reverseOrder()); | |
public int findRunningMedian(int a) { | |
min.add(a); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void buildGraph() { | |
int n = grid.length; | |
for (int i = 0; i < n; i++) { | |
for (int j = i + 1; j < n; j++) { | |
if (grid[i][j] == -1 || grid[j][i] == -1) continue; | |
if (grid[i][j] == grid[j][i]) { | |
if (grid[i][j] == 0) { | |
imply(2 * i, not(2 * j)); | |
imply(2 * j, not(2 * i)); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedReader; | |
import java.io.Closeable; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import java.io.PrintWriter; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.StringTokenizer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Read { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
int x = sc.nextInt(), y = sc.nextInt(); | |
System.out.println("x + y = " + (x + y)); | |
sc.close(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class MyClass { | |
public static void main(String args[]) { | |
Scanner sc = new Scanner(System.in); | |
System.out.println("Vyvedete a"); | |
double a = sc.nextDouble(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedReader; | |
import java.io.Closeable; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import java.io.PrintWriter; | |
import java.util.ArrayList; | |
import java.util.Comparator; | |
import java.util.List; |