Submission #682704

# Submission time Handle Problem Language Result Execution time Memory
682704 2023-01-16T20:09:23 Z Lobo Political Development (BOI17_politicaldevelopment) C++17
0 / 100
5 ms 3796 KB
#include<bits/stdc++.h>
using namespace std;
const long long inf = (long long) 1e18 + 10;
const int inf1 = (int) 1e9 + 10;
#define int long long
#define dbl long double
#define endl '\n'
#define sc second
#define fr first
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
const int maxn = 5e4+10;
int n, k, fq[maxn];
vector<int> g[maxn];
map<int,int> ed[maxn];

void solve() {
    cin >> n >> k;
    for(int i = 0; i < n; i++) {
        int d; cin >> d;
        while(d--) {
            int x; cin >> x;
            ed[i][x] = 1;
            g[i].pb(x);
        }
    }

    for(int i = 0; i < n; i++) {
        for(auto j : g[i]) {
            for(auto l : g[j]) {
                if(ed[i][l]) {
                    cout << 3 << endl;
                    return;
                }
            }
        }
    }

    for(int i = 0; i < n; i++) {
        if(g[i].size()) {
            cout << 2 << endl;
            return;
        }
    }

    cout << 1 << endl;


}

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

    freopen("in.in", "r", stdin);
    // freopen("out.out", "w", stdout);
    int tt = 1;
    // cin >> tt;
    while(tt--) {
        solve();
    }

}

Compilation message

politicaldevelopment.cpp: In function 'int32_t main()':
politicaldevelopment.cpp:55:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   55 |     freopen("in.in", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 3796 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 3796 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 3796 KB Output is correct
2 Incorrect 4 ms 3796 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 3796 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 3796 KB Output isn't correct
2 Halted 0 ms 0 KB -