AtCoder Beginner Contest 002

Submission #7052043

Source codeソースコード

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		final int M = sc.nextInt();

		final int friendLength = N*(N-1)/2;
		final boolean[] isFriend = new boolean[friendLength];
		for (int i = 0; i < M; i++) {
			int xi = sc.nextInt();
			int yi = sc.nextInt();
			isFriend[(2*N-xi-2)*(xi-1)/2 + yi-2] = true;
		}
		sc.close();

		int intOut = 1;
		int x;
		int y;
		A: for(int bitNumber = 1; bitNumber <= (1 << N) - 1; bitNumber++){
			int groupL = Integer.bitCount(bitNumber);
			if(groupL <= intOut){
				continue;
			}

			boolean flag = true;
			for(x = 0; x <= N - 2; x++){
				for(y = x + 1; y <= N - 1; y++){
					if(((bitNumber >> x) & (bitNumber >> y) & 1) == 1){
						if(!isFriend[(2*N-x-3)*x/2 + y-1]){
							flag = false; continue A;
						}
					}
				}
			}
			if(flag){
				intOut = groupL;
			}

		}

		String strOut = Integer.toString(intOut);
		System.out.println(strOut);
	}
}

Submission

Task問題 A - 正直者
User nameユーザ名 こーへー
Created time投稿日時
Language言語 Java8 (OpenJDK 1.8.0)
Status状態 RE
Score得点 0
Source lengthソースコード長 1050 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
all 0 / 100 00_sample_01.txt,00_sample_02.txt,kensho_diff01,kensho_diff02,kensho_diff03,kensho_diff04,kensho_diff05,kensho_min-max01,kensho_min-max02,kensho_min-max03,kensho_min-max04,kensho_min-max05,kensho_min-max06,kensho_min-max07,kensho_min-max08,kensho_min-max09,kensho_min-max10,kensho_rand01,kensho_rand02,kensho_rand03,kensho_rand04,kensho_rand05,kensho_rand06,kensho_rand07,kensho_rand08,kensho_rand09,kensho_rand10

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00_sample_01.txt RE
00_sample_02.txt RE
kensho_diff01 MLE
kensho_diff02 RE
kensho_diff03 MLE
kensho_diff04 RE
kensho_diff05 MLE
kensho_min-max01 RE
kensho_min-max02 RE
kensho_min-max03 RE
kensho_min-max04 RE
kensho_min-max05 RE
kensho_min-max06 RE
kensho_min-max07 RE
kensho_min-max08 RE
kensho_min-max09 RE
kensho_min-max10 RE
kensho_rand01 RE
kensho_rand02 RE
kensho_rand03 RE
kensho_rand04 RE
kensho_rand05 RE
kensho_rand06 RE
kensho_rand07 RE
kensho_rand08 MLE
kensho_rand09 MLE
kensho_rand10 MLE