CF - Magic Ship

Author: Kevin Sheng

Official Editorial

C++

#include <iostream>
#include <vector>
#include <string>
#include <cmath>
using std::cin;
using std::cout;
using std::endl;
bool reachable(std::pair<long long, long long> start,

Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
/**
* https://codeforces.com/problemset/problem/1117/C
* 0 0
* 4 6
* 3

Python

"""
0 0
4 6
3
UUU should output 5
0 3
0 0
3
UDD should output 3

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!