Submission #212700

#TimeUsernameProblemLanguageResultExecution timeMemory
212700iris2617Palembang Bridges (APIO15_bridge)C++14
22 / 100
57 ms4344 KiB
#include <bits/stdc++.h> #define int long long #define iris 998244353 using namespace std; vector<int> ouo; signed main(){ ios::sync_with_stdio(0); cin.tie(0); int i,k,n,x,y,sum; char a,b; cin>>k>>n; sum=0; for(i=0;i<n;i++) { cin>>a>>x>>b>>y; if(a==b) { sum+=abs(x-y); } else { sum++; ouo.emplace_back(x); ouo.emplace_back(y); } } sort(ouo.begin(),ouo.end()); if(ouo.size()) x=ouo[ouo.size()/2]; for(int aoi:ouo) { sum+=abs(aoi-x); } cout<<sum<<'\n'; 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...