제출 #210466

#제출 시각아이디문제언어결과실행 시간메모리
210466mhy908Meetings (JOI19_meetings)C++14
0 / 100
66 ms540 KiB
#include "meetings.h"
#include <bits/stdc++.h>
#define pb push_back
#define all(x) x.begin(), x.end()
using namespace std;
int st, fin;
bool comp(int a, int b){
    if(a==st||b==fin)return 1;
    if(a==fin||b==st)return 0;
    return Query(st, a, b)==a;
}
unordered_map<int, vector<int> > ump;
void solve(vector<int> vc){
	if(vc.size()<=1)return;
	st=rand()%vc.size();
	while(1){
        fin=rand()%vc.size();
        if(st!=fin)break;
	}
	ump[st].pb(st);
	ump[fin].pb(fin);
	vector<int> path;
	path.pb(st);
	for(int i=0; i<vc.size(); i++){
        if(vc[i]==st||vc[i]==fin)continue;
		int x=Query(st, fin, vc[i]);
		if(ump[x].empty())path.pb(x);
		ump[x].pb(vc[i]);
	}
	path.pb(fin);
	sort(all(path), comp);
	for(int i=0; i<path.size()-1; i++){
        Bridge(min(path[i], path[i+1]), max(path[i], path[i+1]));
	}
	for(int i=0; i<path.size(); i++){
		vector<int> temp=ump[path[i]];
		ump[path[i]].clear();
		solve(temp);
	}
}
void Solve(int n){
    srand(time(NULL));
	vector<int> temp;
	for(int i=0; i<n; i++)temp.pb(i);
	solve(temp);
}

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

meetings.cpp: In function 'void solve(std::vector<int>)':
meetings.cpp:24:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<vc.size(); i++){
               ~^~~~~~~~~~
meetings.cpp:32:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<path.size()-1; i++){
               ~^~~~~~~~~~~~~~
meetings.cpp:35:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<path.size(); i++){
               ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...