제출 #396973

#제출 시각아이디문제언어결과실행 시간메모리
396973leinad2Palembang Bridges (APIO15_bridge)C++17
0 / 100
1 ms256 KiB
#include<bits/stdc++.h> #define int long long using namespace std; char c, d; int a, b, n, i, j, k; long long ans; vector<int>v; main() { ios_base::sync_with_stdio(!cin.tie(NULL)); for(cin>>k>>n;i++<n;) { cin>>c>>a>>d>>b; if(c==d)ans+=(b-a); else ans++,v.push_back(a),v.push_back(b); } sort(v.begin(), v.end()); for(i=0;i<v.size();i++) { ans+=abs(v[i]-v[v.size()/2]); } cout<<ans; }

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

bridge.cpp:8:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main()
      |      ^
bridge.cpp: In function 'int main()':
bridge.cpp:18:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for(i=0;i<v.size();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...