Submission #436669

# Submission time Handle Problem Language Result Execution time Memory
436669 2021-06-24T17:58:22 Z PiejanVDC Fountain Parks (IOI21_parks) C++17
0 / 100
3 ms 1704 KB
#include "parks.h"
#include <bits/stdc++.h>
using namespace std;

int construct_roads(vector<int>x, vector<int> y) {
    vector<pair<int,int>>z(y.size());
    for(int i = 0 ; i < y.size() ; i++) z[i].first=y[i],z[i].second=i;
    sort(z.begin(),z.end());
    for(int i = 1 ; i < y.size() ; i++) {
        if(z[i].first-z[i-1].first != 2) {
            return 0;
        }
    }

    vector<int>u(y.size()-1);
    vector<int>v(y.size()-1);
    vector<int>a(y.size()-1),b(y.size()-1);

    for(int i = 0 ; i < y.size()-2 ; i++) {
        u.push_back(z[i].second);
        v.push_back(z[i+1].second);
        a.push_back(z[i].second+1);
        b.push_back(z[i].second+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:7:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |     for(int i = 0 ; i < y.size() ; i++) z[i].first=y[i],z[i].second=i;
      |                     ~~^~~~~~~~~~
parks.cpp:9:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for(int i = 1 ; i < y.size() ; i++) {
      |                     ~~^~~~~~~~~~
parks.cpp:19:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     for(int i = 0 ; i < y.size()-2 ; i++) {
      |                     ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 1704 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 1704 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 1704 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 1704 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 1704 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 1704 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -