Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- public class Main {
- static BufferedReader br; static FileWriter fw; static PrintWriter pw; static StringTokenizer st;
- static String next () throws IOException {
- while (st == null || !st.hasMoreTokens())
- st = new StringTokenizer(br.readLine().trim());
- return st.nextToken();
- }
- static long readLong () throws IOException {
- return Long.parseLong(next());
- }
- static int readInt () throws IOException {
- return Integer.parseInt(next());
- }
- static short readShort () throws IOException {
- return Short.parseShort(next());
- }
- static double readDouble () throws IOException {
- return Double.parseDouble(next());
- }
- static char readChar () throws IOException {
- return next().charAt(0);
- }
- static String readLine () throws IOException {
- return br.readLine().trim();
- }
- static void init(int n) {
- adj = new ArrayList[n];
- for(int i = 0; i < n; i++) {
- adj[i] = new ArrayList<>();
- }
- }
- static class Pair implements Comparable<Pair>{
- int x; int y; boolean isValid = true;
- public Pair(int a, int b) {
- x = a; y = b;
- }
- public String toString() {
- return ("("+x+", "+y+")");
- }
- @Override
- public boolean equals(Object c) {
- if(c == null) return false;
- Pair t = (Pair) c;
- if(t.x == x && t.y == y) return true;
- return false;
- }
- public int compareTo(Pair a) {
- if(a.x==x) {
- return -Integer.compare(y, a.y);
- }
- return Integer.compare(x, a.x);
- }
- }
- static class Edge implements Comparable<Edge>{
- int u, v, w;
- public Edge(int u, int v) {
- this.u = u; this.v = v; this.w = 1;
- }
- public Edge(int u, int v, int w) {
- this.u = u; this.v = v; this.w = w;
- }
- public String toString() {
- return "Edge from "+u+" to "+v+" with weight "+w;
- }
- public int compareTo(Edge e) {
- return Integer.compare(w,e.w);
- }
- }
- public static void main(String[] args) throws IOException{
- if(dmoj) {
- br = new BufferedReader(new InputStreamReader(System.in));
- pw = new PrintWriter(System.out);
- }
- else {
- //Configure output here
- br = new BufferedReader(new FileReader("input.txt"));
- fw = new FileWriter("output.txt");
- pw = new PrintWriter(fw);
- }
- if(doCases) {
- int t = readInt();
- for(int i = 0; i < t; i++) {
- solve();
- }
- }
- else solve();
- pw.close();
- }
- //------------------------------------------------------------
- static boolean doCases = false; static boolean dmoj = true;
- static List<Pair> adj[];
- static void solve() throws IOException {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement