-
-
Save tanzaku/4f38cb4feba9bb27f2674a816f235e08 to your computer and use it in GitHub Desktop.
SRM 736 Div1 Med
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.util.*; | |
public class MinDegreeSubgraph { | |
public String exists(int n, long m, int k) { | |
if (n > k && (k-1L)*(n-k-1)+k*(k+1L)/2-1 < m) { | |
return "ALL"; | |
} | |
if (k*(k+1L)/2 <= m && k+1 <= n) { | |
return "SOME"; | |
} | |
return "NONE"; | |
} | |
static void dump(Object... o) { System.err.println(Arrays.deepToString(o)); } | |
static void swap(int[] xs, int i, int j) { int t = xs[i]; xs[i] = xs[j]; xs[j] = t; } | |
static void swap(long[] xs, int i, int j) { long t = xs[i]; xs[i] = xs[j]; xs[j] = t; } | |
static long gcd(long n, long r) { return r == 0 ? n : gcd(r, n % r); } | |
static long lcm(long n, long r) { return n / gcd(n, r) * r; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment