AtCoder Beginner Contest 002

Submission #4342766

Source codeソースコード

#include <bits/stdc++.h>
#include <bitset>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef vector<vector<int> > vvi;
typedef vector<int> vi;
typedef vector<string> vst;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
 
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);  


    int n,m;
    cin >> n >> m;
    vvi tmp(n,vi(n,0));
    REP(i,m) {
        int x,y;
        cin >> x >> y;
        x--;y--;
        tmp[x][y] = tmp[y][x] = 1;
    }
    REP(i,n)tmp[i][i] = 1;

    int maxi=0;

    REP(i,1<<n){
        vi id;
        REP(j,n) if(i & (1<<j)) id.pb(j);

        bool f=true;
        REP(j,id.size()){
            REP(k,id.size()){
                if(tmp[id[j]][id[k]]==0) f=false;
            }
        }
        if(f)maxi=max(maxi,(int)id.size());
    }

    cout << maxi << endl;
    
    return 0;
}

Submission

Task問題 A - 正直者
User nameユーザ名 yukitovn7
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 RE
Score得点 0
Source lengthソースコード長 1310 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 TLE
kensho_diff03 RE
kensho_diff04 RE
kensho_diff05 RE
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 RE
kensho_rand09 RE
kensho_rand10 RE