답안 #739528

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
739528 2023-05-10T15:06:29 Z Kirill22 Nicelines (RMI20_nicelines) C++17
31 / 100
146 ms 312 KB
//#include "nice_lines.h"
#include "bits/stdc++.h"

using namespace std;

long double query(long double x, long double y);
void the_lines_are(std::vector<int> a, std::vector<int> b);

void solve(int subtask_id, int N) {
    int x = (1 << 16);
    vector<int> res;
    function<void(int, int)> solve = [&] (int l, int r) {
        //cout << l << " " << r << endl;
        if (r - l < 2) {
            return;
        }
        int m = (l + r) / 2;
        if (abs(query(x, m) * 2 - query(x, l) - query(x, r)) < 1e-4) {
            return;
        }
        if (abs(query(x, m) * 2 - query(x, m + 1) - query(x, m - 1)) > 1e-4) {
            res.push_back(m);
        }
        solve(l, m);
        solve(m, r);
    };
    solve(-x * (1 << 13), x * (1 << 13));
    vector<int> a, b;
    for (int i = 0; i < N; i++) {
        int y = res[i] % x;
        if (y < 0) {
            y += x;
        }
        if (y >= x / 2) {
            y -= x;
        }
        b.push_back(y);
        a.push_back((res[i] - y) / x);
    }
    the_lines_are(a, b);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 308 KB Output is correct
2 Correct 3 ms 304 KB Output is correct
3 Correct 3 ms 300 KB Output is correct
4 Correct 7 ms 312 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 208 KB Output is correct
2 Correct 8 ms 208 KB Output is correct
3 Correct 6 ms 208 KB Output is correct
4 Correct 8 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 208 KB Output is correct
2 Correct 6 ms 296 KB Output is correct
3 Correct 11 ms 208 KB Output is correct
4 Correct 6 ms 304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 146 ms 296 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 89 ms 296 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 146 ms 296 KB Incorrect
2 Halted 0 ms 0 KB -