Submission #836734

# Submission time Handle Problem Language Result Execution time Memory
836734 2023-08-24T14:38:22 Z FulopMate Fountain Parks (IOI21_parks) C++17
0 / 100
1 ms 300 KB
#include "parks.h"
#include <bits/stdc++.h>

using namespace std;

struct fountain{
    int x, y, ind;
    bool operator<(auto&other){
        return make_pair(x, y)<make_pair(other.x, other.y);
    }
};

int construct_roads(vector<int> x, vector<int> y) {
    int n = x.size();
    vector<fountain> v;
    for(int i = 0; i < n; i++){
        v.push_back({y[i], x[i], i}); // FORDITOTT KOORDINATAK!!!!!4!!1!!!14!44!!!
    }
    sort(v.begin(), v.end());
    int el = v[0].x;
    vector<int> ru, rv, ra, rb;
    for(int i = 1; i < n; i++){
        if(v[i-1].x == v[i].x){
            ru.push_back(v[i-1].ind);
            rv.push_back(v[i].ind);
            ra.push_back(v[i].x+1);
            rb.push_back(3);
            el = v[i].x;
        } else if(v[i-1].y == v[i].y && v[i].x-v[i-1].x == 2){
            ru.push_back(v[i-1].ind);
            rv.push_back(v[i].ind);
            ra.push_back(v[i].x-1);
            rb.push_back(v[i].y == 2 ? 1 : 5);
            el = v[i].x;
        }

        if(i > 1){
            if(v[i-2].x == v[i].x){
                ru.push_back(v[i-2].ind);
                rv.push_back(v[i].ind);
                ra.push_back(v[i].x+1);
                rb.push_back(3);
                el = v[i].x;
            } else if(v[i-2].y == v[i].y && v[i].x-v[i-2].x == 2){
                ru.push_back(v[i-2].ind);
                rv.push_back(v[i].ind);
                ra.push_back(v[i].x-1);
                rb.push_back(v[i].y == 2 ? 1 : 5);
                el = v[i].x;    
            }
        }
    }

    if(el == v.back().x){
        build(rv, ru, rb, ra);
        return 1;
    } else {
        return 0;
    }
}


Compilation message

parks.cpp:8:20: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
    8 |     bool operator<(auto&other){
      |                    ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 0 ms 296 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 Incorrect 0 ms 300 KB Given structure is not connected: There is no path between vertices 0 and 2
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 0 ms 296 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 Incorrect 0 ms 300 KB Given structure is not connected: There is no path between vertices 0 and 2
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 0 ms 296 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 Incorrect 0 ms 300 KB Given structure is not connected: There is no path between vertices 0 and 2
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 0 ms 296 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 Incorrect 0 ms 300 KB Given structure is not connected: There is no path between vertices 0 and 2
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 0 ms 296 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 Incorrect 0 ms 300 KB Given structure is not connected: There is no path between vertices 0 and 2
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 0 ms 296 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 Incorrect 0 ms 300 KB Given structure is not connected: There is no path between vertices 0 and 2
8 Halted 0 ms 0 KB -