Submission #403426

# Submission time Handle Problem Language Result Execution time Memory
403426 2021-05-13T07:20:15 Z Wasrek Swapping Cities (APIO20_swap) C++14
0 / 100
123 ms 12292 KB
#include<bits/stdc++.h>
#include "swap.h"
// #include"grader.cpp"
#include <vector>
#define SIZE 100010
#define MAX 2000000000
using namespace std;
struct A{
  int u,w;
  bool operator< (const A& o) const{
    return w<o.w;
  }
};
int sub2=1,n;
A m1={MAX,MAX},m2={MAX,MAX},m3={MAX,MAX};
vector<A> g[SIZE],wei;

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({V[i],W[i]});
      g[V[i]].push_back({U[i],W[i]});
      wei.push_back({V[i],W[i]});
    }
    sort(wei.begin(),wei.end());
    // printf("%d %d\n%d %d\n%d %d\n",m1.u,m1.w,m2.u,m2.w,m3.u,m3.w);
    return ;
}

int getMinimumFuelCapacity(int X, int Y) {
  //min path ที่มี node อยู่ระหว่าง path
  //หา min ถนนที่เชื่อมกับโหนดตรงกลาง
  //เทียบ min กับ path อื่นๆ ไปได้ (เชื่อมตรงเลยก็ได้)
  // if(sub2){
    if(X==0 || Y==0 || n<=3) return -1;
    // printf("%d %d\n",g[X][0].w,g[Y][0].w);
    for(auto x: wei){
      // printf("%d %d\n",x.u,x.w);
      if(X!=x.u && Y!=x.u) return max(g[X][0].w,max(g[Y][0].w,x.w));
    }
  // }
  return -1;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2636 KB Output is correct
2 Correct 2 ms 2636 KB Output is correct
3 Correct 2 ms 2636 KB Output is correct
4 Incorrect 2 ms 2636 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2636 KB Output is correct
2 Correct 2 ms 2636 KB Output is correct
3 Incorrect 123 ms 12292 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2636 KB Output is correct
2 Correct 2 ms 2636 KB Output is correct
3 Correct 2 ms 2636 KB Output is correct
4 Incorrect 2 ms 2636 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2636 KB Output is correct
2 Correct 2 ms 2636 KB Output is correct
3 Correct 2 ms 2636 KB Output is correct
4 Incorrect 2 ms 2636 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2636 KB Output is correct
2 Correct 2 ms 2636 KB Output is correct
3 Correct 2 ms 2636 KB Output is correct
4 Incorrect 2 ms 2636 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2636 KB Output is correct
2 Correct 2 ms 2636 KB Output is correct
3 Correct 2 ms 2636 KB Output is correct
4 Incorrect 2 ms 2636 KB Output isn't correct
5 Halted 0 ms 0 KB -