제출 #1367837

#제출 시각아이디문제언어결과실행 시간메모리
1367837FaresSTH나일강 (IOI24_nile)C++20
컴파일 에러
0 ms0 KiB
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
#define S second
#define F first
struct artifact{int w,a,b,c};
vector<long long>calculate_costs(vector<int>w,vector<int>a,vector<int>b,vector<int>e){
	int n=w.size();
	vector<artifact>v(n);
	for(int i=0;i<n;i++)v[i]=artifact{w[i],a[i],b[i],a[i]-b[i]};
	sort(v.begin(),v.end(),[](auto a,auto b){return a.c<b.c;});
	return accumulate(b.begin(),b.end(),0ll)+(n%2?v.back().c:0);
}

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

nile.cpp:6:27: error: expected ';' at end of member declaration
    6 | struct artifact{int w,a,b,c};
      |                           ^
      |                            ;
nile.cpp: In function 'std::vector<long long int> calculate_costs(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
nile.cpp:12:49: error: could not convert '(std::accumulate<__gnu_cxx::__normal_iterator<int*, vector<int> >, long long int>(b.std::vector<int>::begin(), b.std::vector<int>::end(), 0) + ((long long int)(((n % 2) != 0) ? v.std::vector<artifact>::back().artifact::c : 0)))' from 'long long int' to 'std::vector<long long int>'
   12 |         return accumulate(b.begin(),b.end(),0ll)+(n%2?v.back().c:0);
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
      |                                                 |
      |                                                 long long int