QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#412295 | #1490. Road Closures | SimonLJK# | Compile Error | / | / | C++20 | 774b | 2024-05-16 11:36:06 | 2024-05-16 11:36:08 |
Judging History
answer
#include "roads.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+99;
ll f[N],g[N];
std::vector<ll> minimum_closure_costs(int n, std::vector<int> u,
std::vector<int> v,
std::vector<ll> w) {
vector<ll> re;
re.resize(n);
int b1=1,b2=1;
for(int i=0;i<=n-2;i++){
if(u[i]!=0) b1=0;
if(u[i]!=i||v[i]!=i+1) b2=0;
}
if(b1){
sort(w.begin(),w.end());
for(int i=n-2;i>=0;i--)
re[i]=re[i+1]+w[n-2-i];
}
else if(b2){
for(int i=0;i<=n-2;i++) re[0]+=w[i];
for(int i=1;i<=n-1;i++){
f[i]=g[i-1];
g[i]=w[i-1]+min(g[i-1],f[i-1]);
}
re[1]=min(f[n-1],g[n-1]);
}
return re;
}
Details
/usr/bin/ld: /tmp/cceV3yhK.o: in function `main': implementer.cpp:(.text.startup+0x286): undefined reference to `minimum_closure_costs(int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)' collect2: error: ld returned 1 exit status