제출 #288389

#제출 시각아이디문제언어결과실행 시간메모리
288389kevleeWiring (IOI17_wiring)C++17
0 / 100
1088 ms1528 KiB
#include "wiring.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define mod 1000000007 #define h1 7897897897897897 #define h2 7897466719774591 #define b1 98762051 #define b2 98765431 #define inf 1000000000 #define pi 3.1415926535897932384626 #define LMAX 9223372036854775807 #define ll long long #define fi first #define se second #define pii pair<int, int> #define pll pair<ll, ll> #define vi vector<int> #define vl vector<ll> #define vp vector<pii> #define SET(a, b) memset(a, b, sizeof(a)); #define all(x) (x).begin(), (x).end() #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #define FORD(i, a, b) for (int i = (a); i >= (b); i--) int change[100005]; long long min_total_length(vector<int> a, vector<int> b) { ll ans = LMAX; int n = a.size(), m = b.size(); if (n > m) swap(a, b), swap(n, m); FOR(j, 0, m-n) { ll sum = 0; FOR(i, 0, j-1) sum += abs(b[i] - a[0]); FOR(i, j, j+n-1) sum += abs(b[i] - a[i-j]); FOR(i, j+n, m-1) sum += abs(b[i] - a[n-1]); ans = min(ans, sum); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...