Submission #679152

#TimeUsernameProblemLanguageResultExecution timeMemory
679152hello_there_123Palembang Bridges (APIO15_bridge)C++17
0 / 100
1 ms428 KiB
#include<bits/stdc++.h> using namespace std; #define int long long /* 1 5 B 0 A 4 B 1 B 3 A 5 B 7 B 2 A 6 B 1 A 7 */ main(){ int k,n; cin>>k>>n; if(k==1){ int ans = 0; vector<int>v; for(int i=0;i<n;i++){ char a,b; int c,d; cin>>a>>c>>b>>d; if(a == b){ ans+=abs(c-d); } else{ v.push_back(c); v.push_back(d); ans++; } } sort(v.begin(),v.end()); int x = v[v.size()/2]; for(int i=0;i<v.size();i++){ ans+=abs(v[i]-x); } cout<<ans; } }

Compilation message (stderr)

bridge.cpp:15:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   15 | main(){
      | ^~~~
bridge.cpp: In function 'int main()':
bridge.cpp:36:16: 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]
   36 |   for(int 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...