版本比较
题解:P14904 [NHSPC 2024] 计程车叫车问题
正文
增加 4 行删除 4 行
10 行未改动111213141516171819202122232425262728293031323310 行未改动int main() {ios::sync_with_stdio(false);cin.tie(0);int m;cin >> m;for (int i = 0; i < m; i++) cin >> t[i];for (int i = 0; i < m; i++) cin >> p[i];sort(t, t + m);sort(p, p + m);long long ans = 0;for (int i = 0; i < m; i++) {ans += abs(t[i] - p[i]);}cout << ans << "\n";return 0;}```10 行未改动111213141516171819202122232425262728293031323310 行未改动int main() {ios::sync_with_stdio(false);cin.tie(0);int m;cin >> m;for (int i = 0; i < m; i++) cin >> t[i];for (int i = 0; i < m; i++) cin >> p[i];sort(t, t + m);sort(p, p + m);long long ans = 0;for (int i = 0; i < m; i++) {ans += abs(t[i] - p[i]);}cout << ans << "\n";return 0;}```