Submission #137100

#TimeUsernameProblemLanguageResultExecution timeMemory
137100KLPPUnija (COCI17_unija)C++14
100 / 100
430 ms31096 KiB
#include<bits/stdc++.h> using namespace std; typedef long long int lld; typedef pair<lld,lld> pii; #define rep(i,a,b) for(int i=a;i<b;i++) int main(){ int n; scanf("%d",&n); pii arr[n]; rep(i,0,n){ scanf("%lld %lld",&arr[i].first,&arr[i].second); arr[i].first/=2; arr[i].second/=2; } sort(arr,arr+n); reverse(arr,arr+n); lld max_second=0; lld ans=0; rep(i,0,n){ ans+=arr[i].first*(max(max_second,arr[i].second)-max_second); max_second=max(max_second,arr[i].second); } printf("%lld\n",ans*4); return 0; }

Compilation message (stderr)

unija.cpp: In function 'int main()':
unija.cpp:10:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&n);
   ~~~~~^~~~~~~~~
unija.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld %lld",&arr[i].first,&arr[i].second);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...
#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...