Submission #1059527

# Submission time Handle Problem Language Result Execution time Memory
1059527 2024-08-15T04:38:02 Z pcc Fountain Parks (IOI21_parks) C++17
5 / 100
38 ms 9384 KB
#include "parks.h"
#include <bits/stdc++.h>
using namespace std;

#define pii pair<int,int>
#define fs first
#define sc second

int N;

int construct_roads(std::vector<int> x, std::vector<int> y) {
    if (x.size() == 1) {
		build({}, {}, {}, {});
        return 1;
    }
	N = x.size();
	vector<pii> v;
	for(int i = 0;i<N;i++)v.push_back(pii(x[i],y[i]));
	vector<int> perm(N);iota(perm.begin(),perm.end(),0);
	sort(perm.begin(),perm.end(),[&](int a,int b){return y[a]<y[b];});
	for(int i = 1;i<perm.size();i++){
		int now = perm[i],pre = perm[i-1];
		if(y[pre]+2 != y[now])return 0;
	}
	vector<int> ans[4];
	for(int i = 1;i<perm.size();i++){
		int pre = perm[i-1],now = perm[i];
		ans[0].push_back(pre);
		ans[1].push_back(now);
		ans[2].push_back(3);
		ans[3].push_back((y[now]+y[pre])>>1);
	}
	build(ans[0],ans[1],ans[2],ans[3]);
	return 1;
}

Compilation message

parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:21:17: 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 = 1;i<perm.size();i++){
      |                ~^~~~~~~~~~~~
parks.cpp:26:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |  for(int i = 1;i<perm.size();i++){
      |                ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 600 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 38 ms 9384 KB Output is correct
10 Correct 3 ms 1292 KB Output is correct
11 Correct 16 ms 4996 KB Output is correct
12 Correct 5 ms 1764 KB Output is correct
13 Correct 6 ms 2008 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 38 ms 9384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 600 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 38 ms 9384 KB Output is correct
10 Correct 3 ms 1292 KB Output is correct
11 Correct 16 ms 4996 KB Output is correct
12 Correct 5 ms 1764 KB Output is correct
13 Correct 6 ms 2008 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 38 ms 9384 KB Output is correct
17 Incorrect 0 ms 344 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 600 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 38 ms 9384 KB Output is correct
10 Correct 3 ms 1292 KB Output is correct
11 Correct 16 ms 4996 KB Output is correct
12 Correct 5 ms 1764 KB Output is correct
13 Correct 6 ms 2008 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 38 ms 9384 KB Output is correct
17 Incorrect 0 ms 344 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 600 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 38 ms 9384 KB Output is correct
10 Correct 3 ms 1292 KB Output is correct
11 Correct 16 ms 4996 KB Output is correct
12 Correct 5 ms 1764 KB Output is correct
13 Correct 6 ms 2008 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 38 ms 9384 KB Output is correct
17 Incorrect 0 ms 348 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 600 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 38 ms 9384 KB Output is correct
10 Correct 3 ms 1292 KB Output is correct
11 Correct 16 ms 4996 KB Output is correct
12 Correct 5 ms 1764 KB Output is correct
13 Correct 6 ms 2008 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 38 ms 9384 KB Output is correct
17 Incorrect 38 ms 7856 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 600 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 38 ms 9384 KB Output is correct
10 Correct 3 ms 1292 KB Output is correct
11 Correct 16 ms 4996 KB Output is correct
12 Correct 5 ms 1764 KB Output is correct
13 Correct 6 ms 2008 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 38 ms 9384 KB Output is correct
17 Incorrect 0 ms 344 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -