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;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int K, people;
cin>>K>>people;
vector<int> values;
int output = 0;
while( people-- ){
char p, q;
int s, t;
cin>>p>>s>>q>>t;
if( p != q ){ values.push_back(s); values.push_back(t); }
else{ output += abs(s-t); }
}
int m = values[((int)values.size()+1)/2];
for( int x : values ) output += abs(x-m);
cout<<output<<'\n';
return 0;
}
# | 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... |