Submission #584553

# Submission time Handle Problem Language Result Execution time Memory
584553 2022-06-27T14:33:35 Z ponkung Game (APIO22_game) C++17
60 / 100
4000 ms 17820 KB
#include "game.h"
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
int mx[300005],n,m,mn[300005],u,val,type;
vector<int> g[300005],rev[300005];
queue<int> q;
void init(int N, int M) {
    n=N;
    m=M;
    for(int i=1;i<=n;i++)
    {
        mx[i]=-1e9;
        mn[i]=1e9;
    }
    for(int i=1;i<=m;i++)mx[i]=i,mn[i]=i;
}

int add_teleporter(int x, int y) {
      x+=1;
      y+=1;
      g[x].pb(y);
      rev[y].pb(x);
      if(x>=y&&x>=1&&x<=m&&y>=1&&y<=m)return 1;
      mn[x]=min(mn[x],mn[y]);
      val=mn[y];
      q.push(x);
      while(!q.empty())
      {
          u=q.front();
          q.pop();
          for(auto node:rev[u])
          {
              if(val<mn[node])
              {
                  mn[node]=val;
                  q.push(val);
              }
          }
      }
      mx[y]=max(mx[y],mx[x]);
      val=mx[x];
      q.push(y);
      while(!q.empty())
      {
          u=q.front();
          q.pop();
          for(auto node:g[u])
          {
              if(val>mx[node])
              {
                  mx[node]=val;
                  q.push(node);
              }
          }
      }
      type=0;
      for(int i=m+1;i<=n;i++)
      {
          if(mx[i]>=mn[i])
          {
              type=1;
          }
      }
      return type;
}
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 7 ms 14288 KB Output is correct
3 Correct 7 ms 14288 KB Output is correct
4 Correct 7 ms 14288 KB Output is correct
5 Correct 8 ms 14384 KB Output is correct
6 Correct 7 ms 14408 KB Output is correct
7 Correct 7 ms 14288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 7 ms 14288 KB Output is correct
3 Correct 7 ms 14288 KB Output is correct
4 Correct 7 ms 14288 KB Output is correct
5 Correct 8 ms 14384 KB Output is correct
6 Correct 7 ms 14408 KB Output is correct
7 Correct 7 ms 14288 KB Output is correct
8 Correct 8 ms 14288 KB Output is correct
9 Correct 8 ms 14392 KB Output is correct
10 Correct 7 ms 14288 KB Output is correct
11 Correct 7 ms 14288 KB Output is correct
12 Correct 8 ms 14288 KB Output is correct
13 Correct 7 ms 14288 KB Output is correct
14 Correct 10 ms 14288 KB Output is correct
15 Correct 8 ms 14368 KB Output is correct
16 Correct 8 ms 14288 KB Output is correct
17 Correct 9 ms 14288 KB Output is correct
18 Correct 8 ms 14328 KB Output is correct
19 Correct 8 ms 14288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 7 ms 14288 KB Output is correct
3 Correct 7 ms 14288 KB Output is correct
4 Correct 7 ms 14288 KB Output is correct
5 Correct 8 ms 14384 KB Output is correct
6 Correct 7 ms 14408 KB Output is correct
7 Correct 7 ms 14288 KB Output is correct
8 Correct 8 ms 14288 KB Output is correct
9 Correct 8 ms 14392 KB Output is correct
10 Correct 7 ms 14288 KB Output is correct
11 Correct 7 ms 14288 KB Output is correct
12 Correct 8 ms 14288 KB Output is correct
13 Correct 7 ms 14288 KB Output is correct
14 Correct 10 ms 14288 KB Output is correct
15 Correct 8 ms 14368 KB Output is correct
16 Correct 8 ms 14288 KB Output is correct
17 Correct 9 ms 14288 KB Output is correct
18 Correct 8 ms 14328 KB Output is correct
19 Correct 8 ms 14288 KB Output is correct
20 Correct 11 ms 14352 KB Output is correct
21 Correct 9 ms 14292 KB Output is correct
22 Correct 9 ms 14364 KB Output is correct
23 Correct 9 ms 14420 KB Output is correct
24 Correct 11 ms 14368 KB Output is correct
25 Correct 12 ms 14504 KB Output is correct
26 Correct 15 ms 14416 KB Output is correct
27 Correct 12 ms 14416 KB Output is correct
28 Correct 10 ms 14416 KB Output is correct
29 Correct 12 ms 14436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 7 ms 14288 KB Output is correct
3 Correct 7 ms 14288 KB Output is correct
4 Correct 7 ms 14288 KB Output is correct
5 Correct 8 ms 14384 KB Output is correct
6 Correct 7 ms 14408 KB Output is correct
7 Correct 7 ms 14288 KB Output is correct
8 Correct 8 ms 14288 KB Output is correct
9 Correct 8 ms 14392 KB Output is correct
10 Correct 7 ms 14288 KB Output is correct
11 Correct 7 ms 14288 KB Output is correct
12 Correct 8 ms 14288 KB Output is correct
13 Correct 7 ms 14288 KB Output is correct
14 Correct 10 ms 14288 KB Output is correct
15 Correct 8 ms 14368 KB Output is correct
16 Correct 8 ms 14288 KB Output is correct
17 Correct 9 ms 14288 KB Output is correct
18 Correct 8 ms 14328 KB Output is correct
19 Correct 8 ms 14288 KB Output is correct
20 Correct 11 ms 14352 KB Output is correct
21 Correct 9 ms 14292 KB Output is correct
22 Correct 9 ms 14364 KB Output is correct
23 Correct 9 ms 14420 KB Output is correct
24 Correct 11 ms 14368 KB Output is correct
25 Correct 12 ms 14504 KB Output is correct
26 Correct 15 ms 14416 KB Output is correct
27 Correct 12 ms 14416 KB Output is correct
28 Correct 10 ms 14416 KB Output is correct
29 Correct 12 ms 14436 KB Output is correct
30 Correct 706 ms 15756 KB Output is correct
31 Correct 181 ms 14988 KB Output is correct
32 Correct 764 ms 16488 KB Output is correct
33 Correct 771 ms 16464 KB Output is correct
34 Correct 1219 ms 16632 KB Output is correct
35 Correct 1228 ms 16668 KB Output is correct
36 Correct 1238 ms 16532 KB Output is correct
37 Correct 976 ms 16516 KB Output is correct
38 Correct 1026 ms 16212 KB Output is correct
39 Correct 1085 ms 16276 KB Output is correct
40 Correct 1667 ms 16640 KB Output is correct
41 Correct 1190 ms 16328 KB Output is correct
42 Correct 1219 ms 16348 KB Output is correct
43 Correct 1221 ms 16572 KB Output is correct
44 Correct 1494 ms 16596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 7 ms 14288 KB Output is correct
3 Correct 7 ms 14288 KB Output is correct
4 Correct 7 ms 14288 KB Output is correct
5 Correct 8 ms 14384 KB Output is correct
6 Correct 7 ms 14408 KB Output is correct
7 Correct 7 ms 14288 KB Output is correct
8 Correct 8 ms 14288 KB Output is correct
9 Correct 8 ms 14392 KB Output is correct
10 Correct 7 ms 14288 KB Output is correct
11 Correct 7 ms 14288 KB Output is correct
12 Correct 8 ms 14288 KB Output is correct
13 Correct 7 ms 14288 KB Output is correct
14 Correct 10 ms 14288 KB Output is correct
15 Correct 8 ms 14368 KB Output is correct
16 Correct 8 ms 14288 KB Output is correct
17 Correct 9 ms 14288 KB Output is correct
18 Correct 8 ms 14328 KB Output is correct
19 Correct 8 ms 14288 KB Output is correct
20 Correct 11 ms 14352 KB Output is correct
21 Correct 9 ms 14292 KB Output is correct
22 Correct 9 ms 14364 KB Output is correct
23 Correct 9 ms 14420 KB Output is correct
24 Correct 11 ms 14368 KB Output is correct
25 Correct 12 ms 14504 KB Output is correct
26 Correct 15 ms 14416 KB Output is correct
27 Correct 12 ms 14416 KB Output is correct
28 Correct 10 ms 14416 KB Output is correct
29 Correct 12 ms 14436 KB Output is correct
30 Correct 706 ms 15756 KB Output is correct
31 Correct 181 ms 14988 KB Output is correct
32 Correct 764 ms 16488 KB Output is correct
33 Correct 771 ms 16464 KB Output is correct
34 Correct 1219 ms 16632 KB Output is correct
35 Correct 1228 ms 16668 KB Output is correct
36 Correct 1238 ms 16532 KB Output is correct
37 Correct 976 ms 16516 KB Output is correct
38 Correct 1026 ms 16212 KB Output is correct
39 Correct 1085 ms 16276 KB Output is correct
40 Correct 1667 ms 16640 KB Output is correct
41 Correct 1190 ms 16328 KB Output is correct
42 Correct 1219 ms 16348 KB Output is correct
43 Correct 1221 ms 16572 KB Output is correct
44 Correct 1494 ms 16596 KB Output is correct
45 Execution timed out 4042 ms 17820 KB Time limit exceeded
46 Halted 0 ms 0 KB -