이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#include "meetings.h"
#define fr first
#define sc second
#define vec vector
#define pb push_back
#define pii pair<int, int>
#define forn(x,y) for(int x = 1 ; x <= (int)y ; ++x)
#define all(x) (x).begin(),(x).end()
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
typedef unsigned int uint;
typedef complex<int> point;
const int nmax = 2005;
const ll linf = 1e18;
const ll mod = 998244353;
const int inf = INT_MAX;
vec < pii > eds;
int A,n,vz[nmax];
vector<int>vc[nmax];
/*int Query(int x,int y,int z)
{
cout<<"Q "<<x<<" "<<y<<" "<<z<<endl;
int rs;
cin>>rs;
return rs;
}*/
bool cmp(int x,int y)
{
return Query(A,x,y)==x;
}
void solves(vec <int> tb){
if(tb.size() == 1)return ;
if(tb.size()==2)
{
eds.pb({tb[0],tb[1]});
return;
}
srand(time(0));
for(int i:tb)vc[i].clear(),vz[i]=0;
int m=tb.size();
A = tb[rand()%m];
int B = tb[rand()%m];
while(B == A)B = tb[rand()%m];
vector<int>pth;
for(int i : tb){
if(i != A && i != B && Query(A,B,i) == i) pth.pb(i);
}
pth.pb(B);
sort(all(pth),cmp);
reverse(all(pth));
pth.pb(A);
for(int i=1;i<pth.size();i++)eds.pb({pth[i-1],pth[i]});
for(int i=0;i<pth.size();i++)vz[pth[i]]=1,vc[pth[i]].pb(pth[i]);
for(int i : tb){
if(!vz[i])
{
vc[Query(A,B,i)].pb(i);
}
}
for(int i=0;i<pth.size();i++)
{
solves(vc[pth[i]]);
}
}
void Solve(int n)
{
vec < int > asd;
for(int i= 1; i <=n ;i++)asd.pb(i);
solves(asd);
for(pii ed : eds){
Bridge(min(ed.fr,ed.sc),max(ed.fr,ed.sc));
}
}
/*int main()
{
//freopen("sol.in","r",stdin);
//freopen("sol.out","w",stdout);
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
cin>>n;
return 0;
}*/
컴파일 시 표준 에러 (stderr) 메시지
meetings.cpp: In function 'void solves(std::vector<int>)':
meetings.cpp:62:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=1;i<pth.size();i++)eds.pb({pth[i-1],pth[i]});
~^~~~~~~~~~~
meetings.cpp:63:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0;i<pth.size();i++)vz[pth[i]]=1,vc[pth[i]].pb(pth[i]);
~^~~~~~~~~~~
meetings.cpp:70:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0;i<pth.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... |