제출 #400178

#제출 시각아이디문제언어결과실행 시간메모리
400178VictorMeetings (JOI19_meetings)C++17
100 / 100
983 ms916 KiB
#include "meetings.h" #include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = a; i < (b); ++i) #define per(i, a, b) for (int i = b - 1; i >= (a); --i) #define trav(a, x) for (auto &a : x) #define all(x) x.begin(), x.end() #define sz(x) x.size() #define pb push_back #define umap unordered_map #define uset unordered_set typedef pair<int, int> ii; typedef pair<int, ii> iii; typedef vector<int> vi; typedef vector<ii> vii; typedef vector<vi> vvi; typedef long long ll; const int INF = 1000000007; struct edge { int u, v; }; vii EL; vi children[4001]; void solve(int u) { vi nodes = children[u]; int v = nodes[random() % sz(nodes)]; vi path; path.pb(u); rep(i, 0, sz(nodes)) { int cur = nodes[i]; if (cur == v) continue; int meet = Query(u, v, cur); if (meet == cur) { int lo = 1, hi = sz(path); while (lo < hi) { int mid = (hi + lo) >> 1; meet = Query(u, cur, path[mid]); if (meet == cur) hi = mid; else lo = mid + 1; } path.insert(path.begin() + lo, cur); } else children[meet == u ? meet + 2000 : meet].pb(cur); } path.pb(v); if (!children[u + 2000].empty()) { children[u].swap(children[u + 2000]); children[u + 2000].clear(); solve(u); } rep(i, 0, sz(path) - 1) EL.emplace_back(min(path[i], path[i + 1]), max(path[i], path[i + 1])); rep(i, 1, sz(path)) if (sz(children[path[i]])) solve(path[i]); } void Solve(int N) { fill(children, children + 2001, vi()); rep(i, 1, N) children[0].pb(i); solve(0); sort(all(EL)); trav(edg, EL) Bridge(edg.first,edg.second); }

컴파일 시 표준 에러 (stderr) 메시지

meetings.cpp: In function 'void solve(int)':
meetings.cpp:7:40: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 | #define rep(i, a, b) for (int i = a; i < (b); ++i)
      |                                        ^
meetings.cpp:41:5: note: in expansion of macro 'rep'
   41 |     rep(i, 0, sz(nodes)) {
      |     ^~~
meetings.cpp:7:40: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 | #define rep(i, a, b) for (int i = a; i < (b); ++i)
      |                                        ^
meetings.cpp:73:5: note: in expansion of macro 'rep'
   73 |     rep(i, 0, sz(path) - 1) EL.emplace_back(min(path[i], path[i + 1]), max(path[i], path[i + 1]));
      |     ^~~
meetings.cpp:7:40: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 | #define rep(i, a, b) for (int i = a; i < (b); ++i)
      |                                        ^
meetings.cpp:75:5: note: in expansion of macro 'rep'
   75 |     rep(i, 1, sz(path)) if (sz(children[path[i]])) solve(path[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...