Skip to content

Commit

Permalink
CF2044C Hard Problem
Browse files Browse the repository at this point in the history
  • Loading branch information
Vicfred committed Dec 16, 2024
1 parent c5788b2 commit 5d817b9
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions codeforces/cf2044c_hard_problem.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Vicfred
// https://codeforces.com/contest/2044/problem/C
// implementation
#include <algorithm>
#include <iostream>

using namespace std;

int main() {
int t;
cin >> t;
while (t--) {
long long m, a, b, c;
cin >> m >> a >> b >> c;
long long ans = 0LL;
long long seats = 2LL * m;
long long remaining = 0LL;
ans += min(m, a);
remaining += m - min(m, a);
ans += min(m, b);
remaining += m - min(m, b);
ans += min(remaining, c);
cout << ans << endl;
}
return 0;
}

0 comments on commit 5d817b9

Please sign in to comment.