이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |