Submission #821844

#TimeUsernameProblemLanguageResultExecution timeMemory
821844farhan132Meetings (JOI19_meetings)C++17
100 / 100
558 ms856 KiB
#include "meetings.h" #include <bits/stdc++.h> using namespace std; typedef int ll; typedef double dd; typedef pair<ll , ll> ii; typedef tuple < ll, ll, ll > tp; #define ff first #define ss second #define pb push_back #define in insert mt19937 rng(chrono::system_clock::now().time_since_epoch().count()); const ll N = 2005; vector < ll > v[N]; ll col[N]; void dfs(ll s){ if(col[s]) return; col[s] = 1; for(auto u : v[s]) dfs(u); } vector < ii > e; void solve(ll root, vector < ll > a){ if(a.size() == 0) return; for(auto u : a){ v[u].clear(); } v[root].clear(); shuffle(a.begin(), a.end(), rng); vector < ll > nodes = {a[0]}; for(ll i = 1; i < a.size(); i++){ ll z = Query(root, a[0], a[i]); if(z != a[i]) v[z].pb(a[i]); if(z != root) nodes.pb(z); } sort(nodes.begin(), nodes.end()); nodes.erase(unique(nodes.begin(), nodes.end()), nodes.end()); sort(nodes.begin(), nodes.end(), [&](ll i, ll j){ return (Query(root, i, j) == i); }); e.pb({root, nodes[0]}); for(ll i = 1; i < nodes.size(); i++){ e.pb({nodes[i - 1], nodes[i]}); } nodes.pb(root); for(auto u : nodes){ solve(u, v[u]); } return; } void Solve(int n) { vector < ll > a; for(ll i = 1; i < n; i++) a.pb(i); solve(0, a); for(auto [x, y] : e){ Bridge(min(x, y), max(x, y)); } return; }

Compilation message (stderr)

meetings.cpp: In function 'void solve(ll, std::vector<int>)':
meetings.cpp:38:19: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |   for(ll i = 1; i < a.size(); i++){
      |                 ~~^~~~~~~~~~
meetings.cpp:52:19: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |   for(ll i = 1; i < nodes.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...