Submission #417853

#TimeUsernameProblemLanguageResultExecution timeMemory
417853Knps4422전선 연결 (IOI17_wiring)C++14
Compilation error
0 ms0 KiB
//#pragma optimization_level 3
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#include "wiring.h"
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordset;
*/
#define fr first
#define sc second
#define vec vector
#define pb push_back
#define pii pair<int, int>
#define forn(x,y) for(int x = 1 ; x <= (int)y ; ++x)
#define all(x) (x).begin(),(x).end()
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
 
using namespace std;
 
typedef long long ll;
typedef unsigned int uint;
typedef pair<ll,ll> pll;
typedef complex<int> point;
const int nmax = 2005;
const ll linf = 1e18;
const ll mod = 998244353;
const int inf = 1e9+10;
const int sq = 5000;

int n , m;

ll dp[nmax][nmax];
ll a[nmax], b[nmax];

int64_t min_total_lenght( vec < int > r , vec < int > bl){
	for(int i = 0 ; i < r.size();i++){
		a[i+1] = r[i];
	}
	for(int i = 0 ; i < bl.size();i++){
		b[i+1] = bl[i];
	}
	n = r.size();
	m = bl.size();
	a[0] = - inf;
	a[n+1] = linf;
	b[0] = -inf;
	b[m+1] = linf;
	for(int i = 0; i <= n; i++){
		for(int j = 0; j <= m; j++){
			dp[i][j] = linf;
			if( i == 0 && j == 0){
				dp[i][j] = 0;
			}
			if(i > 0 && j > 0){
				dp[i][j] = min(dp[i][j] , dp[i-1][j-1] + abs(a[i] - b[j]));
			}
			if(i > 0){
				dp[i][j] = min(dp[i][j] , dp[i-1][j] + abs(a[i] - b[j+1]));
			}
			if(j > 0){
				dp[i][j] = min(dp[i][j] , dp[i][j-1] + abs(a[i+1] - b[j]));
			}
		}
	}
	return dp[n][m];
}

Compilation message (stderr)

wiring.cpp: In function 'int64_t min_total_lenght(std::vector<int>, std::vector<int>)':
wiring.cpp:40:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |  for(int i = 0 ; i < r.size();i++){
      |                  ~~^~~~~~~~~~
wiring.cpp:43:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |  for(int i = 0 ; i < bl.size();i++){
      |                  ~~^~~~~~~~~~~
/usr/bin/ld: /tmp/ccWjmgrA.o: in function `main':
grader.cpp:(.text.startup+0x22a): undefined reference to `min_total_length(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status