QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#773338#151. Nice Linessnpmrnhlol100 ✓4ms4040kbC++171.3kb2024-11-23 08:26:132024-11-23 08:26:15

Judging History

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

  • [2024-11-23 08:26:15]
  • 评测
  • 测评结果:100
  • 用时:4ms
  • 内存:4040kb
  • [2024-11-23 08:26:13]
  • 提交

answer

#include <bits/stdc++.h>
#include "nice_lines.h"
typedef long double ld;
typedef long long ll;
using namespace std;
ll M = 1e4;
const ll POS = 33333;
const ld EPS = 0.005;
vector <int> a;
vector <int> b;
vector <ll> points;
void solverange(ld a1, ld b1, ld a2, ld b2){
    ld p = -(b1 - b2)/(a1 - a2);
    ld x = query(POS, p);
    //cout<<a1<<' '<<b1<<' '<<a2<<' '<<b2<<' '<<x<<' '<<p<<'\n';
    if(abs(x - p*a1 - b1) <= EPS){
        points.push_back(round(p));
    }else{
        ///get slope again
        ld x2 = query(POS, p + 1);
        ///should be few and far between?
        ld a3 = x2 - x;
        ld b3 = x - p*a3;
        solverange(a1, b1, a3, b3);
        solverange(a3, b3, a2, b2);
    }
}
void solve(int subtask_id, int n) {
    if(subtask_id == 4){
        M = 500;
    }
    ll RANGE = (POS + 1)*M;
    ld a2 = query(POS, -RANGE);
    ld b2 = query(POS, -RANGE - 1);
    ld c = query(POS, RANGE);
    ld d = query(POS, RANGE + 1);
    solverange((ld)(a2 - b2), a2 + (ld)(a2 - b2)*RANGE, (ld)(d - c), c - (ld)(d - c)*RANGE);
    for(auto i : points){
        ll x = POS, y = i;
        ll a2, b2;
        a2 = (y + M + RANGE*x)/x - RANGE;
        b2 = y - a2*POS;
        a.push_back(a2);
        b.push_back(b2);
    }
    the_lines_are(a, b);
}

详细

Subtask #1:

score: 11
Accepted

Test #1:

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

input:

1 1
333340002.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
333340003.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
333339998.0000000000000000000000000000000000000000000000000000000000000000...

output:

1
33333.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -333340000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
33333.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #2:

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

input:

1 1
149103996.1015815571736311540007591247558593750000000000000000000000000000000000000000000000000000000000000000
149103996.5487951526738470420241355895996093750000000000000000000000000000000000000000000000000000000000000000
149044363.7463304017874179407954216003417968750000000000000000000000000000...

output:

1
33333.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -333340000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
33333.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #3:

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

input:

1 1
65340668.7524608111416455358266830444335937500000000000000000000000000000000000000000000000000000000000000000
65340668.9485769462808093521744012832641601562500000000000000000000000000000000000000000000000000000000000000
65406036.2214637192628288175910711288452148437500000000000000000000000000000...

output:

1
33333.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -333340000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
33333.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #4:

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

input:

1 1
1174413.2842271189317671087337657809257507324218750000000000000000000000000000000000000000000000000000000000
1174413.2878502835560539097059518098831176757812500000000000000000000000000000000000000000000000000000000000
1241078.1075270787886211110162548720836639404296875000000000000000000000000000...

output:

1
33333.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -333340000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
33333.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Subtask #2:

score: 13
Accepted

Test #5:

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

input:

2 2
569070554.5731966667226515710353851318359375000000000000000000000000000000000000000000000000000000000000000000
569070556.2803034479147754609584808349609375000000000000000000000000000000000000000000000000000000000000000000
569023394.3082508368534035980701446533203125000000000000000000000000000000...

output:

1
33333.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -333340000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
33333.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #6:

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

input:

2 2
170783661.0614428059052443131804466247558593750000000000000000000000000000000000000000000000000000000000000000
170783661.5737867070565698668360710144042968750000000000000000000000000000000000000000000000000000000000000000
170785770.9605872378015192225575447082519531250000000000000000000000000000...

output:

1
33333.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -333340000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
33333.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #7:

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

input:

2 2
301024064.7175658975029364228248596191406250000000000000000000000000000000000000000000000000000000000000000000
301024065.6207888138305861502885818481445312500000000000000000000000000000000000000000000000000000000000000000
301136589.1378061364812310785055160522460937500000000000000000000000000000...

output:

1
33333.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -333340000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
33333.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #8:

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

input:

2 2
4042585.4755000234370072575984522700309753417968750000000000000000000000000000000000000000000000000000000000
4042585.4876275184683436236809939146041870117187500000000000000000000000000000000000000000000000000000000000
4042572.9119429664633571519516408443450927734375000000000000000000000000000000...

output:

1
33333.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -333340000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
33333.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Subtask #3:

score: 7
Accepted

Test #9:

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

input:

3 3
634411224.3430417705676518380641937255859375000000000000000000000000000000000000000000000000000000000000000000
634411226.2462646868661977350711822509765625000000000000000000000000000000000000000000000000000000000000000000
634429429.5123302634456194937229156494140625000000000000000000000000000000...

output:

1
33333.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -333340000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
33333.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #10:

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

input:

3 3
493550858.3033482899190858006477355957031250000000000000000000000000000000000000000000000000000000000000000000
493550859.7839750432176515460014343261718750000000000000000000000000000000000000000000000000000000000000000000
493553385.6014928207441698759794235229492187500000000000000000000000000000...

output:

1
33333.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -333340000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
33333.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #11:

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

input:

3 3
10669285.7915730122867898899130523204803466796875000000000000000000000000000000000000000000000000000000000000
10669285.8234802331453465740196406841278076171875000000000000000000000000000000000000000000000000000000000000
10602620.2107062869299625162966549396514892578125000000000000000000000000000...

output:

1
33333.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -333340000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
33333.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #12:

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

input:

3 3
11968555.4127771652129013091325759887695312500000000000000000000000000000000000000000000000000000000000000000
11968555.4485821028056307113729417324066162109375000000000000000000000000000000000000000000000000000000000000
11901880.3816105724781664321199059486389160156250000000000000000000000000000...

output:

1
33333.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -333340000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
33333.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Subtask #4:

score: 19
Accepted

Test #13:

score: 19
Accepted
time: 2ms
memory: 3856kb

input:

4 100
24324298.7902437406373792327940464019775390625000000000000000000000000000000000000000000000000000000000000000
24324300.2496665682047023437917232513427734375000000000000000000000000000000000000000000000000000000000000000
24324101.74388259939587442204356193542480468750000000000000000000000000000...

output:

1
33333.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -16667000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
33333.000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #14:

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

input:

4 100
14985093.1377470506768077029846608638763427734375000000000000000000000000000000000000000000000000000000000000
14985094.0408566060514203854836523532867431640625000000000000000000000000000000000000000000000000000000000000
15119160.78108817906650074291974306106567382812500000000000000000000000000...

output:

1
33333.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -16667000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
33333.000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #15:

score: 19
Accepted
time: 2ms
memory: 3852kb

input:

4 100
11895287.1999732425047113792970776557922363281250000000000000000000000000000000000000000000000000000000000000
11895287.9416734341157280141487717628479003906250000000000000000000000000000000000000000000000000000000000000
12828546.98717777898400527192279696464538574218750000000000000000000000000...

output:

1
33333.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -16667000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
33333.000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #16:

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

input:

4 100
32949564.8569363051883556181564927101135253906250000000000000000000000000000000000000000000000000000000000000
32949566.8293597037627478130161762237548828125000000000000000000000000000000000000000000000000000000000000000
32799196.71113004739345342386513948440551757812500000000000000000000000000...

output:

1
33333.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -16667000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
33333.000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Subtask #5:

score: 23
Accepted

Test #17:

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

input:

5 30
3112971.6866632784829107549740001559257507324218750000000000000000000000000000000000000000000000000000000000
3112971.6960020175761201244313269853591918945312500000000000000000000000000000000000000000000000000000000000
3112978.892003269831548095680773258209228515625000000000000000000000000000000...

output:

1
33333.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -333340000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
33333.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #18:

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

input:

5 30
4247572.3948325183546330663375556468963623046875000000000000000000000000000000000000000000000000000000000000
4247572.4077749573825713014230132102966308593750000000000000000000000000000000000000000000000000000000000000
4380892.856269333708041813224554061889648437500000000000000000000000000000000...

output:

1
33333.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -333340000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
33333.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #19:

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

input:

5 30
2811096.4553120856246550829382613301277160644531250000000000000000000000000000000000000000000000000000000000
2811096.4633452486741589382290840148925781250000000000000000000000000000000000000000000000000000000000000000
2544452.686548451597673192736692726612091064453125000000000000000000000000000...

output:

1
33333.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -333340000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
33333.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #20:

score: 23
Accepted
time: 0ms
memory: 3916kb

input:

5 30
7173687.9599973426120413932949304580688476562500000000000000000000000000000000000000000000000000000000000000
7173687.9807179386298230383545160293579101562500000000000000000000000000000000000000000000000000000000000000
6640318.993089766262528428342193365097045898437500000000000000000000000000000...

output:

1
33333.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -333340000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
33333.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Subtask #6:

score: 27
Accepted

Test #21:

score: 27
Accepted
time: 3ms
memory: 4040kb

input:

6 100
18589920.2125293347726255888119339942932128906250000000000000000000000000000000000000000000000000000000000000
18589920.2694974390014976961538195610046386718750000000000000000000000000000000000000000000000000000000000000
19389575.51593117172342317644506692886352539062500000000000000000000000000...

output:

1
33333.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -333340000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
33333.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #22:

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

input:

6 100
21462389.7634261386174330255016684532165527343750000000000000000000000000000000000000000000000000000000000000
21462389.8270121408950217301025986671447753906250000000000000000000000000000000000000000000000000000000000000
20929126.23504111501279112417250871658325195312500000000000000000000000000...

output:

1
33333.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -333340000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
33333.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #23:

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

input:

6 100
14193440.7462125293914141366258263587951660156250000000000000000000000000000000000000000000000000000000000000
14193440.7879920424302326864562928676605224609375000000000000000000000000000000000000000000000000000000000000
13660125.00620598838850128231570124626159667968750000000000000000000000000...

output:

1
33333.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -333340000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
33333.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct

Test #24:

score: 27
Accepted
time: 3ms
memory: 3840kb

input:

6 100
30631350.7086739742208010284230113029479980468750000000000000000000000000000000000000000000000000000000000000
30631350.8013654370242875302210450172424316406250000000000000000000000000000000000000000000000000000000000000
31164193.71243952394615917000919580459594726562500000000000000000000000000...

output:

1
33333.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -333340000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
33333.00000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 points  1.0 correct