2939 | 2023-02-04 17:45:54 | horvathabel | Benzinkút üzemeltetés (55) | cpp17 | Forditási hiba |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n,k;
cin>>n>>k;
vector<vector<int>> q;
for(int i=0; i<n;i++){
int x,y;
cin>>x>>y;
q.push_back({x,y,i+1});
}
int ans=0;
vector<int> mego;
sort(q.begin(), q.end(), greater<vector<int>>());
vector<int> foglalt;
for (auto x:q){
bool szabad=true;
for (int z:foglalt){
if (x[1]<z+k && x[1]>z-k){
szabad=false;
break;
}
}
if (szabad){
ans+=x[0];
foglalt.push_back(x[1]);
mego.push_back(x[2]);
}
}
cout<<ans<<endl<<foglalt.size()<<" ";
sort(mego.begin(), mego.end());
for (auto x: mego) cout<<x<<" ";
exit status 1
main.cpp: In function 'int main()':
main.cpp:33:41: error: expected '}' at end of input
33 | for (auto x: mego) cout<<x<<" ";
| ^
main.cpp:4:12: note: to match this '{'
4 | int main() {
| ^
Exited with error status 1