Submission #405927

# Submission time Handle Problem Language Result Execution time Memory
405927 2021-05-17T05:00:50 Z Maqsut_03 Swapping Cities (APIO20_swap) C++14
0 / 100
1 ms 204 KB
#include "swap.h"
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<deque>

#define ll long long 
#define pl pair<ll, ll> 
#define llv vector<ll>
#define pb push_back
#define ppb(x, y) push_back({x, y})
#define pv vector<pl>
#define sz size()
#define ss second
#define ff first

using namespace std;
const int N = 2 * 1e5 + 3;

ll n, m, a = 0, b = 0, c;
llv v;
pl w[N];
bool q = 1;

void init(int N, int M, vector<int> U, vector<int> V, vector<int> W) 
{
    n = N;
    m = M;
/*    for (int i=0; i<m; i++) 
	{
    	v[V[i]].ppb(U[i], W[i]);
    	v[U[i]].ppb(V[i], W[i]);
	}
*/	
	for (int i=0; i<m; i++)
	    	w[i] = {W[i], i};
    for (auto i:W) v.pb(i);
	sort(w, w+m);
	a = w[0].ss;
	b = w[1].ss;
	c = w[2].ss;
	return ;
}

int getMinimumFuelCapacity(int X, int Y) 
{
	ll ans;
	if (X == a || Y == a) ans = b;
	else if (X == a && Y == b || X == b && Y == a) ans = c ;
	else ans = a;
	ans += v[X] + v[Y]; 
	return ans;
}

Compilation message

swap.cpp: In function 'int getMinimumFuelCapacity(int, int)':
swap.cpp:52:18: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   52 |  else if (X == a && Y == b || X == b && Y == a) ans = c ;
      |           ~~~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -