Submission #3932102


Source Code Expand

#include <algorithm>
#include <bitset>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int v, e, k; cin >> v >> e >> k;
  vector<vector<int> > edge(v);
  REP(i, e) {
    int a, b; cin >> a >> b;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  for (int mask = 0; mask < (1 << v); ++mask) {
    int choice = 0;
    vector<int> ans;
    map<int, bool> mp;
    REP(i, v) if (mask & (1 << i)) {
      ++choice;
      ans.push_back(i);
      mp[i] = true;
    }
    if (choice != k) continue;
    bool is_ok = true;
    for (int an : ans) {
      for (int ed : edge[an]) {
        if (mp[ed]) is_ok = false;
      }
    }
    if (!is_ok) continue;
    for (int an : ans) cout << an << '\n';
    return 0;
  }
}

Submission Info

Submission Time
Task B - B 問題
User emthrm
Language C++14 (GCC 5.4.1)
Score 12
Code Size 1343 Byte
Status WA
Exec Time 490 ms
Memory 256 KB

Judge Result

Set Name All asi1024 atetubou climpet DEGwer evima flowlight hogloid ichyo math miki_im natsugiri piroz95 semiexp sigma425 sky58 snuke tozangezan wo01 yosupo zerokugi
Score / Max Score 10 / 10 0 / 2 0 / 2 0 / 2 0 / 2 0 / 2 0 / 2 0 / 2 0 / 2 0 / 2 0 / 2 0 / 2 0 / 2 0 / 2 2 / 2 0 / 2 0 / 2 0 / 2 0 / 2 0 / 2 0 / 2
Status
AC × 33
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
AC × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
Set Name Test Cases
All 00_sample_1.txt, 00_sample_2.txt, 00_sample_3.txt, 20_random_1.txt, 20_random_10.txt, 20_random_11.txt, 20_random_12.txt, 20_random_13.txt, 20_random_14.txt, 20_random_15.txt, 20_random_16.txt, 20_random_17.txt, 20_random_18.txt, 20_random_19.txt, 20_random_2.txt, 20_random_20.txt, 20_random_21.txt, 20_random_22.txt, 20_random_23.txt, 20_random_24.txt, 20_random_25.txt, 20_random_26.txt, 20_random_27.txt, 20_random_28.txt, 20_random_29.txt, 20_random_3.txt, 20_random_30.txt, 20_random_4.txt, 20_random_5.txt, 20_random_6.txt, 20_random_7.txt, 20_random_8.txt, 20_random_9.txt
asi1024 31_asi1024.txt
atetubou 32_atetubou.txt
climpet 33_climpet.txt
DEGwer 34_DEGwer.txt
evima 35_evima.txt
flowlight 36_flowlight.txt
hogloid 37_hogloid.txt
ichyo 38_ichyo.txt
math 39_math.txt
miki_im 40_miki_im.txt
natsugiri 41_natsugiri.txt
piroz95 42_piroz95.txt
semiexp 43_semiexp.txt
sigma425 44_sigma425.txt
sky58 45_sky58.txt
snuke 46_snuke.txt
tozangezan 47_tozangezan.txt
wo01 48_wo01.txt
yosupo 49_yosupo.txt
zerokugi 50_zerokugi.txt
Case Name Status Exec Time Memory
00_sample_1.txt AC 1 ms 256 KB
00_sample_2.txt AC 1 ms 256 KB
00_sample_3.txt AC 1 ms 256 KB
20_random_1.txt AC 1 ms 256 KB
20_random_10.txt AC 1 ms 256 KB
20_random_11.txt AC 1 ms 256 KB
20_random_12.txt AC 1 ms 256 KB
20_random_13.txt AC 1 ms 256 KB
20_random_14.txt AC 1 ms 256 KB
20_random_15.txt AC 4 ms 256 KB
20_random_16.txt AC 1 ms 256 KB
20_random_17.txt AC 1 ms 256 KB
20_random_18.txt AC 2 ms 256 KB
20_random_19.txt AC 1 ms 256 KB
20_random_2.txt AC 1 ms 256 KB
20_random_20.txt AC 3 ms 256 KB
20_random_21.txt AC 9 ms 256 KB
20_random_22.txt AC 1 ms 256 KB
20_random_23.txt AC 387 ms 256 KB
20_random_24.txt AC 1 ms 256 KB
20_random_25.txt AC 2 ms 256 KB
20_random_26.txt AC 1 ms 256 KB
20_random_27.txt AC 10 ms 256 KB
20_random_28.txt AC 1 ms 256 KB
20_random_29.txt AC 44 ms 256 KB
20_random_3.txt AC 1 ms 256 KB
20_random_30.txt AC 1 ms 256 KB
20_random_4.txt AC 1 ms 256 KB
20_random_5.txt AC 2 ms 256 KB
20_random_6.txt AC 2 ms 256 KB
20_random_7.txt AC 21 ms 256 KB
20_random_8.txt AC 22 ms 256 KB
20_random_9.txt AC 1 ms 256 KB
31_asi1024.txt WA 1 ms 256 KB
32_atetubou.txt WA 1 ms 256 KB
33_climpet.txt WA 1 ms 256 KB
34_DEGwer.txt WA 2 ms 256 KB
35_evima.txt WA 1 ms 256 KB
36_flowlight.txt WA 1 ms 256 KB
37_hogloid.txt WA 1 ms 256 KB
38_ichyo.txt WA 1 ms 256 KB
39_math.txt WA 1 ms 256 KB
40_miki_im.txt WA 1 ms 256 KB
41_natsugiri.txt WA 2 ms 256 KB
42_piroz95.txt WA 2 ms 256 KB
43_semiexp.txt WA 2 ms 256 KB
44_sigma425.txt AC 1 ms 256 KB
45_sky58.txt WA 2 ms 256 KB
46_snuke.txt WA 2 ms 256 KB
47_tozangezan.txt WA 2 ms 256 KB
48_wo01.txt WA 490 ms 256 KB
49_yosupo.txt WA 1 ms 256 KB
50_zerokugi.txt WA 2 ms 256 KB