답안 #433753

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
433753 2021-06-20T10:20:10 Z LouayFarah Love Polygon (BOI18_polygon) C++14
0 / 100
219 ms 19716 KB
#include "bits/stdc++.h"
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

typedef long long ll;
typedef string str;
typedef double db;
typedef long double ld;
typedef pair<int, int> pi;
#define fi first
#define se second

#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define endl "\n"

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)

const ll MOD = 1e9 + 7; //998244353
const ll INF = 1e18;
const ll MX = 1e9 + 10;
const int nx[4] = {0, 0, 1, -1}, ny[4] = {1, -1, 0, 0}; //right left down up

#ifndef LOCAL
#define cerr if(false) cerr
#endif
#define debug(x) cerr << #x << " : " << x << endl;
#define debugs(x,y) cerr << #x << " : " << x << " / " << #y << " : " << y << endl;
#define debugv(v) cerr << #v << " : " << "[ "; for(auto it : v) cerr << it << ' '; cerr << ']' << endl;
#define here() cerr << "here" << endl;

void IO() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}


int main()
{
    boost;
    IO();

    ll n;
    cin >> n;

    map<string, ll> m;

    set<ll> adj[n+1];
    vector<pair<string, string>> li;
    ll counter = 1;
    FOR(i, 0, n)
    {
        string a, b;
        cin >> a >> b;

        li.pb(mp(a, b));
        if(!m.count(a))
            m[a] = counter++;
        if(!m.count(b))
            m[b] = counter++;
    }

    if(n%2==1)
    {
        cout << -1 << endl;
        return 0;
    }
    cout << n/2 << endl;

    /*FOR(i, 0, n)
    {
        string a = li[i].fi;
        string b = li[i].se;

        adj[m[a]].insert(m[b]);
    }*/


    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 219 ms 19716 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -