Submission #334823

# Submission time Handle Problem Language Result Execution time Memory
334823 2020-12-10T04:15:31 Z limabeans Swapping Cities (APIO20_swap) C++17
0 / 100
738 ms 524292 KB
#include <bits/stdc++.h>
#include "swap.h"

using namespace std;

using ll = long long;
const int maxn = 1e5 + 10;

int n;
vector<pair<ll,int>> g[maxn];


bool loop = false;
ll maxW = 0;

void dfs(int at, int p, int dep) {
    if (dep==n) loop=true;
    for (auto ed: g[at]) {
	int to = ed.second;
	if (to == p) continue;
	dfs(to,at,dep+1);
    }
}


void init(int N, int M, std::vector<int> U, std::vector<int> V, std::vector<int> W) {
    n=N;
    for (int i=0; i<M; i++) {
	g[U[i]].push_back({W[i],V[i]});
	g[V[i]].push_back({W[i],U[i]});
	maxW=max(maxW,1ll*W[i]);
    }

    dfs(0,-1,0);
}

int getMinimumFuelCapacity(int X, int Y) {
    if (loop) return maxW;
    return -1;
}

/*
  int main() {
  init(5, 6, {0, 0, 1, 1, 1, 2}, {1, 2, 2, 3, 4, 3}, {4, 4, 1, 2, 10, 3});
  cout<<getMinimumFuelCapacity(1, 2)<<endl;
  cout<<getMinimumFuelCapacity(2, 4)<<endl;
  cout<<getMinimumFuelCapacity(0, 1)<<endl;
  return 0;
  }
*/
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2668 KB Output is correct
2 Correct 2 ms 2668 KB Output is correct
3 Correct 2 ms 2668 KB Output is correct
4 Correct 2 ms 2688 KB Output is correct
5 Correct 2 ms 2808 KB Output is correct
6 Correct 2 ms 2796 KB Output is correct
7 Correct 3 ms 2796 KB Output is correct
8 Correct 2 ms 2796 KB Output is correct
9 Correct 60 ms 10940 KB Output is correct
10 Correct 82 ms 13548 KB Output is correct
11 Correct 82 ms 13036 KB Output is correct
12 Correct 85 ms 13824 KB Output is correct
13 Correct 91 ms 14828 KB Output is correct
14 Correct 71 ms 10604 KB Output is correct
15 Correct 144 ms 15220 KB Output is correct
16 Correct 156 ms 13980 KB Output is correct
17 Correct 155 ms 16592 KB Output is correct
18 Correct 152 ms 15828 KB Output is correct
19 Runtime error 738 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2668 KB Output is correct
2 Correct 2 ms 2668 KB Output is correct
3 Incorrect 108 ms 11008 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 329 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
# Verdict Execution time Memory Grader output
1 Runtime error 329 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2668 KB Output is correct
2 Correct 2 ms 2668 KB Output is correct
3 Correct 2 ms 2668 KB Output is correct
4 Correct 2 ms 2688 KB Output is correct
5 Correct 2 ms 2808 KB Output is correct
6 Correct 2 ms 2796 KB Output is correct
7 Correct 3 ms 2796 KB Output is correct
8 Correct 2 ms 2796 KB Output is correct
9 Correct 60 ms 10940 KB Output is correct
10 Correct 82 ms 13548 KB Output is correct
11 Correct 82 ms 13036 KB Output is correct
12 Correct 85 ms 13824 KB Output is correct
13 Correct 91 ms 14828 KB Output is correct
14 Correct 71 ms 10604 KB Output is correct
15 Correct 144 ms 15220 KB Output is correct
16 Correct 156 ms 13980 KB Output is correct
17 Correct 155 ms 16592 KB Output is correct
18 Correct 152 ms 15828 KB Output is correct
19 Incorrect 108 ms 11008 KB Output isn't correct
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 329 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)