USACO Bronze 2018 February - Teleportation
Authors: Ananth Kashyap, Tanmoy Das, Thamognya Kodi
Implementation
Time Complexity:
Python
# Take in data using Python file i/o systemfile_in = open("teleport.in")data = file_in.read().strip().split("\n")a, b, x, y = map(int, data[0].split(" "))# Manually sort a, b to be increasing orderif a > b:a, b = b, a# Manually sort x, y to be increasing order
Java
import java.io.*;public class Teleportation {public static void main(String[] args) throws IOException {BufferedReader r = new BufferedReader(new FileReader("teleport.in"));PrintWriter pw = new PrintWriter("teleport.out");String[] input = r.readLine().split(" ");int a = Integer.parseInt(input[0]);int b = Integer.parseInt(input[1]);
C++
#include <bits/stdc++.h>using namespace std;int main() {freopen("teleport.in", "r", stdin);freopen("teleport.out", "w", stdout);int a, b, c, d;cin >> a >> b >> c >> d;/*
Join the USACO Forum!
Stuck on a problem, or don't understand a module? Join the USACO Forum and get help from other competitive programmers!