제출 #1342665

#제출 시각아이디문제언어결과실행 시간메모리
1342665kokoxuya자매 도시 (APIO20_swap)C++20
6 / 100
58 ms11416 KiB
#include "swap.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define lsb(x) (x&(-x))
#define pii pair<int,int>
#define ss second
#define ff first
#define piii pair<int,pii>
#define debu(x) (cerr << #x  << " = "<< x << "\n")
#define debu2(x,y) (cerr << #x  << " = "<< x << " " << #y << " = " << y << "\n")
#define debu3(x,y,z) (cerr << #x  << " = "<< x << " " << #y << " = " << y << " " << #z << " = " << z<< "\n")
#define bitout(x,y) {\
	cerr << #x << " : ";\
	for (int justforbits = y; justforbits >=0; justforbits--)cout << (((1 << justforbits) & x)>=1);\
	cout << "\n";\
}
#define rangeout(j,rangestart,rangeend) {\
	cerr << "outputting " << #j<< ":\n";\
	for (int forrang = rangestart; forrang <= rangeend; forrang++)cerr << j[forrang] << " ";\
	cerr<<"\n";\
}
#define c1 {cerr << "Checkpoint 1! \n\n";cerr.flush();}
#define c2 {cerr << "Checkpoint 2! \n\n";cerr.flush();}
#define c3 {cerr << "Checkpoint 3! \n\n";cerr.flush();}
#define c4 {cerr << "Checkpoint 4! \n\n";cerr.flush();}

int n,m;
vector<vector<pii>>adjlist;
bool isring=true;
int maxxy=0;

void init(int N, int M, vector<int> U, vector<int> V, vector<int> W) 
{
	int n=N,m=M;
	adjlist.resize(n);
	
	for(int a=0;a<n;a++)
	{
		maxxy=max(maxxy,W[a]);
		adjlist[U[a]].pb(mp(V[a],W[a]));
		adjlist[V[a]].pb(mp(U[a],W[a]));
	}
	
	for(int i=0;i<n;i++)
	{
		if(adjlist[i].size()==1)isring=false;
	}
}

int getMinimumFuelCapacity(int X, int Y) 
{
	if(isring)return maxxy;
	else return -1;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...