Submission #759467

# Submission time Handle Problem Language Result Execution time Memory
759467 2023-06-16T10:32:52 Z drdilyor Fountain Parks (IOI21_parks) C++17
5 / 100
47 ms 7860 KB
#include "parks.h"
#include<bits/stdc++.h>
using namespace std;

int construct_roads(std::vector<int> x, std::vector<int> y) {
    if (x.size() == 1) {
        build({}, {}, {}, {});
        return 1;
    }

    int n = x.size();

    std::vector<int> u, v, a, b;
    vector<int> ix(n);
    iota(ix.begin(), ix.end(), 0);
    sort(ix.begin(), ix.end(), [&](int a, int b) {
            return y[a] < y[b];
            });

    for (int i = 1; i <n; i++) {
        u.push_back(ix[i-1]);
        v.push_back(ix[i]);
        a.push_back(1);
        b.push_back(y[ix[i]]-1);
        if (i && y[ix[i]] != y[ix[i-1]]+2)
            return 0;
    }

    build(u, v, a, b);

    return 1;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 46 ms 7860 KB Output is correct
10 Correct 4 ms 1236 KB Output is correct
11 Correct 21 ms 4428 KB Output is correct
12 Correct 6 ms 1676 KB Output is correct
13 Correct 7 ms 2236 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 47 ms 7808 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 46 ms 7860 KB Output is correct
10 Correct 4 ms 1236 KB Output is correct
11 Correct 21 ms 4428 KB Output is correct
12 Correct 6 ms 1676 KB Output is correct
13 Correct 7 ms 2236 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 47 ms 7808 KB Output is correct
17 Incorrect 1 ms 212 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 46 ms 7860 KB Output is correct
10 Correct 4 ms 1236 KB Output is correct
11 Correct 21 ms 4428 KB Output is correct
12 Correct 6 ms 1676 KB Output is correct
13 Correct 7 ms 2236 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 47 ms 7808 KB Output is correct
17 Incorrect 1 ms 212 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 46 ms 7860 KB Output is correct
10 Correct 4 ms 1236 KB Output is correct
11 Correct 21 ms 4428 KB Output is correct
12 Correct 6 ms 1676 KB Output is correct
13 Correct 7 ms 2236 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 47 ms 7808 KB Output is correct
17 Incorrect 0 ms 300 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 46 ms 7860 KB Output is correct
10 Correct 4 ms 1236 KB Output is correct
11 Correct 21 ms 4428 KB Output is correct
12 Correct 6 ms 1676 KB Output is correct
13 Correct 7 ms 2236 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 47 ms 7808 KB Output is correct
17 Incorrect 37 ms 6196 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 46 ms 7860 KB Output is correct
10 Correct 4 ms 1236 KB Output is correct
11 Correct 21 ms 4428 KB Output is correct
12 Correct 6 ms 1676 KB Output is correct
13 Correct 7 ms 2236 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 47 ms 7808 KB Output is correct
17 Incorrect 1 ms 212 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -