23 lines
567 B
C++
23 lines
567 B
C++
|
#include <bits/stdc++.h>
|
||
|
using namespace std;
|
||
|
|
||
|
struct dolgozo{
|
||
|
int nap1, nap2, penz;
|
||
|
};
|
||
|
int main() {
|
||
|
int osszespenz = 0;
|
||
|
int n, m;
|
||
|
cin >> n >> m;
|
||
|
int max = 0;
|
||
|
int out;
|
||
|
vector<dolgozo> naposok(n);
|
||
|
for (int i = 0; i < n; i++) {
|
||
|
cin >> naposok[i].nap1 >> naposok[i].nap2 >> naposok[i].penz;
|
||
|
osszespenz += (naposok[i].nap2-naposok[i].nap1+1)*naposok[i].penz;
|
||
|
if (naposok[i].nap2-naposok[i].nap1+1) * naposok[i].penz > max) {
|
||
|
out = i+1;
|
||
|
}
|
||
|
}
|
||
|
cout<<osszespenz<< endl;
|
||
|
cout << out;
|
||
|
}
|