| 1 | package structures; |
| 2 | |
| 3 | public class LongPair implements Comparable<LongPair>{ |
| 4 | |
| 5 | public LongPair(long a_, long b_){ |
| 6 | a=a_; |
| 7 | b=b_; |
| 8 | } |
| 9 | |
| 10 | public LongPair(){} |
| 11 | |
| 12 | public long min() {return Math.min(a, b);} |
| 13 | public long max() {return Math.max(a, b);} |
| 14 | public long sum() {return a+b;} |
| 15 | |
| 16 | @Override |
| 17 | public int compareTo(LongPair other) { |
| 18 | if(a!=other.a){return a>other.a ? 1 : -1;} |
| 19 | return b>other.b ? 1 : b<other.b ? -1 : 0; |
| 20 | } |
| 21 | |
| 22 | public long a, b; |
| 23 | |
| 24 | } |