Submission #824713

# Submission time Handle Problem Language Result Execution time Memory
824713 2023-08-14T09:04:45 Z andrei_boaca Fountain Parks (IOI21_parks) C++17
5 / 100
168 ms 28720 KB
#include "parks.h"
#include <bits/stdc++.h>
//#include "grader.cpp"
using namespace std;

typedef pair<int,int> pii;
map<pii,int> ind;
struct point
{
    int x,y;
} v[200005];
int k;
vector<int> myy[200005];
int construct_roads(std::vector<int> X, std::vector<int> Y)
{
    k=X.size();
    int xmax=0;
    for(int i=0;i<k;i++)
    {
        v[i]={X[i],Y[i]};
        ind[{X[i],Y[i]}]=i;
        xmax=max(xmax,X[i]);
        myy[X[i]].push_back(Y[i]);
    }
    if(xmax<=2)
    {
        sort(myy[2].begin(),myy[2].end());
        vector<int> U,V,a,b;
        for(int i=1;i<myy[2].size();i++)
        {
            if(myy[2][i]-myy[2][i-1]!=2)
                return 0;
            int x=2;
            int yu=myy[2][i-1];
            int yv=myy[2][i];
            U.push_back(ind[{x,yu}]);
            V.push_back(ind[{x,yv}]);
            a.push_back(x-1);
            b.push_back(yv-1);
        }
        build(U,V,a,b);
        return 1;
    }
}

Compilation message

parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:29:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         for(int i=1;i<myy[2].size();i++)
      |                     ~^~~~~~~~~~~~~~
parks.cpp:44:1: warning: control reaches end of non-void function [-Wreturn-type]
   44 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Correct 2 ms 4948 KB Output is correct
3 Correct 2 ms 4948 KB Output is correct
4 Correct 2 ms 4948 KB Output is correct
5 Correct 2 ms 4948 KB Output is correct
6 Correct 2 ms 4948 KB Output is correct
7 Correct 2 ms 5004 KB Output is correct
8 Correct 2 ms 4964 KB Output is correct
9 Correct 92 ms 19892 KB Output is correct
10 Correct 9 ms 6612 KB Output is correct
11 Correct 40 ms 12964 KB Output is correct
12 Correct 14 ms 7448 KB Output is correct
13 Correct 20 ms 10072 KB Output is correct
14 Correct 3 ms 5076 KB Output is correct
15 Correct 3 ms 5204 KB Output is correct
16 Correct 94 ms 19828 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Correct 2 ms 4948 KB Output is correct
3 Correct 2 ms 4948 KB Output is correct
4 Correct 2 ms 4948 KB Output is correct
5 Correct 2 ms 4948 KB Output is correct
6 Correct 2 ms 4948 KB Output is correct
7 Correct 2 ms 5004 KB Output is correct
8 Correct 2 ms 4964 KB Output is correct
9 Correct 92 ms 19892 KB Output is correct
10 Correct 9 ms 6612 KB Output is correct
11 Correct 40 ms 12964 KB Output is correct
12 Correct 14 ms 7448 KB Output is correct
13 Correct 20 ms 10072 KB Output is correct
14 Correct 3 ms 5076 KB Output is correct
15 Correct 3 ms 5204 KB Output is correct
16 Correct 94 ms 19828 KB Output is correct
17 Incorrect 2 ms 4948 KB Given structure is not connected: There is no path between vertices 0 and 1
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Correct 2 ms 4948 KB Output is correct
3 Correct 2 ms 4948 KB Output is correct
4 Correct 2 ms 4948 KB Output is correct
5 Correct 2 ms 4948 KB Output is correct
6 Correct 2 ms 4948 KB Output is correct
7 Correct 2 ms 5004 KB Output is correct
8 Correct 2 ms 4964 KB Output is correct
9 Correct 92 ms 19892 KB Output is correct
10 Correct 9 ms 6612 KB Output is correct
11 Correct 40 ms 12964 KB Output is correct
12 Correct 14 ms 7448 KB Output is correct
13 Correct 20 ms 10072 KB Output is correct
14 Correct 3 ms 5076 KB Output is correct
15 Correct 3 ms 5204 KB Output is correct
16 Correct 94 ms 19828 KB Output is correct
17 Incorrect 2 ms 4948 KB Given structure is not connected: There is no path between vertices 0 and 1
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Correct 2 ms 4948 KB Output is correct
3 Correct 2 ms 4948 KB Output is correct
4 Correct 2 ms 4948 KB Output is correct
5 Correct 2 ms 4948 KB Output is correct
6 Correct 2 ms 4948 KB Output is correct
7 Correct 2 ms 5004 KB Output is correct
8 Correct 2 ms 4964 KB Output is correct
9 Correct 92 ms 19892 KB Output is correct
10 Correct 9 ms 6612 KB Output is correct
11 Correct 40 ms 12964 KB Output is correct
12 Correct 14 ms 7448 KB Output is correct
13 Correct 20 ms 10072 KB Output is correct
14 Correct 3 ms 5076 KB Output is correct
15 Correct 3 ms 5204 KB Output is correct
16 Correct 94 ms 19828 KB Output is correct
17 Incorrect 2 ms 5008 KB Given structure is not connected: There is no path between vertices 0 and 1
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Correct 2 ms 4948 KB Output is correct
3 Correct 2 ms 4948 KB Output is correct
4 Correct 2 ms 4948 KB Output is correct
5 Correct 2 ms 4948 KB Output is correct
6 Correct 2 ms 4948 KB Output is correct
7 Correct 2 ms 5004 KB Output is correct
8 Correct 2 ms 4964 KB Output is correct
9 Correct 92 ms 19892 KB Output is correct
10 Correct 9 ms 6612 KB Output is correct
11 Correct 40 ms 12964 KB Output is correct
12 Correct 14 ms 7448 KB Output is correct
13 Correct 20 ms 10072 KB Output is correct
14 Correct 3 ms 5076 KB Output is correct
15 Correct 3 ms 5204 KB Output is correct
16 Correct 94 ms 19828 KB Output is correct
17 Incorrect 168 ms 28720 KB Given structure is not connected: There is no path between vertices 0 and 1
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Correct 2 ms 4948 KB Output is correct
3 Correct 2 ms 4948 KB Output is correct
4 Correct 2 ms 4948 KB Output is correct
5 Correct 2 ms 4948 KB Output is correct
6 Correct 2 ms 4948 KB Output is correct
7 Correct 2 ms 5004 KB Output is correct
8 Correct 2 ms 4964 KB Output is correct
9 Correct 92 ms 19892 KB Output is correct
10 Correct 9 ms 6612 KB Output is correct
11 Correct 40 ms 12964 KB Output is correct
12 Correct 14 ms 7448 KB Output is correct
13 Correct 20 ms 10072 KB Output is correct
14 Correct 3 ms 5076 KB Output is correct
15 Correct 3 ms 5204 KB Output is correct
16 Correct 94 ms 19828 KB Output is correct
17 Incorrect 2 ms 4948 KB Given structure is not connected: There is no path between vertices 0 and 1
18 Halted 0 ms 0 KB -