Submission #587996

# Submission time Handle Problem Language Result Execution time Memory
587996 2022-07-02T15:55:44 Z Clan328 Fountain Parks (IOI21_parks) C++17
5 / 100
58 ms 10268 KB
#include "parks.h"
#include <bits/stdc++.h>

using namespace std;

#define pb push_back

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

    vector<pair<int, int>> yi(y.size());
    for (int i = 0; i < y.size(); i++) {
        yi[i] = {y[i], i};
    }
    sort(yi.begin(), yi.end());
    bool res = true;
    for (int i = 0; i < y.size()-1; i++) {
        res &= yi[i].first+2 == yi[i+1].first;
        u.pb(yi[i].second);
        v.pb(yi[i+1].second);
        a.pb(3);
        b.pb(yi[i].first+1);
    }

    if (!res) return 0;

    
    // int maxY = 0;
    // for (int i = 0; i < y.size(); i++) maxY = max(maxY, y[i]);

    // vvi mat(maxY/2-1, vi(3)), matIdx(maxY/2-1, vi(3));
    // for (int i = 0; i < x.size(); i++) {
    //     mat[x[i]/2-1][y[i]/2-1] = 1;
    //     matIdx[x[i]/2-1][y[i]/2-1] = i;
    // }



    build(u, v, a, b);
    return 1;
}

Compilation message

parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:16:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for (int i = 0; i < y.size(); i++) {
      |                     ~~^~~~~~~~~~
parks.cpp:21:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for (int i = 0; i < y.size()-1; i++) {
      |                     ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 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 1 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 54 ms 8200 KB Output is correct
10 Correct 5 ms 1364 KB Output is correct
11 Correct 26 ms 4604 KB Output is correct
12 Correct 8 ms 1748 KB Output is correct
13 Correct 8 ms 2516 KB Output is correct
14 Correct 1 ms 300 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 54 ms 8220 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 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 1 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 54 ms 8200 KB Output is correct
10 Correct 5 ms 1364 KB Output is correct
11 Correct 26 ms 4604 KB Output is correct
12 Correct 8 ms 1748 KB Output is correct
13 Correct 8 ms 2516 KB Output is correct
14 Correct 1 ms 300 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 54 ms 8220 KB Output is correct
17 Incorrect 0 ms 212 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 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 1 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 54 ms 8200 KB Output is correct
10 Correct 5 ms 1364 KB Output is correct
11 Correct 26 ms 4604 KB Output is correct
12 Correct 8 ms 1748 KB Output is correct
13 Correct 8 ms 2516 KB Output is correct
14 Correct 1 ms 300 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 54 ms 8220 KB Output is correct
17 Incorrect 0 ms 212 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 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 1 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 54 ms 8200 KB Output is correct
10 Correct 5 ms 1364 KB Output is correct
11 Correct 26 ms 4604 KB Output is correct
12 Correct 8 ms 1748 KB Output is correct
13 Correct 8 ms 2516 KB Output is correct
14 Correct 1 ms 300 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 54 ms 8220 KB Output is correct
17 Incorrect 0 ms 212 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 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 1 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 54 ms 8200 KB Output is correct
10 Correct 5 ms 1364 KB Output is correct
11 Correct 26 ms 4604 KB Output is correct
12 Correct 8 ms 1748 KB Output is correct
13 Correct 8 ms 2516 KB Output is correct
14 Correct 1 ms 300 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 54 ms 8220 KB Output is correct
17 Incorrect 58 ms 10268 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 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 1 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 54 ms 8200 KB Output is correct
10 Correct 5 ms 1364 KB Output is correct
11 Correct 26 ms 4604 KB Output is correct
12 Correct 8 ms 1748 KB Output is correct
13 Correct 8 ms 2516 KB Output is correct
14 Correct 1 ms 300 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 54 ms 8220 KB Output is correct
17 Incorrect 0 ms 212 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -