Submission #1081946

# Submission time Handle Problem Language Result Execution time Memory
1081946 2024-08-30T13:09:21 Z ALeonidou Fountain Parks (IOI21_parks) C++17
5 / 100
80 ms 8832 KB
#include "parks.h"
#include <bits/stdc++.h>
using namespace std;

#define ll int
#define F first
#define S second
#define pb push_back
#define sz(x) (ll)x.size()

typedef vector <ll> vi;
typedef pair <ll,ll> ii;
typedef vector <ii> vii;

#define dbg(x) cout<<#x<<": "<<x<<endl;
#define dbg2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl;
#define dbg3(x,y,z) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<endl;

void printVct(vi &v){
    for (ll i =0; i<sz(v); i++){
        cout<<v[i]<<" ";
    }
    cout<<endl;
}

int construct_roads(vi x, vi y) {
    ll n = sz(x);
    
    vii yy(n);
    for (ll i=0; i<n; i++){
        yy[i] = ii(y[i], i);
    }
    sort(yy.begin(), yy.end());
    vi mp(n);
    for (ll i =0; i<n; i++){
        mp[i] = yy[i].S;
    }

    sort(y.begin(), y.end());
    vi u,v,a,b;
    for (ll i= 0; i<n-1; i++){
        if (y[i] != y[i+1] - 2){
            return 0;
        }
        u.pb(mp[i]);
        v.pb(mp[i+1]);
        a.pb(1);
        b.pb(y[i]+1);
    }
    build(u, v, a, b);
    return 1;
}

/*
2
2 2
2 4
*/
# Verdict Execution time Memory 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 604 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 45 ms 8632 KB Output is correct
10 Correct 5 ms 1372 KB Output is correct
11 Correct 27 ms 5100 KB Output is correct
12 Correct 6 ms 1836 KB Output is correct
13 Correct 13 ms 2652 KB Output is correct
14 Correct 0 ms 604 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 54 ms 8832 KB Output is correct
# Verdict Execution time Memory 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 604 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 45 ms 8632 KB Output is correct
10 Correct 5 ms 1372 KB Output is correct
11 Correct 27 ms 5100 KB Output is correct
12 Correct 6 ms 1836 KB Output is correct
13 Correct 13 ms 2652 KB Output is correct
14 Correct 0 ms 604 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 54 ms 8832 KB Output is correct
17 Incorrect 1 ms 348 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 604 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 45 ms 8632 KB Output is correct
10 Correct 5 ms 1372 KB Output is correct
11 Correct 27 ms 5100 KB Output is correct
12 Correct 6 ms 1836 KB Output is correct
13 Correct 13 ms 2652 KB Output is correct
14 Correct 0 ms 604 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 54 ms 8832 KB Output is correct
17 Incorrect 1 ms 348 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 604 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 45 ms 8632 KB Output is correct
10 Correct 5 ms 1372 KB Output is correct
11 Correct 27 ms 5100 KB Output is correct
12 Correct 6 ms 1836 KB Output is correct
13 Correct 13 ms 2652 KB Output is correct
14 Correct 0 ms 604 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 54 ms 8832 KB Output is correct
17 Incorrect 0 ms 348 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 604 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 45 ms 8632 KB Output is correct
10 Correct 5 ms 1372 KB Output is correct
11 Correct 27 ms 5100 KB Output is correct
12 Correct 6 ms 1836 KB Output is correct
13 Correct 13 ms 2652 KB Output is correct
14 Correct 0 ms 604 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 54 ms 8832 KB Output is correct
17 Incorrect 80 ms 7860 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 604 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 45 ms 8632 KB Output is correct
10 Correct 5 ms 1372 KB Output is correct
11 Correct 27 ms 5100 KB Output is correct
12 Correct 6 ms 1836 KB Output is correct
13 Correct 13 ms 2652 KB Output is correct
14 Correct 0 ms 604 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 54 ms 8832 KB Output is correct
17 Incorrect 1 ms 348 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -