답안 #256021

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
256021 2020-08-02T08:27:28 Z theStaticMind Job Scheduling (IOI19_job) C++14
컴파일 오류
0 ms 0 KB
#include "job.h"
#define pb push_back
#define ii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define INF 100000000000000000
#define modulo 1000000007
#define mod 998244353
#define int long long int
using namespace std;

int scheduling_cost(vector<int> p, vector<int> u, vector<int> d){
	int n = sz(p);
	int cost = 0, t = 0;
	for(int i = 0; i < n; i++) t += d[i];
	
	vector<int> seq;
	for(int i = 1; i < n; i++) seq.pb(i);
	sort(all(seq), [&](int x, int y){return u[x] * d[y] < u[y] * d[x];});
	seq.pb(0);

	for(auto x : seq){
		cost += u[x] * t;
		t -= d[x];
	}

	return cost;
}

Compilation message

job.cpp: In function 'long long int scheduling_cost(std::vector<long long int>, std::vector<long long int>, std::vector<long long int>)':
job.cpp:19:2: error: 'sort' was not declared in this scope
  sort(all(seq), [&](int x, int y){return u[x] * d[y] < u[y] * d[x];});
  ^~~~
job.cpp:19:2: note: suggested alternative: 'short'
  sort(all(seq), [&](int x, int y){return u[x] * d[y] < u[y] * d[x];});
  ^~~~
  short