제출 #108065

#제출 시각아이디문제언어결과실행 시간메모리
108065autumn_eelPalembang Bridges (APIO15_bridge)C++14
0 / 100
3 ms512 KiB
#include <bits/stdc++.h> #define rep(i,n)for(int i=0;i<(n);i++) using namespace std; typedef long long ll; char p[200000][2],q[200000][2]; int s[200000],t[200000]; int main(){ int K,n;cin>>K>>n; if(K!=1)abort(); vector<int>v; ll sum=0; rep(i,n){ scanf("%s%d%s%d",p[i],&s[i],q[i],&t[i]); if(p[i][0]==q[i][0]){ sum+=abs(s[i]-t[i]); continue; } v.push_back(s[i]); v.push_back(t[i]); } sort(v.begin(),v.end()); int md=v[v.size()/2]; for(int i:v)sum+=abs(i-md); cout<<sum<<endl; }

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

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