Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- // #pragma GCC optimize("Ofast,no-stack-protector")
- // #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
- // #pragma GCC optimize("unroll-loops")
- // template <class T> inline T bigMod(T p,T e,T M){T ret=1; for(;e>0;e>>=1){ if(e&1) ret=(ret*p)%M; p=(p*p)%M;} return (T)ret;}
- // template <class T> inline T modInverse(T a,T M){return bigMod(a,M-2,M);}
- // template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
- // template <class T> inline T lcm(T a,T b) {a=abs(a);b=abs(b); return (a/gcd(a,b))*b;}
- #define ll long long int
- #define vi vector< int >
- #define vll vector< ll >
- #define ff first
- #define ss second
- #define mp make_pair
- #define FOR(i,x,y) for(int i = int(x); i < int(y); i++)
- #define ROF(i,x,y) for(int i = int(x)-1; i >= int(y); i--)
- #define clr(arr,x) memset(arr, 0, sizeof arr)
- #define all(v) v.begin(), v.end()
- #define rall(v) v.rbegin(), v.rend()
- #define unq(v) sort(all(v)),(v).resize(unique(all(v))-v.begin())
- #define fastIO ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)
- #define sc scanf
- #define sc1(x) sc("%d",&x);
- #define sc2(x,y) sc("%d %d", &x, &y)
- #define sc3(x,y,z) sc("%d %d %d", &x, &y, &z)
- #define scl1(x) sc("%lld",&x);
- #define scl2(x,y) sc("%lld %lld", &x, &y)
- #define scf1(x) sc("%lf",&x);
- #define scf2(x,y) sc("%lf %lf", &x, &y)
- #define pf printf
- #define pf1(x) pf("%d",x);
- #define pf2(x,y) pf("%d %d", x, y)
- #define pfl1(x) pf("%lld",x);
- #define spc pf(" ")
- #define line pf("\n")
- #define MOD (int)(998244353)
- #define MaxN 100000
- #define inf 0x3f3f3f3f
- #define PI (2.0*acos(0.0)) // 3.1415926535897932
- #define eps 1e-9
- #define Log(b,x) (log(x)/log(b))
- /*...............Erfan...............*/
- struct Point
- {
- double x1,x2,val;
- void scan(){
- double a,b,c,d;
- scf2(a,b); scf2(c,d);
- x1 = min(a,c);
- x2 = max(a,c);
- scf1(val);
- }
- };
- int main()
- {
- #ifndef ONLINE_JUDGE
- clock_t tStart = clock();
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif
- int t;
- sc1(t);
- FOR(ca,0,t){
- if(ca) line;
- int n,p=0;
- sc1(n);
- Point arr[n];
- double xx[2*n];
- FOR(i,0,n){
- arr[i].scan();
- xx[p++]=arr[i].x1;
- xx[p++]=arr[i].x2;
- }
- sort(xx,xx+p);
- pf("%d\n-inf %.3lf 1.000\n",p+1,xx[0]);
- FOR(i,1,p){
- double ans = 1.0;
- pf("%.3lf %.3lf ",xx[i-1],xx[i]);
- FOR(j,0,n){
- if(arr[j].x1<=xx[i-1] && arr[j].x2>=xx[i]) ans*=arr[j].val;
- }
- pf("%.3lf\n",ans);
- }
- pf("%.3lf +inf 1.000\n",xx[p-1]);
- }
- #ifndef ONLINE_JUDGE
- fprintf(stderr, "\n>> Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
- #endif
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement