We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 24db001 commit ec8181aCopy full SHA for ec8181a
1399B - Gifts Fixing.cpp
@@ -0,0 +1,37 @@
1
+#include<bits/stdc++.h>
2
+using namespace std;
3
+
4
+// Code Written By: Vikash Patel
5
6
+// Codeforces Profile: https://codeforces.com/profile/vikashpatel
7
8
+int main()
9
+{
10
+ int t;
11
+ cin>>t;
12
+ while(t--)
13
+ {
14
+ int n;
15
+ cin>>n;
16
+ long long c[n];
17
+ long long o[n];
18
+ long long minC = INT_MAX;
19
+ long long minO = INT_MAX;
20
+ for(long long i=0; i<n; i++)
21
22
+ cin>>c[i];
23
+ minC = min(minC, c[i]);
24
+ }
25
+ for(int i=0; i<n; i++)
26
27
+ cin>>o[i];
28
+ minO = min(minO, o[i]);
29
30
+ long long minMoves=0;
31
+ for(int i=0;i<n;i++)
32
33
+ minMoves += max((c[i]-minC), (o[i]-minO));
34
35
+ cout<<minMoves<<endl;
36
37
+}
0 commit comments