답안 #678190

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
678190 2023-01-05T09:42:15 Z Dan4Life 자매 도시 (APIO20_swap) C++17
6 / 100
136 ms 15704 KB
#include "swap.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define SZ(a) (int)a.size()
using ll = long long;

const int maxn = (int)1e5+10;
const ll LINF = (ll)1e18;

vector<pair<int,int>> adj[maxn];
ll dis[maxn]; int tot = 0;
int par[maxn];
bool vis[maxn];

bool noCycle = false;
void dfs(int s, int p, int d=0){
	dis[s]=d; par[s]=p;vis[s]=1;
	for(auto u : adj[s]){
		if(!vis[u.fi]) dfs(u.fi,s, d+u.se);
	}
}

void init(int N, int M, vector<int> u, vector<int> v, vector<int> w) {
	for(int i = 0; i < M; i++){
		adj[u[i]].pb({v[i],w[i]});
		adj[v[i]].pb({u[i],w[i]}); tot=max(tot,w[i]);
	}
	if(M==N) noCycle=false;
	else noCycle=true;
}
/*
5 4
1 2 3
2 3 4
3 4 5
4 5 6
4
1 2
1 5
2 5
2 4
*/

int getMinimumFuelCapacity(int x, int y) {
	if(noCycle) return -1; return tot;
}

Compilation message

swap.cpp: In function 'int getMinimumFuelCapacity(int, int)':
swap.cpp:48:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   48 |  if(noCycle) return -1; return tot;
      |  ^~
swap.cpp:48:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   48 |  if(noCycle) return -1; return tot;
      |                         ^~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 3 ms 2628 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 3 ms 2644 KB Output is correct
6 Correct 3 ms 2664 KB Output is correct
7 Correct 2 ms 2644 KB Output is correct
8 Correct 2 ms 2644 KB Output is correct
9 Correct 57 ms 6908 KB Output is correct
10 Correct 54 ms 7884 KB Output is correct
11 Correct 54 ms 7804 KB Output is correct
12 Correct 48 ms 8012 KB Output is correct
13 Correct 49 ms 8060 KB Output is correct
14 Correct 42 ms 7096 KB Output is correct
15 Correct 103 ms 9724 KB Output is correct
16 Correct 102 ms 9528 KB Output is correct
17 Correct 110 ms 9856 KB Output is correct
18 Correct 103 ms 9872 KB Output is correct
19 Correct 70 ms 6900 KB Output is correct
20 Correct 136 ms 14996 KB Output is correct
21 Correct 95 ms 15216 KB Output is correct
22 Correct 112 ms 15688 KB Output is correct
23 Correct 110 ms 15704 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Incorrect 96 ms 10268 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 3 ms 2628 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 3 ms 2644 KB Output is correct
6 Correct 3 ms 2664 KB Output is correct
7 Correct 2 ms 2644 KB Output is correct
8 Correct 2 ms 2644 KB Output is correct
9 Incorrect 2 ms 2644 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 3 ms 2628 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 3 ms 2644 KB Output is correct
6 Correct 3 ms 2664 KB Output is correct
7 Correct 2 ms 2644 KB Output is correct
8 Correct 2 ms 2644 KB Output is correct
9 Correct 57 ms 6908 KB Output is correct
10 Correct 54 ms 7884 KB Output is correct
11 Correct 54 ms 7804 KB Output is correct
12 Correct 48 ms 8012 KB Output is correct
13 Correct 49 ms 8060 KB Output is correct
14 Correct 42 ms 7096 KB Output is correct
15 Correct 103 ms 9724 KB Output is correct
16 Correct 102 ms 9528 KB Output is correct
17 Correct 110 ms 9856 KB Output is correct
18 Correct 103 ms 9872 KB Output is correct
19 Incorrect 96 ms 10268 KB Output isn't correct
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -