MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / main

Function main

Codeforces_problems/Ternary Sequence1401B/solution.cpp:15–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13using namespace std;
14
15int main()
16{
17 ios_base::sync_with_stdio(false);
18 cin.tie(NULL);
19 cout.tie(NULL);
20
21 int test_case=1;
22 cin >> test_case;
23 while(test_case--) {
24 long long x1,x2,y1,y2,z1,z2;
25 cin >> x1 >> y1 >> z1;
26 cin >> x2 >> y2 >> z2;
27
28 long long ans=0;
29 long long m = min(z1,y2);
30 ans+=m*2;
31 z1 -= m;
32 y2 -= m;
33
34 m = min(z2,x1);
35 x1 -= m;
36 z2 -= m;
37
38 m = min(z1,z2);
39 z1 -= m;
40 z2 -= m;
41
42 if(z2 > 0)
43 ans -= z2*2;
44 cout << ans << endl;
45 }
46}
47
48

Callers

nothing calls this directly

Calls 1

minFunction · 0.85

Tested by

no test coverage detected