답안 #566608

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
566608 2022-05-22T13:02:02 Z josanneo22 도로 폐쇄 (APIO21_roads) C++17
컴파일 오류
0 ms 0 KB
#include "roads.h"

#include <vector>
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<stdlib.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b); i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)
 
#define mp make_pair
#define pb push_back
#define rsz resize
#define sz(x) int(x.size())
#define all(x) begin(x), end(x)
#define f first
#define s second
#define out(x) cout<<x<<'\n';
#define in(x) cin>>x;
#define inarr(a,x,y) for(int i=x;i<y;i++){cin>>a[i];}
#define incor(a,x,y) for(int i=x;i<y;i++){cin>>a[i].f>>a[i].s;}

vll minimum_closure_costs(int n, vi u,vi v,vi w) 
{
	sort(all(w));
	vll val.rsz(n);
	FOR(i,0,n)
	{
		if(i) val[i]=((ll)w[i]+val[i-1]);
		else val[i]=((ll)w[i]);
	}
	return val;
}

Compilation message

roads.cpp: In function 'vll minimum_closure_costs(int, vi, vi, vi)':
roads.cpp:39:9: error: expected initializer before '.' token
   39 |  vll val.rsz(n);
      |         ^
roads.cpp:42:9: error: 'val' was not declared in this scope; did you mean 'vll'?
   42 |   if(i) val[i]=((ll)w[i]+val[i-1]);
      |         ^~~
      |         vll
roads.cpp:43:8: error: 'val' was not declared in this scope; did you mean 'vll'?
   43 |   else val[i]=((ll)w[i]);
      |        ^~~
      |        vll
roads.cpp:45:9: error: 'val' was not declared in this scope; did you mean 'vll'?
   45 |  return val;
      |         ^~~
      |         vll