답안 #1058957

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1058957 2024-08-14T15:21:58 Z qwusha 분수 공원 (IOI21_parks) C++17
5 / 100
34 ms 9700 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
typedef long double ld;
const ld eps = 1e-8;
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
const ll inf = 1e18;
const ll mod = 1e9 + 7;

#include "parks.h"


int construct_roads(vector<int> x, vector<int> y) {
    bool fir = 1, sec = 1, thi = 1;
    int n = x.size();
    for (int i = 0; i < n; i++) {
        if (x[i] != 2)
            fir = 0;
    }
    if (fir) {
        vector<pair<int, int>> s(n);
        for (int i = 0; i < n; i++) {
            s[i] = {y[i], i};
        }
        sort(s.begin(), s.end());
        vector<int> u(n - 1), v(n - 1), a(n - 1, 1), b(n - 1);
        bool ok = 1;
        for (int i = 1; i < n; i++) {
            if (s[i].fi != s[i - 1].fi + 2) {
                ok = 0;
            }
            u[i - 1] = s[i - 1].se;
            v[i - 1] = s[i].se;
            b[i - 1] = s[i - 1].fi + 1;
        }
        if (!ok) {
            return 0;
        } else {
            build(u,v,a,b);
            return 1;
        }
        
    }
}



/*
int main() {
    vector<int> r = {0, 1, 1, 2, 2, 1, 2},
    u = {0, 0, 1, 1, 2, 3, 3, 4, 4, 5},
    v = {1, 2, 2, 3, 3, 4, 5, 5, 6, 6},
    c = {0, 0, 1, 0, 0, 1, 2, 0, 2, 1};

    auto res = find_reachable(r,u,v,c);
    for (int i = 0; i < r.size(); i++) {
        cout << res[i] << ' ';
    }
}
*/


Compilation message

parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:16:19: warning: unused variable 'sec' [-Wunused-variable]
   16 |     bool fir = 1, sec = 1, thi = 1;
      |                   ^~~
parks.cpp:16:28: warning: unused variable 'thi' [-Wunused-variable]
   16 |     bool fir = 1, sec = 1, thi = 1;
      |                            ^~~
parks.cpp:46:1: warning: control reaches end of non-void function [-Wreturn-type]
   46 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 444 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 28 ms 8076 KB Output is correct
10 Correct 3 ms 1360 KB Output is correct
11 Correct 13 ms 4444 KB Output is correct
12 Correct 4 ms 1628 KB Output is correct
13 Correct 5 ms 2396 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 30 ms 8068 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 444 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 28 ms 8076 KB Output is correct
10 Correct 3 ms 1360 KB Output is correct
11 Correct 13 ms 4444 KB Output is correct
12 Correct 4 ms 1628 KB Output is correct
13 Correct 5 ms 2396 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 30 ms 8068 KB Output is correct
17 Incorrect 0 ms 344 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 444 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 28 ms 8076 KB Output is correct
10 Correct 3 ms 1360 KB Output is correct
11 Correct 13 ms 4444 KB Output is correct
12 Correct 4 ms 1628 KB Output is correct
13 Correct 5 ms 2396 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 30 ms 8068 KB Output is correct
17 Incorrect 0 ms 344 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 444 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 28 ms 8076 KB Output is correct
10 Correct 3 ms 1360 KB Output is correct
11 Correct 13 ms 4444 KB Output is correct
12 Correct 4 ms 1628 KB Output is correct
13 Correct 5 ms 2396 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 30 ms 8068 KB Output is correct
17 Incorrect 0 ms 348 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 444 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 28 ms 8076 KB Output is correct
10 Correct 3 ms 1360 KB Output is correct
11 Correct 13 ms 4444 KB Output is correct
12 Correct 4 ms 1628 KB Output is correct
13 Correct 5 ms 2396 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 30 ms 8068 KB Output is correct
17 Incorrect 34 ms 9700 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 444 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 28 ms 8076 KB Output is correct
10 Correct 3 ms 1360 KB Output is correct
11 Correct 13 ms 4444 KB Output is correct
12 Correct 4 ms 1628 KB Output is correct
13 Correct 5 ms 2396 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 30 ms 8068 KB Output is correct
17 Incorrect 0 ms 344 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -