답안 #146090

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
146090 2019-08-22T04:09:32 Z str0ct Palembang Bridges (APIO15_bridge) C++14
0 / 100
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

bridge.cpp: In function 'int main()':
bridge.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld%lld",&K,&N);
     ~~~~~^~~~~~~~~~~~~~~~~~
bridge.cpp:24:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf(" %c%lld %c%lld",&p,&s,&q,&t);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -