Submission #819638

# Submission time Handle Problem Language Result Execution time Memory
819638 2023-08-10T12:18:22 Z Wayne_Yan Fountain Parks (IOI21_parks) C++17
5 / 100
44 ms 8252 KB
#include "parks.h"

#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef zisk
#define debug(x...) cerr << "[" << #x << "] = [", _print(x)
template<class T> void pary(T l, T r) {
	while (l != r) cout << *l << " ", l++;
	cout << endl;
}
#else
#define debug(x...)
template<class T> void pary(T l, T r) {}
#endif

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define vi vector<int>
#define pb emplace_back
#define mp make_pair
#define mt make_tuple
#define pii pair<int,int>
#define pll pair<ll,ll>
#define F(n) Fi(i,n)
#define Fi(i,n) Fl(i,0,n)
#define Fl(i,l,n) for(int i=l;i<n;i++)
#define RF(n) RFi(i,n)
#define RFi(i,n) RFl(i,0,n)
#define RFl(i,l,n) for(int i=n-1;i>=l;i--)
#define all(v) begin(v),end(v)
#define siz(v) ((long long)(v.size()))
#define get_pos(v,x) (lower_bound(all(v),x)-begin(v))
#define sort_uni(v) sort(begin(v),end(v)),v.erase(unique(begin(v),end(v)),end(v))
#define mem(v,x) memset(v,x,sizeof v)
#define ff first
#define ss second
#define RAN(a,b) uniform_int_distribution<int> (a, b)(rng) // inclusive
#define cmax(a,b) (a = max(a,b))
#define cmin(a,b) (a = min(a,b))
typedef long long ll;
typedef long double ld;

const int maxN = 2e5 + 10;

int construct_roads(std::vector<int> x, std::vector<int> y) {
    
    int n = siz(x);
    vector<int> idx(maxN);
    F(n) idx[y[i]] = i; 

    sort(all(y));

    F(n-1) if(y[i+1] - y[i] != 2) return 0;

    vector<int> u, v, a ,b;
    F(n-1){
        u.pb(idx[y[i]]);
        v.pb(idx[y[i+1]]);
        a.pb(3);
        b.pb(y[i] + 1);
    }

    build(u, v, a, b);
    return 1;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1072 KB Output is correct
2 Correct 1 ms 980 KB Output is correct
3 Correct 1 ms 980 KB Output is correct
4 Correct 1 ms 1072 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 1 ms 1068 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 980 KB Output is correct
9 Correct 44 ms 8252 KB Output is correct
10 Correct 5 ms 1876 KB Output is correct
11 Correct 21 ms 4940 KB Output is correct
12 Correct 6 ms 2132 KB Output is correct
13 Correct 7 ms 2132 KB Output is correct
14 Correct 1 ms 1108 KB Output is correct
15 Correct 1 ms 1108 KB Output is correct
16 Correct 44 ms 8228 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1072 KB Output is correct
2 Correct 1 ms 980 KB Output is correct
3 Correct 1 ms 980 KB Output is correct
4 Correct 1 ms 1072 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 1 ms 1068 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 980 KB Output is correct
9 Correct 44 ms 8252 KB Output is correct
10 Correct 5 ms 1876 KB Output is correct
11 Correct 21 ms 4940 KB Output is correct
12 Correct 6 ms 2132 KB Output is correct
13 Correct 7 ms 2132 KB Output is correct
14 Correct 1 ms 1108 KB Output is correct
15 Correct 1 ms 1108 KB Output is correct
16 Correct 44 ms 8228 KB Output is correct
17 Incorrect 1 ms 980 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1072 KB Output is correct
2 Correct 1 ms 980 KB Output is correct
3 Correct 1 ms 980 KB Output is correct
4 Correct 1 ms 1072 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 1 ms 1068 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 980 KB Output is correct
9 Correct 44 ms 8252 KB Output is correct
10 Correct 5 ms 1876 KB Output is correct
11 Correct 21 ms 4940 KB Output is correct
12 Correct 6 ms 2132 KB Output is correct
13 Correct 7 ms 2132 KB Output is correct
14 Correct 1 ms 1108 KB Output is correct
15 Correct 1 ms 1108 KB Output is correct
16 Correct 44 ms 8228 KB Output is correct
17 Incorrect 1 ms 980 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1072 KB Output is correct
2 Correct 1 ms 980 KB Output is correct
3 Correct 1 ms 980 KB Output is correct
4 Correct 1 ms 1072 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 1 ms 1068 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 980 KB Output is correct
9 Correct 44 ms 8252 KB Output is correct
10 Correct 5 ms 1876 KB Output is correct
11 Correct 21 ms 4940 KB Output is correct
12 Correct 6 ms 2132 KB Output is correct
13 Correct 7 ms 2132 KB Output is correct
14 Correct 1 ms 1108 KB Output is correct
15 Correct 1 ms 1108 KB Output is correct
16 Correct 44 ms 8228 KB Output is correct
17 Incorrect 1 ms 1108 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1072 KB Output is correct
2 Correct 1 ms 980 KB Output is correct
3 Correct 1 ms 980 KB Output is correct
4 Correct 1 ms 1072 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 1 ms 1068 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 980 KB Output is correct
9 Correct 44 ms 8252 KB Output is correct
10 Correct 5 ms 1876 KB Output is correct
11 Correct 21 ms 4940 KB Output is correct
12 Correct 6 ms 2132 KB Output is correct
13 Correct 7 ms 2132 KB Output is correct
14 Correct 1 ms 1108 KB Output is correct
15 Correct 1 ms 1108 KB Output is correct
16 Correct 44 ms 8228 KB Output is correct
17 Incorrect 39 ms 6208 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1072 KB Output is correct
2 Correct 1 ms 980 KB Output is correct
3 Correct 1 ms 980 KB Output is correct
4 Correct 1 ms 1072 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 1 ms 1068 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 980 KB Output is correct
9 Correct 44 ms 8252 KB Output is correct
10 Correct 5 ms 1876 KB Output is correct
11 Correct 21 ms 4940 KB Output is correct
12 Correct 6 ms 2132 KB Output is correct
13 Correct 7 ms 2132 KB Output is correct
14 Correct 1 ms 1108 KB Output is correct
15 Correct 1 ms 1108 KB Output is correct
16 Correct 44 ms 8228 KB Output is correct
17 Incorrect 1 ms 980 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -