제출 #1019194

#제출 시각아이디문제언어결과실행 시간메모리
1019194codefoxPalembang Bridges (APIO15_bridge)C++14
22 / 100
77 ms5980 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define pii pair<int, int> int32_t main() { int k, n; cin >> k >> n; vector<pii> jobs; vector<int> pos; int sol = 0; for (int i = 0; i < n; i++) { char c1, c2; int a, b; cin >> c1 >> a >> c2 >> b; if (c1!=c2) { jobs.push_back({a, b}); pos.push_back(a); pos.push_back(b); } else sol += abs(a-b); } sort(pos.begin(), pos.end()); if (k == 1) { int h = pos[pos.size()/2]; for (int ele:pos) sol += abs(ele-h); cout << sol+pos.size()/2; } 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...
#Verdict Execution timeMemoryGrader output
Fetching results...