Submission #436674

# Submission time Handle Problem Language Result Execution time Memory
436674 2021-06-24T18:02:20 Z PiejanVDC Fountain Parks (IOI21_parks) C++17
0 / 100
2 ms 332 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[i]=z[i].second;
        v[i]=z[i+1].second;
        a[i]=3;
        b[i]=z[i].first+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:18:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for(int i = 0 ; i < y.size()-2 ; i++) {
      |                     ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -