QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#412295#1490. Road ClosuresSimonLJK#Compile Error//C++20774b2024-05-16 11:36:062024-05-16 11:36:08

Judging History

你现在查看的是最新测评结果

  • [2024-05-16 11:36:08]
  • 评测
  • [2024-05-16 11:36:06]
  • 提交

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;
}

詳細信息

/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