Submission #443410

# Submission time Handle Problem Language Result Execution time Memory
443410 2021-07-10T13:03:10 Z mjhmjh1104 Fountain Parks (IOI21_parks) C++17
5 / 100
74 ms 8956 KB
#include "parks.h"
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;

int construct_roads(vector<int> x, vector<int> y) {
    if ((int)x.size() == 1) return build({}, {}, {}, {}), 1;
    int n = (int)x.size();
    vector<int> u, v, a, b;
    vector<pair<int, int>> p;
    for (int i = 0; i < n; i++) p.push_back({ y[i], i });
    sort(p.begin(), p.end());
    if (p.back().first - p.front().first == 2 * n - 2) {
        for (int i = 1; i < n; i++) {
            u.push_back(p[i - 1].second);
            v.push_back(p[i].second);
            a.push_back(1);
            b.push_back(p[i - 1].first + 1);
        }
        build(u, v, a, b);
        return 1;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 67 ms 8956 KB Output is correct
10 Correct 6 ms 1148 KB Output is correct
11 Correct 30 ms 4812 KB Output is correct
12 Correct 9 ms 1620 KB Output is correct
13 Correct 13 ms 1928 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 67 ms 8932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 67 ms 8956 KB Output is correct
10 Correct 6 ms 1148 KB Output is correct
11 Correct 30 ms 4812 KB Output is correct
12 Correct 9 ms 1620 KB Output is correct
13 Correct 13 ms 1928 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 67 ms 8932 KB Output is correct
17 Incorrect 0 ms 280 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 67 ms 8956 KB Output is correct
10 Correct 6 ms 1148 KB Output is correct
11 Correct 30 ms 4812 KB Output is correct
12 Correct 9 ms 1620 KB Output is correct
13 Correct 13 ms 1928 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 67 ms 8932 KB Output is correct
17 Incorrect 0 ms 280 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 67 ms 8956 KB Output is correct
10 Correct 6 ms 1148 KB Output is correct
11 Correct 30 ms 4812 KB Output is correct
12 Correct 9 ms 1620 KB Output is correct
13 Correct 13 ms 1928 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 67 ms 8932 KB Output is correct
17 Incorrect 0 ms 280 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 67 ms 8956 KB Output is correct
10 Correct 6 ms 1148 KB Output is correct
11 Correct 30 ms 4812 KB Output is correct
12 Correct 9 ms 1620 KB Output is correct
13 Correct 13 ms 1928 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 67 ms 8932 KB Output is correct
17 Incorrect 74 ms 6676 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 67 ms 8956 KB Output is correct
10 Correct 6 ms 1148 KB Output is correct
11 Correct 30 ms 4812 KB Output is correct
12 Correct 9 ms 1620 KB Output is correct
13 Correct 13 ms 1928 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 67 ms 8932 KB Output is correct
17 Incorrect 0 ms 280 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -