-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsol.cpp
More file actions
60 lines (47 loc) · 1.26 KB
/
Copy pathsol.cpp
File metadata and controls
60 lines (47 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <iostream>
#include <cstdio>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;
int computeOptimalCost(double START, double END, int A, int B)
{
priority_queue<pair<int, double>> PQ; // {cost, CURRENT_WORK}
// Cost of reducing 1 unit straight up
double cost1A = (double)A;
double cost1B = ((double)B) / (END - CURRENT_WORK);
return 42;
}
void solve(int casenum)
{
cout << "Case " << casenum << endl;
double START, END;
int agencies;
cin >> START >> END >> agencies;
cout << START << " " << END << " " << agencies << endl;
vector<pair<int, string>> V;
for (int i = 0; i < agencies; ++i)
{
string s;
cin >> s;
int colon = s.find(':');
string agency = s.substr(0, colon);
string data = s.substr(colon + 1);
int A, B;
sscanf(data.c_str(), "%d,%d", &A, &B);
cout << agency << endl;
cout << data << endl;
cout << A << " - " << B << endl;
V.push_back({computeOptimalCost(START, END, A, B), agency});
}
sort(V.begin(), V.end());
cout << V[0].first << V[0].second << endl;
}
int main()
{
int cases;
cin >> cases;
for (int i = 1; i <= cases; ++i)
solve(i);
}