답안 #487178

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
487178 2021-11-14T18:59:11 Z MilosMilutinovic 분수 공원 (IOI21_parks) C++17
0 / 100
0 ms 204 KB
#include "parks.h"
#include <bits/stdc++.h>
using namespace std;

int construct_roads(std::vector<int> x, std::vector<int> y) {
    if (x.size() == 1) {
        build({}, {}, {}, {});
        return 1;
    }
    int n = x.size();
    if (n & 1) {
        return 0;
    }
    int mn = *min_element(x.begin(), x.end());
    int mx = *min_element(x.begin(), x.end());
    if (mn == 2 && mx == 2) {
        int p[n];
        for (int i = 0; i < n; i++) p[i] = i;
        sort(p, p + n, [&](int i, int j) {
            return y[i] < y[j];
        });
        for (int i = 0; i < n; i += 2)
            if (y[p[i]] + 2 != y[p[i + 1]])
                return 0;
        vector<int> u, v, a, b;
        for (int i = 0; i < n; i += 2) {
            u.push_back(p[i]);
            v.push_back(p[i + 1]);
            a.push_back(x[i] - 1);
            b.push_back(y[p[i]] + 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:35:1: warning: control reaches end of non-void function [-Wreturn-type]
   35 | }
      | ^
# 결과 실행 시간 메모리 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 Incorrect 0 ms 204 KB Solution announced impossible, but it is possible.
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 Incorrect 0 ms 204 KB Solution announced impossible, but it is possible.
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 Incorrect 0 ms 204 KB Solution announced impossible, but it is possible.
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 Incorrect 0 ms 204 KB Solution announced impossible, but it is possible.
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 Incorrect 0 ms 204 KB Solution announced impossible, but it is possible.
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 Incorrect 0 ms 204 KB Solution announced impossible, but it is possible.
5 Halted 0 ms 0 KB -