Submission #814285

# Submission time Handle Problem Language Result Execution time Memory
814285 2023-08-08T06:41:11 Z PixelCat Fountain Parks (IOI21_parks) C++17
5 / 100
106 ms 16332 KB
#include "parks.h"

#ifdef NYAOWO
#include "grader.cpp"
#endif

#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Forr(i, a, b) for(int i = a; i >= b; i--)
#define F first
#define S second
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define eb emplace_back
// #define int LL
using namespace std;
using i32 = int32_t;
using LL = long long;
using pii = pair<int, int>;

struct PT {
    int id, x, y;
};

int construct_roads(std::vector<int> X, std::vector<int> Y) {
    if (sz(X) == 1) {
        build({}, {}, {}, {});
        return 1;
    }
    int n = sz(X);

    vector<PT> v;
    For(i, 0, n - 1) {
        v.push_back({i, X[i], Y[i]});
    }
    sort(all(v), [&](const PT &p1, const PT &p2) {
        return p1.y < p2.y;
    });
    vector<int> U, V, A, B;
    For(i, 1, n - 1) {
        if(v[i].y - v[i - 1].y > 2) return 0;
        U.eb(v[i - 1].id);
        V.eb(v[i].id);
        A.eb(1);
        B.eb(v[i].y - 1);
    }
    build(U, V, A, B);
    return 1;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 304 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 53 ms 8540 KB Output is correct
10 Correct 5 ms 1184 KB Output is correct
11 Correct 22 ms 4736 KB Output is correct
12 Correct 8 ms 1640 KB Output is correct
13 Correct 8 ms 2480 KB Output is correct
14 Correct 1 ms 300 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 49 ms 8480 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 304 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 53 ms 8540 KB Output is correct
10 Correct 5 ms 1184 KB Output is correct
11 Correct 22 ms 4736 KB Output is correct
12 Correct 8 ms 1640 KB Output is correct
13 Correct 8 ms 2480 KB Output is correct
14 Correct 1 ms 300 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 49 ms 8480 KB Output is correct
17 Incorrect 1 ms 212 KB Tree (a[0], b[0]) = (1, 1) is not adjacent to edge between u[0]=2 @(4, 2) and v[0]=3 @(2, 2)
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 304 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 53 ms 8540 KB Output is correct
10 Correct 5 ms 1184 KB Output is correct
11 Correct 22 ms 4736 KB Output is correct
12 Correct 8 ms 1640 KB Output is correct
13 Correct 8 ms 2480 KB Output is correct
14 Correct 1 ms 300 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 49 ms 8480 KB Output is correct
17 Incorrect 1 ms 212 KB Tree (a[0], b[0]) = (1, 1) is not adjacent to edge between u[0]=2 @(4, 2) and v[0]=3 @(2, 2)
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 304 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 53 ms 8540 KB Output is correct
10 Correct 5 ms 1184 KB Output is correct
11 Correct 22 ms 4736 KB Output is correct
12 Correct 8 ms 1640 KB Output is correct
13 Correct 8 ms 2480 KB Output is correct
14 Correct 1 ms 300 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 49 ms 8480 KB Output is correct
17 Incorrect 0 ms 296 KB Tree (a[0], b[0]) = (1, 1) is not adjacent to edge between u[0]=0 @(200000, 2) and v[0]=2 @(199998, 2)
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 304 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 53 ms 8540 KB Output is correct
10 Correct 5 ms 1184 KB Output is correct
11 Correct 22 ms 4736 KB Output is correct
12 Correct 8 ms 1640 KB Output is correct
13 Correct 8 ms 2480 KB Output is correct
14 Correct 1 ms 300 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 49 ms 8480 KB Output is correct
17 Incorrect 106 ms 16332 KB Pair u[0]=144319 @(81514, 2) and v[0]=55086 @(31010, 2) does not form a valid edge (distance != 2)
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 304 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 53 ms 8540 KB Output is correct
10 Correct 5 ms 1184 KB Output is correct
11 Correct 22 ms 4736 KB Output is correct
12 Correct 8 ms 1640 KB Output is correct
13 Correct 8 ms 2480 KB Output is correct
14 Correct 1 ms 300 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 49 ms 8480 KB Output is correct
17 Incorrect 1 ms 212 KB Tree (a[0], b[0]) = (1, 1) is not adjacent to edge between u[0]=2 @(4, 2) and v[0]=3 @(2, 2)
18 Halted 0 ms 0 KB -