Submission #711118

# Submission time Handle Problem Language Result Execution time Memory
711118 2023-03-16T08:48:33 Z myrcella Fountain Parks (IOI21_parks) C++17
15 / 100
110 ms 18468 KB
//by szh
#include<bits/stdc++.h>
using namespace std;

#define fi first.first
#define se first.second
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pb push_back
#define debug(x) cerr<<#x<<"="<<x<<endl
#define pq priority_queue
#define inf 0x3f
#define rep(i,a,b) for (int i=a;i<(b);i++)
#define MP make_pair
#define SZ(x) (int(x.size()))
#define ll long long
#define mod 1000000007
#define ALL(x) x.begin(),x.end()
void inc(int &a,int b) {a=(a+b)%mod;}
void dec(int &a,int b) {a=(a-b+mod)%mod;}
int lowbit(int x) {return x&(-x);}
ll p0w(ll base,ll p) {ll ret=1;while(p>0){if (p%2ll==1ll) ret=ret*base%mod;base=base*base%mod;p/=2ll;}return ret;}

#include "parks.h"

int id[5][200010];

int construct_roads(std::vector<int> x, std::vector<int> y) {
	memset(id,-1,sizeof(id));
    rep(i,0,SZ(x)) {
		id[x[i]][y[i]]= i;
	}
	
	vector <int> u,v,a,b;
	rep(i,0,200010) {
		if (id[2][i]!=-1) {
			if (i>=2 and id[2][i-2]!=-1) u.pb(id[2][i]),v.pb(id[2][i-2]),a.pb(1),b.pb(i-1);
		}
		if (id[4][i]!=-1) {
			if (i>=2 and id[4][i-2]!=-1) u.pb(id[4][i]),v.pb(id[4][i-2]),a.pb(5),b.pb(i-1);
			if (id[2][i]!=-1 and (i<2 or id[2][i-2]==-1 or id[4][i-2]==-1)) u.pb(id[4][i]),v.pb(id[2][i]),a.pb(3),b.pb(i-1);
		}
	}
	if (SZ(u)!=SZ(x)-1) return 0;
	build(u,v,a,b);
	return 1;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4180 KB Output is correct
2 Correct 3 ms 4180 KB Output is correct
3 Correct 3 ms 4180 KB Output is correct
4 Correct 2 ms 4180 KB Output is correct
5 Correct 4 ms 4124 KB Output is correct
6 Correct 2 ms 4148 KB Output is correct
7 Correct 2 ms 4180 KB Output is correct
8 Correct 3 ms 4180 KB Output is correct
9 Correct 49 ms 11432 KB Output is correct
10 Correct 7 ms 5088 KB Output is correct
11 Correct 27 ms 8140 KB Output is correct
12 Correct 10 ms 5460 KB Output is correct
13 Correct 9 ms 6100 KB Output is correct
14 Correct 2 ms 4180 KB Output is correct
15 Correct 3 ms 4308 KB Output is correct
16 Correct 56 ms 11452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4180 KB Output is correct
2 Correct 3 ms 4180 KB Output is correct
3 Correct 3 ms 4180 KB Output is correct
4 Correct 2 ms 4180 KB Output is correct
5 Correct 4 ms 4124 KB Output is correct
6 Correct 2 ms 4148 KB Output is correct
7 Correct 2 ms 4180 KB Output is correct
8 Correct 3 ms 4180 KB Output is correct
9 Correct 49 ms 11432 KB Output is correct
10 Correct 7 ms 5088 KB Output is correct
11 Correct 27 ms 8140 KB Output is correct
12 Correct 10 ms 5460 KB Output is correct
13 Correct 9 ms 6100 KB Output is correct
14 Correct 2 ms 4180 KB Output is correct
15 Correct 3 ms 4308 KB Output is correct
16 Correct 56 ms 11452 KB Output is correct
17 Correct 2 ms 4180 KB Output is correct
18 Correct 2 ms 4132 KB Output is correct
19 Correct 2 ms 4152 KB Output is correct
20 Correct 2 ms 4180 KB Output is correct
21 Correct 2 ms 4152 KB Output is correct
22 Correct 2 ms 4152 KB Output is correct
23 Correct 98 ms 18468 KB Output is correct
24 Correct 2 ms 4180 KB Output is correct
25 Correct 3 ms 4308 KB Output is correct
26 Correct 3 ms 4308 KB Output is correct
27 Correct 3 ms 4308 KB Output is correct
28 Correct 42 ms 9940 KB Output is correct
29 Correct 58 ms 12852 KB Output is correct
30 Correct 85 ms 15712 KB Output is correct
31 Correct 110 ms 18464 KB Output is correct
32 Correct 3 ms 4152 KB Output is correct
33 Correct 3 ms 4152 KB Output is correct
34 Correct 2 ms 4180 KB Output is correct
35 Correct 2 ms 4152 KB Output is correct
36 Correct 2 ms 4180 KB Output is correct
37 Correct 2 ms 4180 KB Output is correct
38 Correct 2 ms 4148 KB Output is correct
39 Correct 3 ms 4180 KB Output is correct
40 Correct 2 ms 4180 KB Output is correct
41 Correct 3 ms 4180 KB Output is correct
42 Correct 3 ms 4180 KB Output is correct
43 Correct 2 ms 4292 KB Output is correct
44 Correct 3 ms 4308 KB Output is correct
45 Correct 50 ms 11352 KB Output is correct
46 Correct 96 ms 14556 KB Output is correct
47 Correct 75 ms 14644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4180 KB Output is correct
2 Correct 3 ms 4180 KB Output is correct
3 Correct 3 ms 4180 KB Output is correct
4 Correct 2 ms 4180 KB Output is correct
5 Correct 4 ms 4124 KB Output is correct
6 Correct 2 ms 4148 KB Output is correct
7 Correct 2 ms 4180 KB Output is correct
8 Correct 3 ms 4180 KB Output is correct
9 Correct 49 ms 11432 KB Output is correct
10 Correct 7 ms 5088 KB Output is correct
11 Correct 27 ms 8140 KB Output is correct
12 Correct 10 ms 5460 KB Output is correct
13 Correct 9 ms 6100 KB Output is correct
14 Correct 2 ms 4180 KB Output is correct
15 Correct 3 ms 4308 KB Output is correct
16 Correct 56 ms 11452 KB Output is correct
17 Correct 2 ms 4180 KB Output is correct
18 Correct 2 ms 4132 KB Output is correct
19 Correct 2 ms 4152 KB Output is correct
20 Correct 2 ms 4180 KB Output is correct
21 Correct 2 ms 4152 KB Output is correct
22 Correct 2 ms 4152 KB Output is correct
23 Correct 98 ms 18468 KB Output is correct
24 Correct 2 ms 4180 KB Output is correct
25 Correct 3 ms 4308 KB Output is correct
26 Correct 3 ms 4308 KB Output is correct
27 Correct 3 ms 4308 KB Output is correct
28 Correct 42 ms 9940 KB Output is correct
29 Correct 58 ms 12852 KB Output is correct
30 Correct 85 ms 15712 KB Output is correct
31 Correct 110 ms 18464 KB Output is correct
32 Correct 3 ms 4152 KB Output is correct
33 Correct 3 ms 4152 KB Output is correct
34 Correct 2 ms 4180 KB Output is correct
35 Correct 2 ms 4152 KB Output is correct
36 Correct 2 ms 4180 KB Output is correct
37 Correct 2 ms 4180 KB Output is correct
38 Correct 2 ms 4148 KB Output is correct
39 Correct 3 ms 4180 KB Output is correct
40 Correct 2 ms 4180 KB Output is correct
41 Correct 3 ms 4180 KB Output is correct
42 Correct 3 ms 4180 KB Output is correct
43 Correct 2 ms 4292 KB Output is correct
44 Correct 3 ms 4308 KB Output is correct
45 Correct 50 ms 11352 KB Output is correct
46 Correct 96 ms 14556 KB Output is correct
47 Correct 75 ms 14644 KB Output is correct
48 Runtime error 5 ms 8260 KB Execution killed with signal 11
49 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4180 KB Output is correct
2 Correct 3 ms 4180 KB Output is correct
3 Correct 3 ms 4180 KB Output is correct
4 Correct 2 ms 4180 KB Output is correct
5 Correct 4 ms 4124 KB Output is correct
6 Correct 2 ms 4148 KB Output is correct
7 Correct 2 ms 4180 KB Output is correct
8 Correct 3 ms 4180 KB Output is correct
9 Correct 49 ms 11432 KB Output is correct
10 Correct 7 ms 5088 KB Output is correct
11 Correct 27 ms 8140 KB Output is correct
12 Correct 10 ms 5460 KB Output is correct
13 Correct 9 ms 6100 KB Output is correct
14 Correct 2 ms 4180 KB Output is correct
15 Correct 3 ms 4308 KB Output is correct
16 Correct 56 ms 11452 KB Output is correct
17 Runtime error 6 ms 8276 KB Execution killed with signal 11
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4180 KB Output is correct
2 Correct 3 ms 4180 KB Output is correct
3 Correct 3 ms 4180 KB Output is correct
4 Correct 2 ms 4180 KB Output is correct
5 Correct 4 ms 4124 KB Output is correct
6 Correct 2 ms 4148 KB Output is correct
7 Correct 2 ms 4180 KB Output is correct
8 Correct 3 ms 4180 KB Output is correct
9 Correct 49 ms 11432 KB Output is correct
10 Correct 7 ms 5088 KB Output is correct
11 Correct 27 ms 8140 KB Output is correct
12 Correct 10 ms 5460 KB Output is correct
13 Correct 9 ms 6100 KB Output is correct
14 Correct 2 ms 4180 KB Output is correct
15 Correct 3 ms 4308 KB Output is correct
16 Correct 56 ms 11452 KB Output is correct
17 Runtime error 54 ms 16716 KB Execution killed with signal 11
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4180 KB Output is correct
2 Correct 3 ms 4180 KB Output is correct
3 Correct 3 ms 4180 KB Output is correct
4 Correct 2 ms 4180 KB Output is correct
5 Correct 4 ms 4124 KB Output is correct
6 Correct 2 ms 4148 KB Output is correct
7 Correct 2 ms 4180 KB Output is correct
8 Correct 3 ms 4180 KB Output is correct
9 Correct 49 ms 11432 KB Output is correct
10 Correct 7 ms 5088 KB Output is correct
11 Correct 27 ms 8140 KB Output is correct
12 Correct 10 ms 5460 KB Output is correct
13 Correct 9 ms 6100 KB Output is correct
14 Correct 2 ms 4180 KB Output is correct
15 Correct 3 ms 4308 KB Output is correct
16 Correct 56 ms 11452 KB Output is correct
17 Correct 2 ms 4180 KB Output is correct
18 Correct 2 ms 4132 KB Output is correct
19 Correct 2 ms 4152 KB Output is correct
20 Correct 2 ms 4180 KB Output is correct
21 Correct 2 ms 4152 KB Output is correct
22 Correct 2 ms 4152 KB Output is correct
23 Correct 98 ms 18468 KB Output is correct
24 Correct 2 ms 4180 KB Output is correct
25 Correct 3 ms 4308 KB Output is correct
26 Correct 3 ms 4308 KB Output is correct
27 Correct 3 ms 4308 KB Output is correct
28 Correct 42 ms 9940 KB Output is correct
29 Correct 58 ms 12852 KB Output is correct
30 Correct 85 ms 15712 KB Output is correct
31 Correct 110 ms 18464 KB Output is correct
32 Correct 3 ms 4152 KB Output is correct
33 Correct 3 ms 4152 KB Output is correct
34 Correct 2 ms 4180 KB Output is correct
35 Correct 2 ms 4152 KB Output is correct
36 Correct 2 ms 4180 KB Output is correct
37 Correct 2 ms 4180 KB Output is correct
38 Correct 2 ms 4148 KB Output is correct
39 Correct 3 ms 4180 KB Output is correct
40 Correct 2 ms 4180 KB Output is correct
41 Correct 3 ms 4180 KB Output is correct
42 Correct 3 ms 4180 KB Output is correct
43 Correct 2 ms 4292 KB Output is correct
44 Correct 3 ms 4308 KB Output is correct
45 Correct 50 ms 11352 KB Output is correct
46 Correct 96 ms 14556 KB Output is correct
47 Correct 75 ms 14644 KB Output is correct
48 Runtime error 5 ms 8260 KB Execution killed with signal 11
49 Halted 0 ms 0 KB -