# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
146090 | 2019-08-22T04:09:32 Z | str0ct | Palembang Bridges (APIO15_bridge) | C++14 | 2 ms | 376 KB |
#include<bits/stdc++.h> using namespace std; using ll=long long; ll K,N; vector <pair<ll,ll> > V; ll D1,D2; ll ans; void sol2(){ vector <ll> ab; for(auto p:V){ ab.push_back(p.first); ab.push_back(p.second); } D1=ab[N-1]; for(auto p:ab){ ans+=abs(D1-p); } } int main(){ scanf("%lld%lld",&K,&N); for(ll i=0;i<N;i++){ char p,q; ll s,t; scanf(" %c%lld %c%lld",&p,&s,&q,&t); if(p-'B')V.push_back({s,t}); else V.push_back({t,s}); } if(K-2)sol2(); //else sol1(); printf("%lld",ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |