제출 #146091

#제출 시각아이디문제언어결과실행 시간메모리
146091str0ctPalembang Bridges (APIO15_bridge)C++14
0 / 100
2 ms376 KiB
#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); } sort(ab.begin(),ab.end()); 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); }

컴파일 시 표준 에러 (stderr) 메시지

bridge.cpp: In function 'int main()':
bridge.cpp:21: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:25: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);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...