AtCoder Beginner Contest 002

Submission #4342644

Source codeソースコード

#include <bits/stdc++.h>
#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};


struct k{
    int s,e;
};

bool asc( const k& left, const k& right ) {
    return left.s == right.s ? left.e < right.e : left.s < right.s;
}



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

    int maxi=0;

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

        bool f=true;
        REP(j,a.size()){
            REP(k,a.size()){
                if(tmp[a[j]][a[k]]==0) f=false;
            }
        }
        if(f)maxi=(maxi<(int)a.size())?(int)a.size():maxi;
    }

    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ソースコード長 1375 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 TLE
kensho_diff01 RE
kensho_diff02 TLE
kensho_diff03 RE
kensho_diff04 RE
kensho_diff05 RE
kensho_min-max01 WA
kensho_min-max02 WA
kensho_min-max03 RE
kensho_min-max04 RE
kensho_min-max05 WA
kensho_min-max06 RE
kensho_min-max07 WA
kensho_min-max08 WA
kensho_min-max09 WA
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