Submission #1049098

# Submission time Handle Problem Language Result Execution time Memory
1049098 2024-08-08T13:20:41 Z nisanduu Fountain Parks (IOI21_parks) C++17
0 / 100
0 ms 348 KB
#include "parks.h"
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
int construct_roads(std::vector<int> x, std::vector<int> y) {
    ll n = x.size();
    vector<pair<int,int>> arr(n);
    for(int i=0;i<n;i++){
        arr[i].first = y[i];
        arr[i].second = i;
    }
    sort(arr.begin(),arr.end());
    vector<int> u, v, a, b;
    
    bool f=1;
    for(ll i=0;i<n-1;i++){
        if((arr[i+1].first - arr[i].first) != 2){
            return 0;
        }
        u.push_back(arr[i+1].second);
        v.push_back(arr[i].second);
        a.push_back(2);
        b.push_back((arr[i+1].first+arr[i].first)/2);
    }
    build(u, v, a, b);
    return 1;
}

Compilation message

parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:16:10: warning: unused variable 'f' [-Wunused-variable]
   16 |     bool f=1;
      |          ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB a[0] = 2 is not an odd integer
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB a[0] = 2 is not an odd integer
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB a[0] = 2 is not an odd integer
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB a[0] = 2 is not an odd integer
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB a[0] = 2 is not an odd integer
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB a[0] = 2 is not an odd integer
3 Halted 0 ms 0 KB -