# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
396972 | leinad2 | Palembang Bridges (APIO15_bridge) | C++17 | 1 ms | 316 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
char c, d;
int a, b, n, i, j, k;
long long ans;
vector<int>v;
main()
{
ios_base::sync_with_stdio(!cin.tie(NULL));
for(cin>>k>>n;i++<n;)
{
cin>>c>>a>>d>>b;
if(c==d)ans+=(b-a);
else ans++,v.push_back(a),v.push_back(b);
}
sort(v.begin(), v.end());
for(i=0;i<v.size();i++)
{
ans+=abs(v[i]-v[v.size()/2]);
}
cout<<ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |