USACO Silver 2020 Feburary - Swapity Swap Swap

Author: Qi Wang

Official Analysis

Time Complexity: O(NM)\mathcal{O}(NM)

Java

Java Implementation

import java.util.*;
import java.io.*;
public class swapswap {
static int N, M, K;
static int[] f;
static int[] P, A;
static boolean[] vis;
static List<Integer> c = new ArrayList<>();
static Queue<Integer> q = new LinkedList<>();

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!