結果

問題 No.5001 排他的論理和でランニング
ユーザー WrongAcceptWrongAccept
提出日時 2020-08-10 15:48:26
言語 Java21
(openjdk 21)
結果
AC  
実行時間 395 ms / 1,500 ms
コード長 8,694 bytes
コンパイル時間 2,803 ms
実行使用メモリ 31,204 KB
スコア 18,209,565
最終ジャッジ日時 2020-08-10 15:48:46
ジャッジサーバーID
(参考情報)
judge7 / judge9
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 326 ms
30,728 KB
testcase_01 AC 200 ms
27,116 KB
testcase_02 AC 221 ms
27,732 KB
testcase_03 AC 267 ms
30,428 KB
testcase_04 AC 343 ms
30,740 KB
testcase_05 AC 261 ms
28,992 KB
testcase_06 AC 236 ms
28,076 KB
testcase_07 AC 256 ms
28,828 KB
testcase_08 AC 372 ms
31,112 KB
testcase_09 AC 174 ms
26,764 KB
testcase_10 AC 244 ms
29,028 KB
testcase_11 AC 272 ms
30,432 KB
testcase_12 AC 214 ms
27,364 KB
testcase_13 AC 365 ms
31,128 KB
testcase_14 AC 283 ms
30,548 KB
testcase_15 AC 246 ms
28,656 KB
testcase_16 AC 216 ms
27,528 KB
testcase_17 AC 234 ms
28,336 KB
testcase_18 AC 301 ms
30,516 KB
testcase_19 AC 234 ms
28,140 KB
testcase_20 AC 221 ms
27,392 KB
testcase_21 AC 234 ms
28,480 KB
testcase_22 AC 198 ms
27,048 KB
testcase_23 AC 200 ms
27,028 KB
testcase_24 AC 206 ms
27,172 KB
testcase_25 AC 257 ms
28,084 KB
testcase_26 AC 223 ms
27,736 KB
testcase_27 AC 217 ms
27,320 KB
testcase_28 AC 278 ms
30,612 KB
testcase_29 AC 295 ms
30,560 KB
testcase_30 AC 215 ms
27,500 KB
testcase_31 AC 286 ms
30,564 KB
testcase_32 AC 234 ms
28,352 KB
testcase_33 AC 395 ms
31,176 KB
testcase_34 AC 359 ms
31,204 KB
testcase_35 AC 277 ms
30,572 KB
testcase_36 AC 324 ms
30,676 KB
testcase_37 AC 255 ms
29,144 KB
testcase_38 AC 228 ms
27,900 KB
testcase_39 AC 261 ms
30,392 KB
testcase_40 AC 244 ms
28,664 KB
testcase_41 AC 218 ms
27,508 KB
testcase_42 AC 259 ms
30,396 KB
testcase_43 AC 271 ms
30,472 KB
testcase_44 AC 286 ms
30,668 KB
testcase_45 AC 302 ms
30,668 KB
testcase_46 AC 249 ms
28,532 KB
testcase_47 AC 242 ms
28,664 KB
testcase_48 AC 229 ms
27,988 KB
testcase_49 AC 344 ms
30,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Deque;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Random;
import java.util.Scanner;
class BIT{
	int bit[]=new int[0];
	int N=0;
	BIT(int n){
		bit=new int[n+1];
		N=n;
	}
	void add(int a,int w) {
		for(int x=a;x<=N;x+=x&-x) bit[x]+=w;
	}
	int sum(int a) {
		int ret=0;
		for(int x=a;x>0;x-=x&-x)ret+=bit[x];
		return ret;
	}
}
class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}
	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}
	public char nextchar() {
		return next().charAt(0);
	}
}

class UnionFind {
	int Parent[];
	UnionFind(int n) {// Initialize by -1
		Parent = new int[n];
		Arrays.fill(Parent, -1);
	}
	int root(int A) {// In which tree is A?
		if (Parent[A] < 0)
			return A;
		return Parent[A] = root(Parent[A]);
	}
	int size(int A) {// size of tree which is include A
		return -Parent[root(A)];
	}
	boolean connect(int A, int B) {// Connect A and B
		A = root(A);
		B = root(B);
		if (A == B)
			return false;
		if (size(A) < size(B)) {
			int C = 0;
			C = B;
			B = A;
			A = C;
		} // SWAP
		Parent[A] += Parent[B];
		Parent[B] = A;
		return true;
	}
}

class Pair<T, E> {
	public T first;
	public E second;
	void set(T x, E y) {
		first = x;
		second = y;
	}
}

class Pint {
	public int first;
	public int second;
	Pint(int x, int y) {
		first = x;
		second = y;
	}
	void set(int x, int y) {
		first = x;
		second = y;
	}
}

class Tpair {
	public int first;
	public int second;
	public long third;
	Tpair(int x, int y, long z) {
		first = x;
		second = y;
		third = z;
	}
	void set(int x, int y, long z) {
		first = x;
		second = y;
		third = z;
	}
}

public class Main {
	static FastScanner scan = new FastScanner();
	static Scanner scanner = new Scanner(System.in);
	static Random rand = new Random();
	static long mod = 1000000007;
	static double eps = 1.0E-14;
	static int big = Integer.MAX_VALUE;
	static double PI = 3.141592653589793;
	static long modlcm(long a, long b) {
		return a * b * modinv(GCD(a, b), mod);
	}
	static long GCD(long a, long b) {
		return b > 0 ? GCD(b, a % b) : a;
	}
	static long lcm(long a, long b) {
		return a * b / GCD(a, b);
	}
	static int min(int a, int b) {
		return a < b ? a : b;
	}
	static long factorial(int i) {
		return i == 1 ? 1 : i * factorial(i - 1);
	}
	static int max(int... i) {
		int x = i[0];
		for (int e : i)
			x = Math.max(x, e);
		return x;
	}
	static int min(int... i) {
		int x = i[0];
		for (int e : i)
			x = Math.min(x, e);
		return x;
	}
	static long gcd(long... i) {
		long x = i[0];
		for (long e : i)
			x = GCD(x, e);
		return x;
	}
	static long lmax(long... i) {
		long x = i[0];
		for (long e : i)
			x = Math.max(x, e);
		return x;
	}
	static long lmin(long... i) {
		long x = i[0];
		for (long e : i)
			x = Math.min(x, e);
		return x;
	}
	static long nCr(long n, long r, long m) {
		long ans = 1;
		for (long i = 0; i < r; i++) {
			ans *= (n - i);
			ans %= m;
		}
		for (long i = 0; i <= r; i++) {
			ans *= modinv(i, m);
			ans %= mod;
		}
		return ans;
	}
	static int lower_bound(int[] b, long cost) {
		int ok = b.length;
		int ng = -1;
		while (Math.abs(ok - ng) > 1) {
			int mid = (ok + ng) / 2;
			if (b[mid] >= cost)
				ok = mid;
			else
				ng = mid;
		}
		return ok;
	}
	static int upper_bound(int[] b, int cost) {
		int ok = b.length;
		int ng = -1;
		while (Math.abs(ok - ng) > 1) {
			int mid = (ok + ng) / 2;
			if (b[mid] > cost)
				ok = mid;
			else
				ng = mid;
		}
		return ok;
	}
	static boolean isPrime(long n) {
		if (n == 2)
			return true;
		if (n < 2 || n % 2 == 0)
			return false;
		double d = Math.sqrt(n);
		for (int i = 3; i <= d; i += 2)
			if (n % i == 0) {
				return false;
			}
		return true;
	}
	static int upper_division(int a, int b) {
		if (a % b == 0) {
			return a / b;
		} else {
			return a / b + 1;
		}
	}
	static long lupper_division(long a, long b) {
		if (a % b == 0) {
			return a / b;
		} else {
			return a / b + 1;
		}
	}
	static int[] setArray(int a) {
		int b[] = new int[a];
		for (int i = 0; i < a; i++) {
			b[i] = scan.nextInt();
		}
		return b;
	}
	static long[] lsetArray(int a) {
		long b[] = new long[a];
		for (int i = 0; i < a; i++) {
			b[i] = scan.nextLong();
		}
		return b;
	}
	static String reverse(String str) {
		char ch[] = new char[str.length()];
		char chch[] = str.toCharArray();
		int a = str.length();
		for (int i = 0; i < upper_division(a, 2); i++) {
			ch[i] = chch[ch.length - i - 1];
			ch[ch.length - 1 - i] = chch[i];
		}
		return String.valueOf(ch);
	}
	public static void printArray(int[] que) {
		for (int i = 0; i < que.length - 1; i++) {
			System.out.print(que[i] + " ");
		}
		System.out.println(que[que.length - 1]);
	}
	public static void lprintArray(long[] que) {
		for (int i = 0; i < que.length - 1; i++) {
			System.out.print(que[i] + " ");
		}
		System.out.println(que[que.length - 1]);
	}
	public static int[][] doublesort(int[][] a) {
		Arrays.sort(a, (x, y) -> Integer.compare(x[0], y[0]));
		return a;
	}
	public static long[][] ldoublesort(long[][] a) {
		Arrays.sort(a, (x, y) -> Long.compare(x[0], y[0]));
		return a;
	}
	static long modpow(long x, long n, long mo) {
		long sum = 1;
		while (n > 0) {
			if ((n & 1) == 1) {
				sum = sum * x % mo;
			}
			x = x * x % mo;
			n >>= 1;
		}
		return sum;
	}
	public static char[] revch(char ch[]) {
		char ret[] = new char[ch.length];
		for (int i = ch.length - 1, j = 0; i >= 0; i--, j++) {
			ret[j] = ch[i];
		}
		return ret;
	}
	public static int[] revint(int ch[]) {
		int ret[] = new int[ch.length];
		for (int i = ch.length - 1, j = 0; i >= 0; i--, j++) {
			ret[j] = ch[i];
		}
		return ret;
	}
	public static void warshall_floyd(long v[][]) {
		int n=v[0].length;
		for (int k = 0; k < n; k++)
			for (int i = 0; i < n; i++)
				for (int j = 0; j < n; j++)
					v[i][j] = lmin(v[i][j], v[i][k] + v[k][j]);
	}
	public static long modinv(long a, long m) {
		long b = m, u = 1, v = 0;
		while (b != 0) {
			long t = a / b;
			a -= t * b;
			long x = a;
			a = b;
			b = x;
			u -= t * v;
			x = u;
			u = v;
			v = x;
		}
		u %= m;
		if (u < 0)
			u += m;
		return u;
	}
	public static long lmod(long i, long j) {
	    return (i%j)<0?(i%j)+0+(j<0?-j:j):(i%j+0);
	}
	public static int next_combination(int sub) {
	    int x = sub & -sub, y = sub + x;
	    return (((sub & ~y) / x) >> 1) | y;
	}
	public static char[][] kaiten(char ch[][]){
		char t[][]=new char[ch.length][ch.length];
		for(int i=0;i<ch.length;i++) {
			for(int j=0;j<ch.length;j++) {
				t[i][j]=ch[j][ch.length-i-1];
			}
		}
		return t;
	}

	public static int keisan(char ch[][],char t[][]){
		int cnt=0;
		for(int i=0;i<ch.length;i++) {
			for(int j=0;j<ch.length;j++) {
				if(ch[i][j]!=t[i][j])cnt++;
			}
		}
		return cnt;
	}
	public static void main(String[] $) throws IOException{
		int n=scan.nextInt();
		int m=scan.nextInt();
		int a[]=setArray(n);
		Arrays.sort(a);
		for(int i=0;i<m-1;i++) {
			System.out.print(a[i]+" ");
		}
		System.out.println(a[m-1]);
	}
}
0