제출 #111336

#제출 시각아이디문제언어결과실행 시간메모리
111336ppnxblstrPalembang Bridges (APIO15_bridge)C++14
0 / 100
2 ms384 KiB
#include <bits/stdc++.h> using namespace std; char p[2]; char q[2]; int main(){ int k, n; scanf("%d%d",&k,&n); vector<int> v; int s, t; long long d = 0ll; for(int i = 1; i <= n; i++){ scanf("%s%d%s%d",p,&s,q,&t); if(p[0] == q[0]){ d += (long long)abs(s - t); }else{ v.push_back(s); v.push_back(t); } } sort(v.begin(), v.end()); if(k == 1){ int x = v[(v.size()-1)/2]; for(int i : v){ d += (long long)abs(i - x) + 1ll; } printf("%lld\n",d); return 0; } }

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

bridge.cpp: In function 'int main()':
bridge.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&k,&n);
     ~~~~~^~~~~~~~~~~~~~
bridge.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s%d%s%d",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...