Submission #170183

#TimeUsernameProblemLanguageResultExecution timeMemory
170183gs18103Meetings (JOI19_meetings)C++14
29 / 100
3022 ms1016 KiB
#include "meetings.h" #include <bits/stdc++.h> #define fi first #define se second #define eb emplace_back #define em emplace #define all(v) v.begin(), v.end() using namespace std; typedef long long ll; typedef pair <int, int> pii; typedef pair <ll, ll> pll; const int MAX = 2020; const int INF = (1 << 30) - 1; const ll LINF = 1LL << 60; int p[MAX]; vector <int> c[MAX]; void add(int a, int b) { bool flag = false; for(int i = 0; i < c[a].size(); i++) { int mid = Query(a, c[a][i], b); if(mid == a) continue; flag = true; if(mid == c[a][i]) { add(c[a][i], b); break; } else if(mid == b) { p[b] = a; p[c[a][i]] = b; c[b].eb(c[a][i]); c[a][i] = b; return; } else { p[c[a][i]] = mid; p[b] = mid; p[mid] = a; c[mid].eb(c[a][i]); c[mid].eb(b); c[a][i] = mid; return; } } if(!flag) { p[b] = a, c[a].eb(b); return; } } void Solve(int n) { for(int i = 1; i < n; i++) p[i] = -1; for(int i = 1; i < n; i++) { if(p[i] == -1) add(0, i); } for(int i = 1; i < n; i++) { Bridge(min(i, p[i]), max(i, p[i])); } }

Compilation message (stderr)

meetings.cpp: In function 'void add(int, int)':
meetings.cpp:23:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < c[a].size(); i++) {
                    ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...