Submission #73046

# Submission time Handle Problem Language Result Execution time Memory
73046 2018-08-27T14:30:32 Z nvmdava Friend (IOI14_friend) C++17
Compilation error
0 ms 0 KB
#include "wiring.h"
#include <bits/stdc++.h>
using namespace std;

struct Node{
	int id, c;
	Node(int _id, int _c){
		id = _id;
		c = _c;
	}
	bool operator<(const Node& rhs) const{
		return id < rhs.id;
	}
};

vector<Node> v;
long long ans[200005];
int lr[200005], lb[200005];
long long min_total_length(std::vector<int> r, std::vector<int> b) {
	
	lr[0] = -1;
	lb[0] = -1;
	int all = b.size() + r.size();

	for(auto x : r){
		v.push_back(Node(x, 1));
	}
	for(auto x : b){
		v.push_back(Node(x, 0));
	}
	sort(v.begin(), v.end());
	int i;
	for(i = 0; i < all; i++){
		lr[i + 1] = lr[i];
		lb[i + 1] = lb[i];
		if(v[i].c) lr[i + 1] = i;
		else lb[i + 1] = i;
	}
	
	for(i = 1; i <= all; i++){
		
		ans[i] = ans[i - 1] - v[i - 1].id;
		
		if(lr[i] < 0 || lb[i] < 0) continue;
		break;
	}
	ans[i] += v[i - 1].id * i;
	for(i = i + 1; i <= all; i++){
		ans[i] = ans[i - 1] + v[i - 1].id - (v[i - 1].c == 1 ? v[lb[i]].id : v[lr[i]].id);
		if(v[i - 1].c + v[i - 2].c == 1){
			if(ans[i - 2] <= 0) continue;
			ans[i] = min(ans[i], ans[i - 2] + v[i - 1].id - v[i - 2].id);
		}
	}
	return ans[all];
}

Compilation message

friend.cpp:1:10: fatal error: wiring.h: No such file or directory
 #include "wiring.h"
          ^~~~~~~~~~
compilation terminated.