#include<bits/stdc++.h>
#include "game.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef int ll;
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef pair<ll,ll> pi;
typedef map<ll,ll> mi;
typedef long double ld;
typedef vector<ld> vd;
typedef vector<vector<ld>> vvd;
typedef pair<ld,ld> pd;
#define ff first
#define ss second
#define srt(a) sort(a.begin(),a.end());
#define fip(k, n) for (ll i = k; i < n; i++)
#define fjp(k, n) for (ll j = k; j < n; j++)
#define fin(k, n) for (ll i = k; i >= n; i--)
#define fjn(k, n) for (ll j = k; j >= n; j--)
#define fp(k, n, m) for (ll k = n; k < m; k++)
#define fn(k, n, m) for (ll k = n; k >= m; k--)
#define ordered_set tree<pi, null_type,less< pi >, rb_tree_tag,tree_order_statistics_node_update>
#define totalOne(n) __builtin_popcount(n)
#define backZero(n) __builtin_ctzll(n)
#define frontZero(n) __builtin_clzll(n)
#define fx(k) for ( auto x : k )
#define test ll t;cin >> t;while (t--)
#define nli "\n"
ll n,m,tp,tp2,res,cnt,sum,tptp,ans;
const ll mx = 3e5+5;
const ll mod = 1e9+7;
bool f = false;
ll dp[mx];
vi adj[mx];
void init(ll aa,ll bb){
n = aa;
fip(0,n)
dp[i] = 1e9;
m = bb;
fip(1,m)
adj[i].push_back(i-1);
}
void dfs(ll u){
ll pt = u < m ? u : dp[u];
fx(adj[u]){
if(dp[x] > pt){
dp[x] = pt;
dfs(x);
}
}
}
ll add_teleporter(ll aa,ll bb){
adj[bb].push_back(aa);
dfs(bb);
fip(0,m)
if(dp[i] <= i)
return 1;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
7248 KB |
Output is correct |
2 |
Correct |
4 ms |
7248 KB |
Output is correct |
3 |
Correct |
4 ms |
7248 KB |
Output is correct |
4 |
Correct |
4 ms |
7248 KB |
Output is correct |
5 |
Correct |
4 ms |
7248 KB |
Output is correct |
6 |
Correct |
5 ms |
7332 KB |
Output is correct |
7 |
Correct |
7 ms |
7248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
7248 KB |
Output is correct |
2 |
Correct |
4 ms |
7248 KB |
Output is correct |
3 |
Correct |
4 ms |
7248 KB |
Output is correct |
4 |
Correct |
4 ms |
7248 KB |
Output is correct |
5 |
Correct |
4 ms |
7248 KB |
Output is correct |
6 |
Correct |
5 ms |
7332 KB |
Output is correct |
7 |
Correct |
7 ms |
7248 KB |
Output is correct |
8 |
Correct |
4 ms |
7248 KB |
Output is correct |
9 |
Correct |
4 ms |
7248 KB |
Output is correct |
10 |
Correct |
4 ms |
7248 KB |
Output is correct |
11 |
Correct |
5 ms |
7264 KB |
Output is correct |
12 |
Correct |
4 ms |
7248 KB |
Output is correct |
13 |
Correct |
4 ms |
7248 KB |
Output is correct |
14 |
Correct |
4 ms |
7248 KB |
Output is correct |
15 |
Correct |
4 ms |
7248 KB |
Output is correct |
16 |
Correct |
4 ms |
7328 KB |
Output is correct |
17 |
Correct |
4 ms |
7248 KB |
Output is correct |
18 |
Correct |
4 ms |
7248 KB |
Output is correct |
19 |
Correct |
4 ms |
7248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
7248 KB |
Output is correct |
2 |
Correct |
4 ms |
7248 KB |
Output is correct |
3 |
Correct |
4 ms |
7248 KB |
Output is correct |
4 |
Correct |
4 ms |
7248 KB |
Output is correct |
5 |
Correct |
4 ms |
7248 KB |
Output is correct |
6 |
Correct |
5 ms |
7332 KB |
Output is correct |
7 |
Correct |
7 ms |
7248 KB |
Output is correct |
8 |
Correct |
4 ms |
7248 KB |
Output is correct |
9 |
Correct |
4 ms |
7248 KB |
Output is correct |
10 |
Correct |
4 ms |
7248 KB |
Output is correct |
11 |
Correct |
5 ms |
7264 KB |
Output is correct |
12 |
Correct |
4 ms |
7248 KB |
Output is correct |
13 |
Correct |
4 ms |
7248 KB |
Output is correct |
14 |
Correct |
4 ms |
7248 KB |
Output is correct |
15 |
Correct |
4 ms |
7248 KB |
Output is correct |
16 |
Correct |
4 ms |
7328 KB |
Output is correct |
17 |
Correct |
4 ms |
7248 KB |
Output is correct |
18 |
Correct |
4 ms |
7248 KB |
Output is correct |
19 |
Correct |
4 ms |
7248 KB |
Output is correct |
20 |
Correct |
4 ms |
7248 KB |
Output is correct |
21 |
Correct |
4 ms |
7248 KB |
Output is correct |
22 |
Correct |
6 ms |
7376 KB |
Output is correct |
23 |
Correct |
5 ms |
7292 KB |
Output is correct |
24 |
Correct |
6 ms |
7376 KB |
Output is correct |
25 |
Correct |
8 ms |
7356 KB |
Output is correct |
26 |
Correct |
6 ms |
7360 KB |
Output is correct |
27 |
Correct |
6 ms |
7376 KB |
Output is correct |
28 |
Correct |
5 ms |
7376 KB |
Output is correct |
29 |
Correct |
6 ms |
7388 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
7248 KB |
Output is correct |
2 |
Correct |
4 ms |
7248 KB |
Output is correct |
3 |
Correct |
4 ms |
7248 KB |
Output is correct |
4 |
Correct |
4 ms |
7248 KB |
Output is correct |
5 |
Correct |
4 ms |
7248 KB |
Output is correct |
6 |
Correct |
5 ms |
7332 KB |
Output is correct |
7 |
Correct |
7 ms |
7248 KB |
Output is correct |
8 |
Correct |
4 ms |
7248 KB |
Output is correct |
9 |
Correct |
4 ms |
7248 KB |
Output is correct |
10 |
Correct |
4 ms |
7248 KB |
Output is correct |
11 |
Correct |
5 ms |
7264 KB |
Output is correct |
12 |
Correct |
4 ms |
7248 KB |
Output is correct |
13 |
Correct |
4 ms |
7248 KB |
Output is correct |
14 |
Correct |
4 ms |
7248 KB |
Output is correct |
15 |
Correct |
4 ms |
7248 KB |
Output is correct |
16 |
Correct |
4 ms |
7328 KB |
Output is correct |
17 |
Correct |
4 ms |
7248 KB |
Output is correct |
18 |
Correct |
4 ms |
7248 KB |
Output is correct |
19 |
Correct |
4 ms |
7248 KB |
Output is correct |
20 |
Correct |
4 ms |
7248 KB |
Output is correct |
21 |
Correct |
4 ms |
7248 KB |
Output is correct |
22 |
Correct |
6 ms |
7376 KB |
Output is correct |
23 |
Correct |
5 ms |
7292 KB |
Output is correct |
24 |
Correct |
6 ms |
7376 KB |
Output is correct |
25 |
Correct |
8 ms |
7356 KB |
Output is correct |
26 |
Correct |
6 ms |
7360 KB |
Output is correct |
27 |
Correct |
6 ms |
7376 KB |
Output is correct |
28 |
Correct |
5 ms |
7376 KB |
Output is correct |
29 |
Correct |
6 ms |
7388 KB |
Output is correct |
30 |
Correct |
23 ms |
8024 KB |
Output is correct |
31 |
Correct |
13 ms |
7644 KB |
Output is correct |
32 |
Correct |
24 ms |
9032 KB |
Output is correct |
33 |
Correct |
16 ms |
8348 KB |
Output is correct |
34 |
Correct |
469 ms |
9736 KB |
Output is correct |
35 |
Correct |
187 ms |
8864 KB |
Output is correct |
36 |
Correct |
31 ms |
8348 KB |
Output is correct |
37 |
Correct |
40 ms |
8360 KB |
Output is correct |
38 |
Correct |
49 ms |
8452 KB |
Output is correct |
39 |
Correct |
43 ms |
8392 KB |
Output is correct |
40 |
Correct |
407 ms |
9708 KB |
Output is correct |
41 |
Correct |
103 ms |
8620 KB |
Output is correct |
42 |
Correct |
94 ms |
8564 KB |
Output is correct |
43 |
Correct |
52 ms |
9768 KB |
Output is correct |
44 |
Correct |
427 ms |
9756 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
7248 KB |
Output is correct |
2 |
Correct |
4 ms |
7248 KB |
Output is correct |
3 |
Correct |
4 ms |
7248 KB |
Output is correct |
4 |
Correct |
4 ms |
7248 KB |
Output is correct |
5 |
Correct |
4 ms |
7248 KB |
Output is correct |
6 |
Correct |
5 ms |
7332 KB |
Output is correct |
7 |
Correct |
7 ms |
7248 KB |
Output is correct |
8 |
Correct |
4 ms |
7248 KB |
Output is correct |
9 |
Correct |
4 ms |
7248 KB |
Output is correct |
10 |
Correct |
4 ms |
7248 KB |
Output is correct |
11 |
Correct |
5 ms |
7264 KB |
Output is correct |
12 |
Correct |
4 ms |
7248 KB |
Output is correct |
13 |
Correct |
4 ms |
7248 KB |
Output is correct |
14 |
Correct |
4 ms |
7248 KB |
Output is correct |
15 |
Correct |
4 ms |
7248 KB |
Output is correct |
16 |
Correct |
4 ms |
7328 KB |
Output is correct |
17 |
Correct |
4 ms |
7248 KB |
Output is correct |
18 |
Correct |
4 ms |
7248 KB |
Output is correct |
19 |
Correct |
4 ms |
7248 KB |
Output is correct |
20 |
Correct |
4 ms |
7248 KB |
Output is correct |
21 |
Correct |
4 ms |
7248 KB |
Output is correct |
22 |
Correct |
6 ms |
7376 KB |
Output is correct |
23 |
Correct |
5 ms |
7292 KB |
Output is correct |
24 |
Correct |
6 ms |
7376 KB |
Output is correct |
25 |
Correct |
8 ms |
7356 KB |
Output is correct |
26 |
Correct |
6 ms |
7360 KB |
Output is correct |
27 |
Correct |
6 ms |
7376 KB |
Output is correct |
28 |
Correct |
5 ms |
7376 KB |
Output is correct |
29 |
Correct |
6 ms |
7388 KB |
Output is correct |
30 |
Correct |
23 ms |
8024 KB |
Output is correct |
31 |
Correct |
13 ms |
7644 KB |
Output is correct |
32 |
Correct |
24 ms |
9032 KB |
Output is correct |
33 |
Correct |
16 ms |
8348 KB |
Output is correct |
34 |
Correct |
469 ms |
9736 KB |
Output is correct |
35 |
Correct |
187 ms |
8864 KB |
Output is correct |
36 |
Correct |
31 ms |
8348 KB |
Output is correct |
37 |
Correct |
40 ms |
8360 KB |
Output is correct |
38 |
Correct |
49 ms |
8452 KB |
Output is correct |
39 |
Correct |
43 ms |
8392 KB |
Output is correct |
40 |
Correct |
407 ms |
9708 KB |
Output is correct |
41 |
Correct |
103 ms |
8620 KB |
Output is correct |
42 |
Correct |
94 ms |
8564 KB |
Output is correct |
43 |
Correct |
52 ms |
9768 KB |
Output is correct |
44 |
Correct |
427 ms |
9756 KB |
Output is correct |
45 |
Correct |
177 ms |
14156 KB |
Output is correct |
46 |
Correct |
15 ms |
8680 KB |
Output is correct |
47 |
Correct |
18 ms |
8708 KB |
Output is correct |
48 |
Correct |
237 ms |
25004 KB |
Output is correct |
49 |
Correct |
201 ms |
17812 KB |
Output is correct |
50 |
Execution timed out |
4035 ms |
15580 KB |
Time limit exceeded |
51 |
Halted |
0 ms |
0 KB |
- |