답안 #15324

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
15324 2015-07-12T06:01:35 Z seirion 맛있는 과자 (kriii3_A) C++14
33 / 33
6 ms 2496 KB
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;
typedef long long int64;

map<double, pair<double, double> > m;
map<double, int64> ccc;

int64 a, b, n, k;
double dev;

void cut() {
    vector<double> temp;
    map<double, int64> tm;
    for (auto x : ccc) {
        double d = x.first;
        int64 count = x.second;
        if (m.find(d) == m.end()) {
            auto x = make_pair(d*a*a/dev/dev, d*b*b/dev/dev);
            tm[x.first] += count;
            tm[x.second] += count;
            m[d] = x;
        }
        else{
            auto x = m[d];
            tm[x.first] += count;
            tm[x.second] += count;
        }
    }
    ccc.swap(tm);
}

int main() {
    cin >> a >> b >> n >> k;
    dev = sqrt(a*a + b*b);
    ccc[(double)a*b/2] = 1;
    while (n--) {
        cut();
    }

    double r;
    int64 acc = 0;
    for (auto x = ccc.rbegin(); x != ccc.rend(); x++) {
        acc += x->second;
        if (acc >= k) {
            printf("%0.10f\n", log(x->first));
            break;
        }
    }

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1836 KB Output is correct
2 Correct 0 ms 1836 KB Output is correct
3 Correct 0 ms 1836 KB Output is correct
4 Correct 0 ms 1836 KB Output is correct
5 Correct 0 ms 1836 KB Output is correct
6 Correct 0 ms 1836 KB Output is correct
7 Correct 0 ms 1836 KB Output is correct
8 Correct 0 ms 1836 KB Output is correct
9 Correct 0 ms 1836 KB Output is correct
10 Correct 0 ms 1836 KB Output is correct
11 Correct 0 ms 1836 KB Output is correct
12 Correct 0 ms 1836 KB Output is correct
13 Correct 0 ms 1836 KB Output is correct
14 Correct 0 ms 1836 KB Output is correct
15 Correct 0 ms 1836 KB Output is correct
16 Correct 0 ms 1836 KB Output is correct
17 Correct 0 ms 1836 KB Output is correct
18 Correct 0 ms 1836 KB Output is correct
19 Correct 0 ms 1836 KB Output is correct
20 Correct 0 ms 1836 KB Output is correct
21 Correct 0 ms 1836 KB Output is correct
22 Correct 0 ms 1836 KB Output is correct
23 Correct 0 ms 1836 KB Output is correct
24 Correct 0 ms 1836 KB Output is correct
25 Correct 0 ms 1836 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1836 KB Output is correct
2 Correct 0 ms 1836 KB Output is correct
3 Correct 0 ms 1836 KB Output is correct
4 Correct 0 ms 1836 KB Output is correct
5 Correct 0 ms 1836 KB Output is correct
6 Correct 0 ms 1836 KB Output is correct
7 Correct 0 ms 1836 KB Output is correct
8 Correct 0 ms 1836 KB Output is correct
9 Correct 1 ms 1968 KB Output is correct
10 Correct 0 ms 1836 KB Output is correct
11 Correct 0 ms 1836 KB Output is correct
12 Correct 3 ms 2100 KB Output is correct
13 Correct 0 ms 1968 KB Output is correct
14 Correct 0 ms 2232 KB Output is correct
15 Correct 4 ms 2232 KB Output is correct
16 Correct 2 ms 2100 KB Output is correct
17 Correct 0 ms 2100 KB Output is correct
18 Correct 0 ms 2232 KB Output is correct
19 Correct 4 ms 2496 KB Output is correct
20 Correct 6 ms 2496 KB Output is correct
21 Correct 0 ms 2232 KB Output is correct
22 Correct 6 ms 2496 KB Output is correct
23 Correct 4 ms 2496 KB Output is correct
24 Correct 3 ms 2364 KB Output is correct
25 Correct 0 ms 1836 KB Output is correct