Submission #985034

# Submission time Handle Problem Language Result Execution time Memory
985034 2024-05-17T09:50:32 Z shjeong Cyberland (APIO23_cyberland) C++17
0 / 100
28 ms 11092 KB
#include <vector>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cstring>
#include <vector>
#include <string>
#include <climits>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <bitset>
#include <cassert>
#include <list>
using namespace std;
#define all(x) x.begin(), x.end()
#define rll(x) x.rbegin(), x.rend()
#define comp(x) x.erase(unique(all(x)), x.end())
#define MOD 1000000007
#define MOD2 998244353
#define debug(x) cout << #x<<" is "<<x<<"\n";
#define X first
#define Y second
#define DEB cout<<"[DEBUG]"
#define PAIR(a,b) "("<<a<<", "<<b<<")"
#define PRINT1(V) DEB<<#V<<endl; for(auto i : V)DEB<<i<<"\n"
#define PRINT2(V) DEB<<#V<<endl; for(auto [a,b] : V)DEB<<PAIR(a,b)<<"\n";
typedef long long ll;
typedef __int128_t lll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
typedef pair<ld,ll> Pd;
vector<P> adj[202020];
ld dist[202020];
ll p[202020];
ll find(ll x){
    if(p[x]<0)return x;
    return p[x] = find(p[x]);
}
void merge(ll x, ll y){
    x = find(x), y = find(y);
    if(x==y)return;
    p[y]=x;
}
double solve(int N, int M, int K, int H, std::vector<int> x, std::vector<int> y, std::vector<int> c, std::vector<int> arr) {
    if(N==2)return (M==0 ? -1 : c[0]);
    map<P,ll> mp;
    for(int i = 0 ; i < M ; i++){
        mp[P(min(x[i],y[i]), max(x[i],y[i]))] = c[i];
    }
    ld ret = 1e15;
    if(mp.find({0,H}) != mp.end())ret = min<ld>(ret, mp[{0,H}]);
    if(mp.find({0,2-H}) != mp.end() and mp.find({min(H,2-H), max(H,2-H)}) != mp.end()){
        ret = min(ret, (ld)mp[{0,2-H}] / (arr[2-H]==2 ? 2.0 : 1.0) * (arr[2-H]==0 ? 0 : 1) + mp[{min(H,2-H), max(H,2-H)}]);
    }
    if(ret==1e15)ret = -1;
    return ret;
}
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 5724 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 5720 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 5724 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 11092 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 5724 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 5800 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 5760 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 5720 KB Wrong Answer.
2 Halted 0 ms 0 KB -