Submission #1092006

#TimeUsernameProblemLanguageResultExecution timeMemory
1092006alex2407K blocks (IZhO14_blocks)C++17
0 / 100
0 ms348 KiB
#include <iostream> #include <cmath> using namespace std; int main() { long long n, a[110], b[110], sum = 0, mini = 1000000000; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { cin >> b[i]; } for (int i = -1000; i < 1001; i++) { sum = 0; for (int j = 0; j < n; j++) { sum += abs(a[j] + i - b[j]); } mini = min(mini, sum); } cout << mini << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...