Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main(){
- long p, d, r;
- long va[100000] = {0};
- long vb[100000] = {0};
- long double a, b, ea, eb, te, e;
- long double ta = 0.0;
- long double tb = 0.0;
- long double t = 0.0;
- cin>>p>>d;
- while(p--){
- cin>>r>>a>>b;
- va[r] += a;
- vb[r] += b;
- t += a+b;
- }
- for(int i = 1; i <= d; i++){
- te = floor((va[i]+vb[i])/2)+1;
- if(va[i] > vb[i]){
- ea = va[i]-te;
- eb = vb[i];
- cout<<"A "<<ea<<' '<<eb<<'\n';
- }else{
- ea = va[i];
- eb = vb[i]-te;
- cout<<"B "<<ea<<' '<<eb<<'\n';
- }
- ta += ea;
- tb += eb;
- }
- e = abs(ta-tb);
- e /= t;
- printf("%.10Lf", e);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement