이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#ifdef EVAL
#else
#include"grader.cpp"
#endif
#include"meetings.h"
#include<bits/stdc++.h>
using namespace std;
void add(int x,int y){
if(x>y)swap(x,y);
Bridge(x,y);
}
void go(vector<int>v){
if(v.size()<2)return;
random_shuffle(v.begin(),v.end());
map<int,vector<int>>m;
m[v[0]].pb(v[0]);
m[v[1]].pb(v[1]);
vector<int>path;
for(int i=2;i<v.size();i++){
int x=Query(v[0],v[1],v[i]);
if(!m.count(x)) path.pb(x);
m[x].pb(v[i]);
}
sort(path.begin(),path.end(),[&](int l,int r){return Query(v[0],l,r)==l;});
int last=v[0];
for(int x:path)add(last,x),last=x;
add(last,v[1]);
for(auto it:m)go(it.second);
}
void Solve(int n){
srand(time(0));
vector<int>all(n);
iota(all.begin(),all.end(),0);
Solve(all);
}
컴파일 시 표준 에러 (stderr) 메시지
meetings.cpp: In function 'void go(std::vector<int>)':
meetings.cpp:16:10: error: 'std::map<int, std::vector<int> >::mapped_type' {aka 'class std::vector<int>'} has no member named 'pb'
16 | m[v[0]].pb(v[0]);
| ^~
meetings.cpp:17:10: error: 'std::map<int, std::vector<int> >::mapped_type' {aka 'class std::vector<int>'} has no member named 'pb'
17 | m[v[1]].pb(v[1]);
| ^~
meetings.cpp:19:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
19 | for(int i=2;i<v.size();i++){
| ~^~~~~~~~~
meetings.cpp:21:24: error: 'class std::vector<int>' has no member named 'pb'
21 | if(!m.count(x)) path.pb(x);
| ^~
meetings.cpp:22:8: error: 'std::map<int, std::vector<int> >::mapped_type' {aka 'class std::vector<int>'} has no member named 'pb'
22 | m[x].pb(v[i]);
| ^~
meetings.cpp: In function 'void Solve(int)':
meetings.cpp:34:8: error: cannot convert 'std::vector<int>' to 'int'
34 | Solve(all);
| ^~~
| |
| std::vector<int>
meetings.cpp:30:16: note: initializing argument 1 of 'void Solve(int)'
30 | void Solve(int n){
| ~~~~^