QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#773302 | #151. Nice Lines | snpmrnhlol | 93 | 4ms | 4112kb | C++17 | 1.2kb | 2024-11-23 08:19:54 | 2024-11-23 08:19:54 |
Judging History
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 = 41234;
const ld EPS = 1e-2;
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);
if(abs(x - p*a1 - b1) <= EPS){
points.push_back(round(p));
}else{
///get slope again
ld x2 = query(POS, p + (ld)1/2);
///should be few and far between?
ld a3 = (x2 - x)*2;
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: 1ms
memory: 4048kb
input:
1 1 412350002.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 412350003.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 412349998.0000000000000000000000000000000000000000000000000000000000000000...
output:
1 41234.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -412350000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1 41234.00000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 points 1.0 correct
Test #2:
score: 11
Accepted
time: 0ms
memory: 3908kb
input:
1 1 184445409.1512693242984823882579803466796875000000000000000000000000000000000000000000000000000000000000000000 184445409.5984829197986982762813568115234375000000000000000000000000000000000000000000000000000000000000000000 184371643.0575459882384166121482849121093750000000000000000000000000000000...
output:
1 41234.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -412350000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1 41234.00000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 points 1.0 correct
Test #3:
score: 11
Accepted
time: 1ms
memory: 3900kb
input:
1 1 80828057.0218100975471315905451774597167968750000000000000000000000000000000000000000000000000000000000000000 80828057.2179262326826574280858039855957031250000000000000000000000000000000000000000000000000000000000000000 80908919.6266502735816175118088722229003906250000000000000000000000000000000...
output:
1 41234.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -412350000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1 41234.00000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 points 1.0 correct
Test #4:
score: 11
Accepted
time: 0ms
memory: 3832kb
input:
1 1 1452778.5730557836359366774559020996093750000000000000000000000000000000000000000000000000000000000000000000 1452778.5766789482603371652658097445964813232421875000000000000000000000000000000000000000000000000000000000 1535245.2926364328096724420902319252490997314453125000000000000000000000000000...
output:
1 41234.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -412350000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1 41234.00000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 points 1.0 correct
Subtask #2:
score: 13
Accepted
Test #5:
score: 13
Accepted
time: 1ms
memory: 3848kb
input:
2 2 703954648.2054239415447227656841278076171875000000000000000000000000000000000000000000000000000000000000000000 703954649.9125307226786389946937561035156250000000000000000000000000000000000000000000000000000000000000000000 703896314.2391218018601648509502410888671875000000000000000000000000000000...
output:
1 41234.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -412350000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1 41234.00000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 points 1.0 correct
Test #6:
score: 13
Accepted
time: 1ms
memory: 3900kb
input:
2 2 211263700.6705203545279800891876220703125000000000000000000000000000000000000000000000000000000000000000000000 211263701.1828642556793056428432464599609375000000000000000000000000000000000000000000000000000000000000000000 211266314.6120262601180002093315124511718750000000000000000000000000000000...
output:
1 41234.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -412350000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1 41234.00000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 points 1.0 correct
Test #7:
score: 13
Accepted
time: 1ms
memory: 3884kb
input:
2 2 372374372.9177861489006318151950836181640625000000000000000000000000000000000000000000000000000000000000000000 372374373.8210090652282815426588058471679687500000000000000000000000000000000000000000000000000000000000000000 372513566.1752199656039010733366012573242187500000000000000000000000000000...
output:
1 41234.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -412350000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1 41234.00000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 points 1.0 correct
Test #8:
score: 13
Accepted
time: 1ms
memory: 3884kb
input:
2 2 5000779.1982015107168990653008222579956054687500000000000000000000000000000000000000000000000000000000000000 5000779.2103290057480080577079206705093383789062500000000000000000000000000000000000000000000000000000000000 5000765.9540817942729518108535557985305786132812500000000000000000000000000000...
output:
1 41234.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -412350000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1 41234.00000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 points 1.0 correct
Subtask #3:
score: 0
Wrong Answer
Test #9:
score: 7
Accepted
time: 0ms
memory: 3880kb
input:
3 3 784782706.2446183317806571722030639648437500000000000000000000000000000000000000000000000000000000000000000000 784782708.1478412480792030692100524902343750000000000000000000000000000000000000000000000000000000000000000000 784805232.8483877827529795467853546142578125000000000000000000000000000000...
output:
1 41234.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -412350000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1 41234.00000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 points 1.0 correct
Test #10:
score: 0
Wrong Answer
time: 1ms
memory: 3896kb
input:
3 3 610534880.1316806337563320994377136230468750000000000000000000000000000000000000000000000000000000000000000000 610534881.6123073870548978447914123535156250000000000000000000000000000000000000000000000000000000000000000000 610538003.3331337659037671983242034912109375000000000000000000000000000000...
output:
1 41234.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -412350000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1 41234.00000000000000000000000000000000000000000000000000000000000000000000000...
result:
wrong answer Invalid Answer!
Subtask #4:
score: 19
Accepted
Test #13:
score: 19
Accepted
time: 2ms
memory: 3840kb
input:
4 100 30089810.5211105255639267852529883384704589843750000000000000000000000000000000000000000000000000000000000000 30089811.9805333531312498962506651878356933593750000000000000000000000000000000000000000000000000000000000000 30089489.77362456867376749869436025619506835937500000000000000000000000000...
output:
1 41234.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -20617500.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1 41234.000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 points 1.0 correct
Test #14:
score: 19
Accepted
time: 0ms
memory: 4040kb
input:
4 100 18536962.3375680347635352518409490585327148437500000000000000000000000000000000000000000000000000000000000000 18536963.2406775901363289449363946914672851562500000000000000000000000000000000000000000000000000000000000000 18702760.17827676929482549894601106643676757812500000000000000000000000000...
output:
1 41234.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -20617500.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1 41234.000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 points 1.0 correct
Test #15:
score: 19
Accepted
time: 0ms
memory: 4112kb
input:
4 100 14714770.6893039233782474184408783912658691406250000000000000000000000000000000000000000000000000000000000000 14714771.4310041149892640532925724983215332031250000000000000000000000000000000000000000000000000000000000000 15869236.71176322641167644178494811058044433593750000000000000000000000000...
output:
1 41234.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -20617500.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1 41234.000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 points 1.0 correct
Test #16:
score: 19
Accepted
time: 4ms
memory: 3912kb
input:
4 100 40759477.4957930430718988645821809768676757812500000000000000000000000000000000000000000000000000000000000000 40759479.4682164416444720700383186340332031250000000000000000000000000000000000000000000000000000000000000000 40573401.34440663439818308688700199127197265625000000000000000000000000000...
output:
1 41234.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -20617500.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1 41234.000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 points 1.0 correct
Subtask #5:
score: 23
Accepted
Test #17:
score: 23
Accepted
time: 2ms
memory: 3900kb
input:
5 30 3850825.4719829972536899731494486331939697265625000000000000000000000000000000000000000000000000000000000000 3850825.4813217363468993426067754626274108886718750000000000000000000000000000000000000000000000000000000000 3850832.658193852801559842191636562347412109375000000000000000000000000000000...
output:
1 41234.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -412350000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1 41234.00000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 points 1.0 correct
Test #18:
score: 23
Accepted
time: 2ms
memory: 3892kb
input:
5 30 5254352.4801083436582302965689450502395629882812500000000000000000000000000000000000000000000000000000000000 5254352.4930507826861685316544026136398315429687500000000000000000000000000000000000000000000000000000000000 5419276.986177876711280987365171313285827636718750000000000000000000000000000...
output:
1 41234.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -412350000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1 41234.00000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 points 1.0 correct
Test #19:
score: 23
Accepted
time: 1ms
memory: 4040kb
input:
5 30 3477400.6683102992924432328436523675918579101562500000000000000000000000000000000000000000000000000000000000 3477400.6763434623419470881344750523567199707031250000000000000000000000000000000000000000000000000000000000 3147548.898636939333755435654893517494201660156250000000000000000000000000000...
output:
1 41234.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -412350000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1 41234.00000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 points 1.0 correct
Test #20:
score: 23
Accepted
time: 1ms
memory: 4048kb
input:
5 30 8874030.0399310062284712330438196659088134765625000000000000000000000000000000000000000000000000000000000000 8874030.0606516022462528781034052371978759765625000000000000000000000000000000000000000000000000000000000000 8214245.495874685690523619996383786201477050781250000000000000000000000000000...
output:
1 41234.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -412350000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1 41234.00000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 points 1.0 correct
Subtask #6:
score: 27
Accepted
Test #21:
score: 27
Accepted
time: 3ms
memory: 3836kb
input:
6 100 22996157.8678345008884207345545291900634765625000000000000000000000000000000000000000000000000000000000000000 22996157.9248026051191118312999606132507324218750000000000000000000000000000000000000000000000000000000000000 23985437.69114638905375613830983638763427734375000000000000000000000000000...
output:
1 41234.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -412350000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1 41234.00000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 points 1.0 correct
Test #22:
score: 27
Accepted
time: 4ms
memory: 3836kb
input:
6 100 26549527.9527641880868031876161694526672363281250000000000000000000000000000000000000000000000000000000000000 26549528.0163501903643918922170996665954589843750000000000000000000000000000000000000000000000000000000000000 25889848.12561816036941308993846178054809570312500000000000000000000000000...
output:
1 41234.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -412350000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1 41234.00000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 points 1.0 correct
Test #23:
score: 27
Accepted
time: 3ms
memory: 3836kb
input:
6 100 17557648.2618541811225441051647067070007324218750000000000000000000000000000000000000000000000000000000000000 17557648.3036336941604531602934002876281738281250000000000000000000000000000000000000000000000000000000000000 16897916.14088709147290501277893781661987304687500000000000000000000000000...
output:
1 41234.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -412350000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1 41234.00000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 points 1.0 correct
Test #24:
score: 27
Accepted
time: 4ms
memory: 4056kb
input:
6 100 37891691.7365382205935020465403795242309570312500000000000000000000000000000000000000000000000000000000000000 37891691.8292296833969885483384132385253906250000000000000000000000000000000000000000000000000000000000000000 38550957.63661276929269661195576190948486328125000000000000000000000000000...
output:
1 41234.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -412350000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1 41234.00000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 points 1.0 correct