답안 #1117433

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1117433 2024-11-23T15:10:00 Z Tenis0206 Nicelines (RMI20_nicelines) C++11
86.0325 / 100
71 ms 1344 KB
#include <bits/stdc++.h>
#include "nice_lines.h"

using namespace std;

int cmax = 1e4;
long double eps;

vector<int> a, b;

map<pair<long double, long double>, bool> sel;
map<pair<long double, long double>, long double> rez_query;

long double my_query(long double A, long double B)
{
    if(!sel[ {A,B}])
    {
        sel[ {A, B}] = true;
        rez_query[ {A, B}] = query(A, B);
    }
    return rez_query[ {A, B}];
}

int aprox(long double val)
{
    return (int)(val + 0.5);
}

void solve(int subtask_id, int n)
{
    if(subtask_id == 4)
    {
        cmax = 500;
    }
    long long A = cmax + 9;
    long long B = (A + 1) * cmax + 1;
    eps = (my_query(A, B) - my_query(A, B - 1)) * 0.001;
    for(int i=0; i<n; i++)
    {
        long double dif = my_query(A, B) - my_query(A, B - 1);
        long long st = -(A + 1) * cmax - 1 + (n - 1);
        long long dr = B - 1;
        long double dif_B = 0;
        long long poz = 0;
        while(st <= dr)
        {
            long long mij = (st + dr) >> 1LL;
            long double dif_mij = my_query(A, B) - my_query(A, mij - 1);
            if(abs(dif_mij - (B - mij + 1) * dif) > eps)
            {
                poz = mij;
                st = mij + 1;
            }
            else
            {
                dr = mij - 1;
            }
        }
        B = poz;
        dif_B = my_query(A, B) - my_query(A, B - 1);
            long double val_cos = 0.5 * (dif - dif_B);
            int cur_a = aprox(sqrt(1 - val_cos * val_cos) / val_cos);
            int cur_b = B - cur_a * A;
            if(cur_b < -cmax || cur_b > cmax)
            {
                cur_a *= (-1);
                cur_b = B - cur_a * A;
            }
            a.push_back(cur_a);
            b.push_back(cur_b);
    }
    the_lines_are(a, b);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 2 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 336 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 2 ms 336 KB Output is correct
4 Correct 2 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 336 KB Output is correct
2 Incorrect 3 ms 336 KB Incorrect
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 51 ms 1092 KB Output is partially correct
2 Partially correct 48 ms 1344 KB Output is partially correct
3 Partially correct 43 ms 720 KB Output is partially correct
4 Partially correct 42 ms 604 KB Output is partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 18 ms 1108 KB Output is partially correct
2 Partially correct 22 ms 848 KB Output is partially correct
3 Partially correct 19 ms 556 KB Output is partially correct
4 Partially correct 20 ms 524 KB Output is partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 51 ms 1092 KB Output is partially correct
2 Partially correct 48 ms 1344 KB Output is partially correct
3 Partially correct 43 ms 720 KB Output is partially correct
4 Partially correct 42 ms 604 KB Output is partially correct
5 Partially correct 18 ms 1108 KB Output is partially correct
6 Partially correct 22 ms 848 KB Output is partially correct
7 Partially correct 19 ms 556 KB Output is partially correct
8 Partially correct 20 ms 524 KB Output is partially correct
9 Partially correct 66 ms 912 KB Output is partially correct
10 Partially correct 67 ms 856 KB Output is partially correct
11 Partially correct 71 ms 1140 KB Output is partially correct
12 Partially correct 69 ms 1280 KB Output is partially correct