QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#270168#151. Nice Lineszhouhuanyi100 ✓4ms3764kbC++232.2kb2023-11-30 16:05:462023-11-30 16:05:48

Judging History

你现在查看的是最新测评结果

  • [2023-11-30 16:05:48]
  • 评测
  • 测评结果:100
  • 用时:4ms
  • 内存:3764kb
  • [2023-11-30 16:05:46]
  • 提交

answer

#include <iostream>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <cassert>
#include "nice_lines.h"
#define Base 10000
#define N 100
#define S 30000
#define Maxn 300010000
#define sz 20
#define eps 1e-1
#define Eps 1e-3
#define EPS 1e-9
using namespace std;
struct reads
{
    long long num;
    __float128 data;
};
reads tong[N+1];
int length;
struct rds
{
    __float128 x,y;
};
rds get_lines(__float128 l,__float128 r,__float128 d1,__float128 d2)
{
    __float128 k=(d2-d1)/(r-l);
    return (rds){k,d1-l*k};
}
__float128 get_cross(rds a,rds b)
{
    return (a.y-b.y)/(b.x-a.x);
}
__float128 __float128_abs(__float128 x)
{
    return (x>=0)?x:-x;
}
__float128 __float128_sqrt(const __float128 x)
{
    __float128 l=0,r=x,mid;
    for (int i=0;i<100;++i)
    {
	mid=(l+r)/2;
	if (mid*mid<=x) l=mid;
	else r=mid;
    }
    return mid;
}
__float128 __float128_floor(__float128 x)
{
    return floor((long double)(x));
}
__float128 __float128_ceil(__float128 x)
{
    return ceil((long double)(x));
}
void get_solve(__float128 l,__float128 r,rds A,rds B)
{
    __float128 mid=get_cross(A,B),d=query(S,mid);
    if (__float128_abs(mid*A.x+A.y-d)<eps)
    {
	if (!length||__float128_abs(tong[length].data-A.x)>EPS) tong[++length]=(reads){(long long)(__float128_floor(l+0.5)),A.x};
	if (!length||__float128_abs(tong[length].data-B.x)>EPS) tong[++length]=(reads){(long long)(__float128_floor(mid+0.5)),B.x};
	return;
    }
    rds x;
    x=get_lines(mid-sz,mid,query(S,mid-sz),d),get_solve(l,mid,A,x),get_solve(mid,r,x,B);
    return;
}
void solve(int subtask_id, int sn)
{
    vector<int>a;
    vector<int>b;
    __float128 d;
    int A;
    rds sa,sb;
    sa=get_lines(-Maxn,-Maxn+sz,query(S,-Maxn),query(S,-Maxn+sz));
    sb=get_lines(Maxn-sz,Maxn,query(S,Maxn-sz),query(S,Maxn));
    get_solve(-Maxn,Maxn,sa,sb);
    for (int i=2;i<=length;++i)
    {
	d=2.0/(tong[i].data-tong[i-1].data),A=__float128_floor(__float128_sqrt(d*d-1+Eps)+0.5);
	if (tong[i].num>=0) a.push_back(A),b.push_back(tong[i].num-A*S);
	else a.push_back(-A),b.push_back(tong[i].num+A*S);
    }
    the_lines_are(a,b);
    return;
}

详细

Subtask #1:

score: 11
Accepted

Test #1:

score: 11
Accepted
time: 0ms
memory: 3668kb

input:

1 1
300009982.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
300010002.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
300009998.0000000000000000000000000000000000000000000000000000000000000000...

output:

1
30000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -300009980.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
30000.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #2:

score: 11
Accepted
time: 1ms
memory: 3632kb

input:

1 1
134195376.8934684463383746333420276641845703125000000000000000000000000000000000000000000000000000000000000000
134195385.8377403563426923938095569610595703125000000000000000000000000000000000000000000000000000000000000000
134141715.7341444063858943991363048553466796875000000000000000000000000000...

output:

1
30000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -300009980.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
30000.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #3:

score: 11
Accepted
time: 0ms
memory: 3720kb

input:

1 1
58807382.3213745124303386546671390533447265625000000000000000000000000000000000000000000000000000000000000000
58807386.2436972151954250875860452651977539062500000000000000000000000000000000000000000000000000000000000000
58866217.1619159676411072723567485809326171875000000000000000000000000000000...

output:

1
30000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -300009980.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
30000.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #4:

score: 11
Accepted
time: 0ms
memory: 3652kb

input:

1 1
1056986.1129578601800176329561509191989898681640625000000000000000000000000000000000000000000000000000000000
1056986.1854211526667768339393660426139831542968750000000000000000000000000000000000000000000000000000000000
1116985.0524746199920400613336823880672454833984375000000000000000000000000000...

output:

1
30000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -300009980.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
30000.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Subtask #2:

score: 13
Accepted

Test #5:

score: 13
Accepted
time: 0ms
memory: 3756kb

input:

2 2
512170294.6272117192274890840053558349609375000000000000000000000000000000000000000000000000000000000000000000
512170328.7693473429535515606403350830078125000000000000000000000000000000000000000000000000000000000000000000
512127882.0782049026456661522388458251953125000000000000000000000000000000...

output:

1
30000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -300009980.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
30000.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #6:

score: 13
Accepted
time: 1ms
memory: 3668kb

input:

2 2
153707334.9030275761906523257493972778320312500000000000000000000000000000000000000000000000000000000000000000
153707345.1499055992899229750037193298339843750000000000000000000000000000000000000000000000000000000000000000
153709242.4211306802317267283797264099121093750000000000000000000000000000...

output:

1
30000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -300009980.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
30000.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #7:

score: 13
Accepted
time: 1ms
memory: 3708kb

input:

2 2
270925251.9142980408214498311281204223632812500000000000000000000000000000000000000000000000000000000000000000
270925269.9787563673162367194890975952148437500000000000000000000000000000000000000000000000000000000000000000
271026544.2744090610940475016832351684570312500000000000000000000000000000...

output:

1
30000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -300009980.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
30000.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #8:

score: 13
Accepted
time: 1ms
memory: 3676kb

input:

2 2
3638375.6800120064842758438317105174064636230468750000000000000000000000000000000000000000000000000000000000
3638375.9225619071096389234298840165138244628906250000000000000000000000000000000000000000000000000000000000
3638363.6460970339117011462803930044174194335937500000000000000000000000000000...

output:

1
30000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -300009980.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
30000.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Subtask #3:

score: 7
Accepted

Test #9:

score: 7
Accepted
time: 1ms
memory: 3652kb

input:

3 3
570977677.9659705243539065122604370117187500000000000000000000000000000000000000000000000000000000000000000000
570977716.0304288508486934006214141845703125000000000000000000000000000000000000000000000000000000000000000000
570994098.2227365775615908205509185791015625000000000000000000000000000000...

output:

1
30000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -300009980.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
30000.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #10:

score: 7
Accepted
time: 1ms
memory: 3700kb

input:

3 3
444201664.6921001868904568254947662353515625000000000000000000000000000000000000000000000000000000000000000000
444201694.3046352533274330198764801025390625000000000000000000000000000000000000000000000000000000000000000000
444203970.2237483238277491182088851928710937500000000000000000000000000000...

output:

1
30000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -300009980.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
30000.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #11:

score: 7
Accepted
time: 1ms
memory: 3664kb

input:

3 3
9602484.4484160668389449710957705974578857421875000000000000000000000000000000000000000000000000000000000000
9602485.0865604840191736002452671527862548828125000000000000000000000000000000000000000000000000000000000000
9542485.5732577572898662765510380268096923828125000000000000000000000000000000...

output:

1
30000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -300009980.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
30000.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #12:

score: 7
Accepted
time: 1ms
memory: 3764kb

input:

3 3
10771844.1936590520090248901396989822387695312500000000000000000000000000000000000000000000000000000000000000
10771844.9097578038654319243505597114562988281250000000000000000000000000000000000000000000000000000000000000
10711833.7446919026942850905470550060272216796875000000000000000000000000000...

output:

1
30000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -300009980.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
30000.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Subtask #4:

score: 19
Accepted

Test #13:

score: 19
Accepted
time: 4ms
memory: 3712kb

input:

4 100
437841485.7418000657344236969947814941406250000000000000000000000000000000000000000000000000000000000000000000
437841514.9302566170808859169483184814453125000000000000000000000000000000000000000000000000000000000000000000
437841370.06663804143317975103855133056640625000000000000000000000000000...

output:

1
30000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -300009980.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
30000.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #14:

score: 19
Accepted
time: 4ms
memory: 3724kb

input:

4 100
270881538.4417623640038073062896728515625000000000000000000000000000000000000000000000000000000000000000000000
270881556.5039534714596811681985855102539062500000000000000000000000000000000000000000000000000000000000000000
271002238.91152365552261471748352050781250000000000000000000000000000000...

output:

1
30000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -300009980.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
30000.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #15:

score: 19
Accepted
time: 0ms
memory: 3656kb

input:

4 100
222097487.1668414024024968966841697692871093750000000000000000000000000000000000000000000000000000000000000000
222097502.0008452346082776784896850585937500000000000000000000000000000000000000000000000000000000000000000000
222937446.96940603778057266026735305786132812500000000000000000000000000...

output:

1
30000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -300009980.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
30000.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #16:

score: 19
Accepted
time: 0ms
memory: 3676kb

input:

4 100
591814356.8028201058623380959033966064453125000000000000000000000000000000000000000000000000000000000000000000
591814396.2512880773283541202545166015625000000000000000000000000000000000000000000000000000000000000000000000
591679091.36109486129134893417358398437500000000000000000000000000000000...

output:

1
30000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -300009980.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
30000.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Subtask #5:

score: 23
Accepted

Test #17:

score: 23
Accepted
time: 2ms
memory: 3656kb

input:

5 30
2801711.3218767737148482410702854394912719726562500000000000000000000000000000000000000000000000000000000000
2801711.5086515555790356302168220281600952148437500000000000000000000000000000000000000000000000000000000000
2801718.722061083647531631868332624435424804687500000000000000000000000000000...

output:

1
30000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -300009980.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
30000.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #18:

score: 23
Accepted
time: 1ms
memory: 3712kb

input:

5 30
3822866.6525988085809331096243113279342651367187500000000000000000000000000000000000000000000000000000000000
3822866.9114475891385609429562464356422424316406250000000000000000000000000000000000000000000000000000000000
3942855.354056300695674508460797369480133056640625000000000000000000000000000...

output:

1
30000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -300009980.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
30000.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #19:

score: 23
Accepted
time: 1ms
memory: 3696kb

input:

5 30
2530018.9700161140715408691903576254844665527343750000000000000000000000000000000000000000000000000000000000
2530019.1306793750620727223576977849006652832031250000000000000000000000000000000000000000000000000000000000
2290039.362299504676457218010909855365753173828125000000000000000000000000000...

output:

1
30000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -300009980.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
30000.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #20:

score: 23
Accepted
time: 2ms
memory: 3660kb

input:

5 30
6456406.1695040527051787648815661668777465820312500000000000000000000000000000000000000000000000000000000000
6456406.5839159730594474240206182003021240234375000000000000000000000000000000000000000000000000000000000000
5976365.438630566609845118364319205284118652343750000000000000000000000000000...

output:

1
30000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -300009980.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
30000.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Subtask #6:

score: 27
Accepted

Test #21:

score: 27
Accepted
time: 4ms
memory: 3764kb

input:

6 100
16731168.2688219623896657139994204044342041015625000000000000000000000000000000000000000000000000000000000000
16731169.4081840470016686595045030117034912109375000000000000000000000000000000000000000000000000000000000000
17450832.49226425369306525681167840957641601562500000000000000000000000000...

output:

1
30000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -300009980.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
30000.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #22:

score: 27
Accepted
time: 4ms
memory: 3712kb

input:

6 100
19316402.9727763729188154684379696846008300781250000000000000000000000000000000000000000000000000000000000000
19316404.2444964184705895604565739631652832031250000000000000000000000000000000000000000000000000000000000000
18836468.84214233103921287693083286285400390625000000000000000000000000000...

output:

1
30000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -300009980.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
30000.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #23:

score: 27
Accepted
time: 0ms
memory: 3716kb

input:

6 100
12774264.6607002808741526678204536437988281250000000000000000000000000000000000000000000000000000000000000000
12774265.4962905416414287174120545387268066406250000000000000000000000000000000000000000000000000000000000000
12294277.91699043129756319103762507438659667968750000000000000000000000000...

output:

1
30000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -300009980.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
30000.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #24:

score: 27
Accepted
time: 4ms
memory: 3668kb

input:

6 100
27568607.8542281464524421608075499534606933593750000000000000000000000000000000000000000000000000000000000000
27568609.7080574025003443239256739616394042968750000000000000000000000000000000000000000000000000000000000000
28048121.80264716516285261604934930801391601562500000000000000000000000000...

output:

1
30000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -300009980.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
30000.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct