제출 #708090

#제출 시각아이디문제언어결과실행 시간메모리
708090irmuun도로 폐쇄 (APIO21_roads)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
#include "roads.h"
using namespace std;
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define PI 3.1415926535897932384626433
#define all(s) s.begin(),s.end() 

const ll mod=1000000007,mod1=998244353,INF=1e18,MAX=1e9;

vector<ll> minimum_closure_costs(int n,vector<int>u,vector<int>v,vector<int>w){
    sort(all(w));
    ll cur=0;
    for(ll i=0;i<n;i++){
        ans+=w[i];
    }
    vector<ll>ans;
    ans.pb(cur);
    for(ll i=n-1;i>=0;i--){
        cur-=w[i];
        ans.pb(cur);
    }
    return ans;
}

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

roads.cpp: In function 'std::vector<long long int> minimum_closure_costs(int, std::vector<int>, std::vector<int>, std::vector<int>)':
roads.cpp:17:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |         ans+=w[i];
      |         ^~~
      |         abs