답안 #210807

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
210807 2020-03-18T11:17:28 Z SorahISA Job Scheduling (IOI19_job) C++17
컴파일 오류
0 ms 0 KB
#include "job.h"
#include <bits/stdc++.h>
using namespace std;

#define int long long

int scheduling_cost(vector<int32_t> p, vector<int32_t> u, vector<int32_t> d) {
    return[&](){for(int i=0,t=0,ans=0;i<p.size();++i)ans+=(t+=d[i])*u[i];return ans;};
}

Compilation message

job.cpp: In lambda function:
job.cpp:8:40: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     return[&](){for(int i=0,t=0,ans=0;i<p.size();++i)ans+=(t+=d[i])*u[i];return ans;};
                                       ~^~~~~~~~~
job.cpp:8:81: error: 'ans' was not declared in this scope
     return[&](){for(int i=0,t=0,ans=0;i<p.size();++i)ans+=(t+=d[i])*u[i];return ans;};
                                                                                 ^~~
job.cpp:8:81: note: suggested alternative: 'abs'
     return[&](){for(int i=0,t=0,ans=0;i<p.size();++i)ans+=(t+=d[i])*u[i];return ans;};
                                                                                 ^~~
                                                                                 abs
job.cpp: In function 'long long int scheduling_cost(std::vector<int>, std::vector<int>, std::vector<int>)':
job.cpp:8:85: error: cannot convert 'scheduling_cost(std::vector<int>, std::vector<int>, std::vector<int>)::<lambda()>' to 'long long int' in return
     return[&](){for(int i=0,t=0,ans=0;i<p.size();++i)ans+=(t+=d[i])*u[i];return ans;};
                                                                                     ^