제출 #442201

#제출 시각아이디문제언어결과실행 시간메모리
442201amunduzbaevAliens (IOI16_aliens)C++14
컴파일 에러
0 ms0 KiB
/* made by amunduzbaev */
#include "aliens.h"
//~ #include "grader.cpp"
#include "bits/stdc++.h"
using namespace std;
//~ #include <ext/pb_ds/assoc_container.hpp>
//~ #include <ext/pb_ds/tree_policy.hpp>
//~ using namespace __gnu_pbds;
//~ template<class T> using oset = tree<T, 
//~ null_type, less_equal<T>, rb_tree_tag, 
//~ tree_order_statistics_node_update>;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(),x.rend()
#define NeedForSpeed ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define vv vector
#define mem(arr, v) memset(arr, v, sizeof arr)
#define int long long
#define degub(x) cout<<#x<<" : "<<x<<"\n"
#define GG cout<<"here"<<endl;
//~ void usaco(string s) { freopen((s+".in").c_str(),"r",stdin);  
	//~ freopen((s+".out").c_str(),"w",stdout); NeedForSpeed } 
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii; 
typedef vector<int> vii;
typedef vector<pii> vpii;
template<class T> bool umin(T& a, const T& b) { return a > b ? a = b, true : false; }
template<class T> bool umax(T& a, const T& b) { return a < b ? a = b, true : false; }
template<int sz> using tut = array<int, sz>;
 
//~ for P. Pankov problems
//~ const int mod = 2021;
//~ const int mod = (119 << 23)+1;
 
const int N = 5e4+5;
const int mod = 1e9+7;
const ll inf = 1e18;
const ld Pi = acos(-1);
const int MX = 1e6+5;
 
#define MULTI 0
int n, m, k, t, q, ans, res, a[N];
int x[N], y[N];
 
bool cmp(tut<3> a, tut<3> b){
	if(a[1] != b[1]) return (a[1] > b[1]);
	return (a[0] < b[0]);
}
 
struct TREE{
	int tree[4*MX];
	void sett(int i, int v, int lx = 0, int rx = MX, int x = 1){
		if(lx == rx) { tree[x] = v; return; }
		int m = (lx + rx)>>1;
		if(i <= m) sett(i, v, lx, m, x<<1);
		else sett(i, v, m+1, rx, x<<1|1);
		tree[x] = tree[x<<1] + tree[x<<1|1];
	}
	
	int get(int l, int r, int lx = 0, int rx = MX, int x = 1){
		if(lx > r || rx < l) return 0;
		if(lx >= l && rx <= r) return tree[x];
		int m = (lx + rx)>>1;
		return get(l, r, lx, m, x<<1) + get(l, r, m+1, rx, x<<1|1);
	}
}tree; 
 
int dp[N][105];
vpii pp;
int sq(int a) { return a * a; }
 
void dnc(int l, int r, int lx, int rx){
	if(l > r) return;
	int m = (l + r)>>1, op = min(rx, m);
	//~ dp[m][k] = inf;
	for(int i=min(rx, m);i>=min(lx, 1ll);i--){
		int in = 0;
		if(pp[i-1].ss - pp[i].ff + 1 >= 0) in = sq(pp[i-1].ss - pp[i].ff + 1);
		if(umin(dp[m][k], dp[i-1][k-1] + sq(pp[m].ss - pp[i].ff + 1) - in)) op = i;
	}
	
	dnc(l, m-1, lx, op);
	dnc(m+1, r, op, rx);
}
 
#define i32 int32_t
 
int take_photos(i32 N, i32 M, i32 K, std::vector<i32> r, std::vector<i32> c){
	n = N, m = M, k = K;
	for(int i=1;i<=n;i++){
		x[i] = r[i-1], y[i] = c[i-1];
		if(x[i] > y[i]) swap(x[i], y[i]);
	}
	
	vv<tut<3>> tt;
	for(int i=1;i<=n;i++) tt.pb({x[i], y[i], i});
	sort(all(tt), cmp);
	for(auto x : tt){
		if(tree.get(0, x[0])) continue;
		else {
			pp.pb({x[0], x[1]});
			tree.sett(x[0], 1);
		}
	}
	
	sort(all(pp));
	n = sz(pp);
	mem(dp, 127);
	for(int i=0;i<n;i++) dp[i][0] = sq(pp[i].ss - pp[0].ff + 1);
	umin(k, K);
	K = k;
	for(k=1;k<K;k++){
		dnc(k, n-1, 0, n-1);
	}
	
	res = inf;
	for(int i=0;i<K;i++) umin(res, dp[n-1][i]);
	return res;
}
 
/*
 
2 6 2
1 4
4 1
 
3 7 2
1 3
2 3
2 4
 
*/
 
//~ signed main(){
	//~ NeedForSpeed
	//~ i32 n, m, k; cin>>n>>m>>k;
	//~ vv<i32> r, c; 
	//~ for(int i=0;i<n;i++){
		//~ int x, y; cin>>x>>y;
		//~ r.pb(x), c.pb(y);
	//~ }
	
	//~ cout<<take_photos(n, m, k, r, c)<<"\n";
	//~ return 0;
//~ }

컴파일 시 표준 에러 (stderr) 메시지

aliens.cpp: In function 'long long int take_photos(int32_t, int32_t, int32_t, std::vector<int>, std::vector<int>)':
aliens.cpp:119:11: error: no matching function for call to 'umin(long long int&, int32_t&)'
  119 |  umin(k, K);
      |           ^
aliens.cpp:36:24: note: candidate: 'template<class T> bool umin(T&, const T&)'
   36 | template<class T> bool umin(T& a, const T& b) { return a > b ? a = b, true : false; }
      |                        ^~~~
aliens.cpp:36:24: note:   template argument deduction/substitution failed:
aliens.cpp:119:11: note:   deduced conflicting types for parameter 'const T' ('long long int' and 'int32_t' {aka 'int'})
  119 |  umin(k, K);
      |           ^