# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
108064 | autumn_eel | Palembang Bridges (APIO15_bridge) | C++14 | 3 ms | 512 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>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
char p[200000][2],q[200000][2];
int s[200000],t[200000];
int main(){
int K,n;cin>>K>>n;
if(K!=1)abort();
vector<int>v;
ll sum=0;
rep(i,n){
scanf("%s%d%s%d",p[i],&s[i],q[i],&t[i]);
if(p[i][0]==q[i][0]){
sum+=abs(s[i]-t[i]);
}
v.push_back(s[i]);
v.push_back(t[i]);
}
sort(v.begin(),v.end());
int md=v[v.size()/2];
for(int i:v)sum+=abs(i-md);
cout<<sum<<endl;
}
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... |