제출 #238722

#제출 시각아이디문제언어결과실행 시간메모리
238722b00n0rpMeetings (JOI19_meetings)C++17
100 / 100
1156 ms1016 KiB
#include <bits/stdc++.h> #include "meetings.h" using namespace std; typedef long double LD; typedef long long ll; #define pb push_back #define REP(i,n) for (int i = 0; i < n; i++) #define FOR(i,a,b) for (int i = a; i < b; i++) #define all(v) v.begin(),v.end() typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int,int> pii; typedef vector<pii> vpii; #define F first #define S second vi gg[2005]; vpii edges; int globalu; bool cmp(int x,int y){ return Query(globalu,x,y) == x; } void dfs(int u){ vi mkc; for(auto x:gg[u]) mkc.pb(x); gg[u].clear(); if(mkc.size() == 0) return; if(mkc.size() == 1){ edges.pb({u,mkc[0]}); return; } int v = mkc[rand()%mkc.size()]; vi path; for(auto x:mkc){ if(x == v) continue; int lol = Query(u,v,x); if(lol == x) path.pb(x); else gg[lol].pb(x); } path.pb(v); globalu = u; sort(all(path),cmp); edges.pb({u,path[0]}); REP(i,path.size()-1) edges.pb({path[i],path[i+1]}); dfs(u); for(auto x:path) dfs(x); } void Solve(int n){ int root = rand()%n; REP(i,n){ if(i != root){ gg[root].pb(i); } } dfs(root); for(auto x:edges){ Bridge(min(x.F,x.S),max(x.F,x.S)); } }

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

meetings.cpp: In function 'void dfs(int)':
meetings.cpp:8:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,n) for (int i = 0; i < n; i++)
meetings.cpp:48:6:
  REP(i,path.size()-1) edges.pb({path[i],path[i+1]});
      ~~~~~~~~~~~~~~~                
meetings.cpp:48:2: note: in expansion of macro 'REP'
  REP(i,path.size()-1) edges.pb({path[i],path[i+1]});
  ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...