AtCoder Beginner Contest 002

Submission #1772432

Source codeソースコード

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main()
{
  int N, M;
  int x, y;
  int result = 1;

  cin >> N >> M;
  int friends[N][N];

  for(int i=0; i<N; i++)for(int j=0; j<N; j++)
    friends[i][j] = 0;

  for(int i=0; i<M; i++){
    cin >> x >> y;
    friends[x][y] = friends[x][y] = 1;
  }

for(int i=0; i<(1<<N); i++){
  bool ok = true;
  for(int j=0; j<N; j++)for(int k=0; k<N; k++){
    if(((i >> j) & 1) & ((i >> k) & 1) )
      if(friends[j][k] != friends[k][j]) ok = false;
  }

  if(ok) result = max(result, __builtin_popcount(i));
}

  cout << result << endl;

  return 0;
}

Submission

Task問題 A - 正直者
User nameユーザ名 minagawawa
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 RE
Score得点 0
Source lengthソースコード長 683 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 RE
kensho_diff02 RE
kensho_diff03 RE
kensho_diff04 RE
kensho_diff05 RE
kensho_min-max01 RE
kensho_min-max02 RE
kensho_min-max03 TLE
kensho_min-max04 TLE
kensho_min-max05 RE
kensho_min-max06 TLE
kensho_min-max07 RE
kensho_min-max08 RE
kensho_min-max09 RE
kensho_min-max10 TLE
kensho_rand01 RE
kensho_rand02 RE
kensho_rand03 RE
kensho_rand04 RE
kensho_rand05 RE
kensho_rand06 RE
kensho_rand07 RE
kensho_rand08 RE
kensho_rand09 RE
kensho_rand10 RE