Submission #970837

#TimeUsernameProblemLanguageResultExecution timeMemory
970837hariaakas646Bosses (BOI16_bosses)C++17
Compilation error
0 ms0 KiB
#pragma GCC optimize("O3","unroll-loops") #include <bits/stdc++.h> using namespace std; #define scd(t) scanf("%d", &t) #define sclld(t) scanf("%lld", &t) #define forr(i, j, k) for (int i = j; i < k; i++) #define frange(i, j) forr(i, 0, j) #define all(cont) cont.begin(), cont.end() #define mp make_pair #define pb push_back #define f first #define s second typedef long long int lli; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<bool> vb; typedef vector<lli> vll; typedef vector<string> vs; typedef vector<pii> vii; typedef vector<vi> vvi; typedef map<int, int> mpii; typedef set<int> seti; typedef multiset<int> mseti; typedef long double ld; void usaco() { freopen("/media/hariaakash646/785EF1075EF0BF46/CompetitiveProgramming/input.in", "r", stdin); // freopen("problem.out", "w", stdout); } vvi graph; vvi tree; vb vis; int tot = 0; int dfs(int x) { int v = 1; for(auto e : tree[x]) { v += dfs(e); } tot += v; return v; } int main() { // usaco(); int n; scd(n); graph = vvi(n+1); forr(i, 1, n+1) { int k; scd(k); frange(_, k) { int b; scd(b); graph[b].pb(i); } } int mi = 2e9; forr(i, 1, n+1) { vis = vb(n+1); tree = vvi(n+1); queue<pii> q; q.push(mp(i, 0)); while(q.size()) { auto p = q.front(); q.pop(); if(vis[p.f]) continue; vis[p.f] = true; tree[p.s].pb(p.f); for(auto e : graph[p.f]) {if(vis[e]) continue; q.push(mp(e, p.f));} } if(done) { tot = 0; dfs(i); mi = min(mi, tot); } } printf("%d", mi); }

Compilation message (stderr)

bosses.cpp: In function 'int main()':
bosses.cpp:82:12: error: 'done' was not declared in this scope
   82 |         if(done) {
      |            ^~~~
bosses.cpp: In function 'void usaco()':
bosses.cpp:31:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |     freopen("/media/hariaakash646/785EF1075EF0BF46/CompetitiveProgramming/input.in", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bosses.cpp: In function 'int main()':
bosses.cpp:6:21: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 | #define scd(t) scanf("%d", &t)
      |                ~~~~~^~~~~~~~~~
bosses.cpp:52:5: note: in expansion of macro 'scd'
   52 |     scd(n);
      |     ^~~
bosses.cpp:6:21: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 | #define scd(t) scanf("%d", &t)
      |                ~~~~~^~~~~~~~~~
bosses.cpp:58:9: note: in expansion of macro 'scd'
   58 |         scd(k);
      |         ^~~
bosses.cpp:6:21: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 | #define scd(t) scanf("%d", &t)
      |                ~~~~~^~~~~~~~~~
bosses.cpp:61:13: note: in expansion of macro 'scd'
   61 |             scd(b);
      |             ^~~