c++ - error in compilation in codeforces -
can me in
#include <iostream> #include <stdio.h> #include <algorithm> using namespace std; #define ll long long int struct points{ ll a; ll b; }; int cos(points x , points y) { return x.b<y.b; } int main() { ll n,r,avg,i,j,k; points pt[100005]; cin>>n>>r>>avg; for(i=0;i<n;i++) { cin>>pt[i].a>>pt[i].b; } sort(pt,pt+n,cos); ll sum=avg*n; for(i=0;i<n;i++)sum-=pt[i].a; if(sum<=0)cout<<"0\n"; else { ll ans=0; for(i=0;i<n;i++) { if(sum==0)break; else { if(sum>r-pt[i].a) { ans=ans+pt[i].b*(r-pt[i].a); sum=sum-(r-pt[i].a); } else { ans=ans+sum*pt[i].b; sum-=sum; } } } cout<<ans<<endl; } return 0; } when im compiling in system working fine , getting correct output when i'm submitting in codeforces under gnuc++ 11 im getting compllation error? can u me
your compare function, cos(), collides function in standard <cmath>. rename , compile.
Comments
Post a Comment