Submission #530721

# Submission time Handle Problem Language Result Execution time Memory
530721 2022-02-26T15:01:28 Z Icebear16 Fountain Parks (IOI21_parks) C++17
5 / 100
55 ms 8272 KB
#include "parks.h"
#include <bits/stdc++.h>
int construct_roads(std::vector<int> x, std::vector<int> y) {
    if (x.size() == 1) {
	build({}, {}, {}, {});
        return 1;
    }else{
	    std::vector<int> u, v, a, b;
	    bool flag=true;
	    std::vector<int> p;
	    p=y;
	    std::vector<int> t(x.size(),0);
	    sort(p.begin(),p.end());
	    int m=p[0];
	    for(int i=1;i<x.size();i++){
	    	if(p[i]%2==1 || p[i]-p[i-1]!=2){
	    		flag=false;
	    		break;
			}
		}
		if(flag==true){
		    for(int i=0;i<x.size();i++){
	        	t[(y[i]-m)/2]=i;
			}
			for(int i=0;i<x.size()-1;i++){
		    	u.push_back(t[i]);
		    	v.push_back(t[i+1]);
			    a.push_back(x[i]+1);
		    	b.push_back(p[i]+1);
			}
		    build(u, v, a, b);
		    return 1;
		}else{
			return 0;
		}
	}
}

Compilation message

parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:15:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |      for(int i=1;i<x.size();i++){
      |                  ~^~~~~~~~~
parks.cpp:22:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |       for(int i=0;i<x.size();i++){
      |                   ~^~~~~~~~~
parks.cpp:25:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |    for(int i=0;i<x.size()-1;i++){
      |                ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 53 ms 7476 KB Output is correct
10 Correct 5 ms 1248 KB Output is correct
11 Correct 26 ms 4164 KB Output is correct
12 Correct 7 ms 1612 KB Output is correct
13 Correct 8 ms 1356 KB Output is correct
14 Correct 1 ms 296 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 55 ms 8272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 53 ms 7476 KB Output is correct
10 Correct 5 ms 1248 KB Output is correct
11 Correct 26 ms 4164 KB Output is correct
12 Correct 7 ms 1612 KB Output is correct
13 Correct 8 ms 1356 KB Output is correct
14 Correct 1 ms 296 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 55 ms 8272 KB Output is correct
17 Incorrect 1 ms 292 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 53 ms 7476 KB Output is correct
10 Correct 5 ms 1248 KB Output is correct
11 Correct 26 ms 4164 KB Output is correct
12 Correct 7 ms 1612 KB Output is correct
13 Correct 8 ms 1356 KB Output is correct
14 Correct 1 ms 296 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 55 ms 8272 KB Output is correct
17 Incorrect 1 ms 292 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 53 ms 7476 KB Output is correct
10 Correct 5 ms 1248 KB Output is correct
11 Correct 26 ms 4164 KB Output is correct
12 Correct 7 ms 1612 KB Output is correct
13 Correct 8 ms 1356 KB Output is correct
14 Correct 1 ms 296 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 55 ms 8272 KB Output is correct
17 Incorrect 1 ms 204 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 53 ms 7476 KB Output is correct
10 Correct 5 ms 1248 KB Output is correct
11 Correct 26 ms 4164 KB Output is correct
12 Correct 7 ms 1612 KB Output is correct
13 Correct 8 ms 1356 KB Output is correct
14 Correct 1 ms 296 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 55 ms 8272 KB Output is correct
17 Incorrect 52 ms 7028 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 53 ms 7476 KB Output is correct
10 Correct 5 ms 1248 KB Output is correct
11 Correct 26 ms 4164 KB Output is correct
12 Correct 7 ms 1612 KB Output is correct
13 Correct 8 ms 1356 KB Output is correct
14 Correct 1 ms 296 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 55 ms 8272 KB Output is correct
17 Incorrect 1 ms 292 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -