이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include"meetings.h"
#include<bits/stdc++.h>
using namespace std;
int N;
/*int Query(int x,int y,int z)
{
cout<<x<<" "<<y<<" "<<z<<": ";
int wynik;
cin>>wynik;
cout<<"\n";
return wynik;
}
void Bridge(int x,int y)
{
cout<<x<<" "<<y<<" buduje\n";
}*/
void dfs(int x,vector<int> Q)
{
if(Q.size()==0)
return;
int strzal=rand()%(Q.size());
strzal=Q[strzal];
//cout<<x<<" "<<strzal<<"\n";
vector<int> sasiad[N],sciezka;
for(int i=0;i<Q.size();i++)
{
if(Q[i]==strzal)
continue;
int mam=Query(x,strzal,Q[i]);
if(mam==Q[i])
sciezka.push_back(Q[i]);
else{
//cout<<"wrzucam "<<mam<<" "<<Q[i]<<"\n";
sasiad[mam].push_back(Q[i]);
}
}
sort(sciezka.begin(),sciezka.end(),[&](int a,int b){return Query(x,a,b)==a;});
sciezka.push_back(strzal);
int pocz=x;
for(int i=0;i<sciezka.size();i++)
{
Bridge(min(pocz,sciezka[i]),max(pocz,sciezka[i]));
pocz=sciezka[i];
}
sciezka.push_back(x);
for(int i=0;i<sciezka.size();i++)
dfs(sciezka[i],sasiad[sciezka[i]]);
}
void Solve(int n)
{
N=n;
int korzen=rand()%n;
vector<int> wszyscy;
for(int i=0;i<n;i++)
if(i!=korzen)
wszyscy.push_back(i);
dfs(korzen,wszyscy);
}
컴파일 시 표준 에러 (stderr) 메시지
meetings.cpp: In function 'void dfs(int, std::vector<int>)':
meetings.cpp:25:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
25 | for(int i=0;i<Q.size();i++)
| ~^~~~~~~~~
meetings.cpp:40:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
40 | for(int i=0;i<sciezka.size();i++)
| ~^~~~~~~~~~~~~~~
meetings.cpp:46:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
46 | for(int i=0;i<sciezka.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... |