# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
395268 | 2021-04-28T04:30:16 Z | suren | Swapping Cities (APIO20_swap) | C++14 | 2000 ms | 9512 KB |
#include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mk make_pair #define F first #define S second int n, m; pair < int , pair< int, int > > p[200045]; int parent[100045]; int get( ll x ){ if( parent[x] == x ) return x; return parent[x] = get( parent[x] ); } void init(int N, int M, std::vector<int> U, std::vector<int> V, std::vector<int> W) { int i; n = N;m = M; for( i = 0; i < m; i ++ ){ p[i].second.F=U[i]; p[i].second.S=V[i]; p[i].first=W[i]; } sort( p, p + m ); } int getMinimumFuelCapacity(int X, int Y) { map < int, int > mp; int i; int flag = false; mp.clear(); for( i = 0; i < n; i ++ ) parent[i] = i; for( i = 0; i < m; i ++ ){ int a = get( p[i].second.F ); int b = get( p[i].second.S ); if( a != b ){ if( b > a ){ swap(a, b); } parent[b] = a; } int parx = get( X ); int pary = get( Y ); mp[ p[i].S.F ] = 1; mp[ p[i].S.S ] = 1; if( parx != pary ) continue; if( mp.size() == i+2 ) continue; return p[i].F; } return -1; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Incorrect | 1 ms | 332 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Execution timed out | 2080 ms | 9512 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Incorrect | 1 ms | 332 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Incorrect | 1 ms | 332 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Incorrect | 1 ms | 332 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Incorrect | 1 ms | 332 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |