Submission #57652

#TimeUsernameProblemLanguageResultExecution timeMemory
57652FLDutchmanFriend (IOI14_friend)C++14
Compilation error
0 ms0 KiB
#include "friend.h"
#include <bits/stdc++.h>
using namespace std;

typedef int INT

#define mp make_pair
#define pb push_back
#define fst first
#define snd second
#define int long long
#define MMAX 16384
#define fast_io() ios::sync_with_stdio(false)
#define FOR(i, l, r) for(int i = (l); i < (r); i++)

typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef set<int> si;
typedef double ld;
typedef pair<ld, ld> dd;

const ll INF = 1000000000000000000LL;
const int NMAX = 1100;
const int mod = 1e9+7;
const ld eps = 1e-10;
const ld PI = acos(-1);


vi match;
bitset<NMAX> vis;
vi adj[NMAX];

int aug(int n){
    if(vis[n]) return 0;
    vis[n] = 1;
    for(int k : adj[n]) if(match[k] == -1 || aug(match[k])) {
        match[k] = n;
        match[n] = k;
        return 1;
    }
    return 0;
}

int MCBM(){
    int tot = 0;
    FOR(i, 0, NMAX) if(match[i] == -1) vis.reset(), tot += aug(i);
    return tot;
}


INT findSample(INT n, INT confidence[], INT host[], INT protocol[]){
    FOR(i, 1, n){
        if(protocol[i] == 0 || protocol[i] == 2){
            adj[host[i]].pb(i);
            adj[i].pb(host[i]);
            //cout << i << " " << host[i] << endl;
        }
        if(protocol[i] == 1 || protocol[i] == 2){
            for(int k : adj[host[i]]){
                //cout << i << " " << k << endl;
                adj[k].pb(i);
                adj[i].pb(k);
            }
        }
    }
    match.assign(NMAX, -1);
    //cout<<endl;
    int m = MCBM();
    /*FOR(i, 0, n){
        cout << i << " " << match[i] << endl;
    }*/
    return n - m;
}


/*
signed main(){
    fast_io();
    int N;
    int conf[NMAX], host[NMAX], protocol[NMAX];
    cin >> N;
    FOR(i, 0, N) cin >> conf[i];
    FOR(i, 1, N) cin >> host[i], cin >> protocol[i];
    cout << findSample(N, conf, host, protocol);
    
}*/ 

Compilation message (stderr)

friend.cpp:16:1: error: expected initializer before 'typedef'
 typedef long long ll;
 ^~~~~~~
friend.cpp:17:14: error: 'll' was not declared in this scope
 typedef pair<ll, ll> ii;
              ^~
friend.cpp:17:18: error: 'll' was not declared in this scope
 typedef pair<ll, ll> ii;
                  ^~
friend.cpp:17:20: error: template argument 1 is invalid
 typedef pair<ll, ll> ii;
                    ^
friend.cpp:17:20: error: template argument 2 is invalid
friend.cpp:25:7: error: 'll' does not name a type; did you mean 'ld'?
 const ll INF = 1000000000000000000LL;
       ^~
       ld
friend.cpp:54:1: error: 'INT' does not name a type; did you mean 'EINTR'?
 INT findSample(INT n, INT confidence[], INT host[], INT protocol[]){
 ^~~
 EINTR