Submission #1103560

# Submission time Handle Problem Language Result Execution time Memory
1103560 2024-10-21T09:48:03 Z epicci23 Game (APIO22_game) C++17
60 / 100
1149 ms 4960 KB
#include "bits/stdc++.h"
#include "game.h"
//#define int long long
#define all(v) v.begin() , v.end()
#define sz(a) (int)a.size()
using namespace std;


const int N = 3e4 + 5;
vector<int> v[N],g[N];
int n,k,in[N],out[N];
bool ok=0;

void upd_in(int a,int val){
  if(val>=in[a] || ok) return;
  in[a]=val;
  if(in[a]<out[a]){
  	ok=1;
  	return;
  }
  if(in[a]==out[a] && a>=k){
  	ok=1;
  	return;
  }
  for(int x:g[a]){
  	upd_in(x,val);
  	if(ok) return;
  }
}


void upd_out(int a,int val){
  if(val<=out[a] || ok) return;
  out[a]=val;
  if(in[a]<out[a]){
  	ok=1;
  	return;
  }
  if(in[a]==out[a] && a>=k){
  	ok=1;
  	return;
  }
  for(int x:v[a]){
  	upd_out(x,val);
  	if(ok) return;
  }
}

void init(int _n,int _k){
  n=_n,k=_k;
  fill(in,in+N,k);
  fill(out,out+N,-1);
  for(int i=0;i<k;i++) in[i]=out[i]=i;
  
  for(int i=0;i<k-1;i++){
  	v[i].push_back(i+1);
    g[i+1].push_back(i);
  }
}

int add_teleporter(int a, int b){
  v[a].push_back(b);
  g[b].push_back(a);
  if(in[a]>in[b]) upd_in(a,in[b]);
  if(out[a]>out[b]) upd_out(b,out[a]);
  if(a==b && a<k) ok=1;
  return ok;
}

/*void _(){
  cin >> n >> m >> k;

  fill(in,in+N,k);
  fill(out,out+N,-1);
  for(int i=0;i<k;i++) in[i]=out[i]=i;
  
  for(int i=0;i<k-1;i++){
  	v[i].push_back(i+1);
    g[i+1].push_back(i);
  }

  for(int i=1;i<=m;i++){
    int a,b;
    cin >> a >> b;
    v[a].push_back(b);
    g[b].push_back(a);
    if(in[a]>in[b]) upd_in(a,in[b]);
    if(out[a]>out[b]) upd_out(b,out[a]);
    if(a==b && a<k) ok=1;
    cout << ok << '\n';
  }
}

int32_t main(){
  cin.tie(0); ios::sync_with_stdio(0);
  int tc=1;//cin >> tc;
  while(tc--) _();
  return 0;
}*/
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1872 KB Output is correct
2 Correct 2 ms 1872 KB Output is correct
3 Correct 2 ms 1872 KB Output is correct
4 Correct 2 ms 1872 KB Output is correct
5 Correct 2 ms 1872 KB Output is correct
6 Correct 3 ms 1872 KB Output is correct
7 Correct 2 ms 1872 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1872 KB Output is correct
2 Correct 2 ms 1872 KB Output is correct
3 Correct 2 ms 1872 KB Output is correct
4 Correct 2 ms 1872 KB Output is correct
5 Correct 2 ms 1872 KB Output is correct
6 Correct 3 ms 1872 KB Output is correct
7 Correct 2 ms 1872 KB Output is correct
8 Correct 2 ms 1872 KB Output is correct
9 Correct 2 ms 1872 KB Output is correct
10 Correct 2 ms 1872 KB Output is correct
11 Correct 2 ms 1872 KB Output is correct
12 Correct 3 ms 1872 KB Output is correct
13 Correct 2 ms 1872 KB Output is correct
14 Correct 2 ms 1872 KB Output is correct
15 Correct 3 ms 1872 KB Output is correct
16 Correct 2 ms 1872 KB Output is correct
17 Correct 2 ms 1872 KB Output is correct
18 Correct 3 ms 1872 KB Output is correct
19 Correct 2 ms 1872 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1872 KB Output is correct
2 Correct 2 ms 1872 KB Output is correct
3 Correct 2 ms 1872 KB Output is correct
4 Correct 2 ms 1872 KB Output is correct
5 Correct 2 ms 1872 KB Output is correct
6 Correct 3 ms 1872 KB Output is correct
7 Correct 2 ms 1872 KB Output is correct
8 Correct 2 ms 1872 KB Output is correct
9 Correct 2 ms 1872 KB Output is correct
10 Correct 2 ms 1872 KB Output is correct
11 Correct 2 ms 1872 KB Output is correct
12 Correct 3 ms 1872 KB Output is correct
13 Correct 2 ms 1872 KB Output is correct
14 Correct 2 ms 1872 KB Output is correct
15 Correct 3 ms 1872 KB Output is correct
16 Correct 2 ms 1872 KB Output is correct
17 Correct 2 ms 1872 KB Output is correct
18 Correct 3 ms 1872 KB Output is correct
19 Correct 2 ms 1872 KB Output is correct
20 Correct 2 ms 1872 KB Output is correct
21 Correct 2 ms 1872 KB Output is correct
22 Correct 2 ms 2128 KB Output is correct
23 Correct 2 ms 2128 KB Output is correct
24 Correct 4 ms 2128 KB Output is correct
25 Correct 4 ms 2128 KB Output is correct
26 Correct 3 ms 2128 KB Output is correct
27 Correct 3 ms 2128 KB Output is correct
28 Correct 2 ms 2128 KB Output is correct
29 Correct 3 ms 2128 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1872 KB Output is correct
2 Correct 2 ms 1872 KB Output is correct
3 Correct 2 ms 1872 KB Output is correct
4 Correct 2 ms 1872 KB Output is correct
5 Correct 2 ms 1872 KB Output is correct
6 Correct 3 ms 1872 KB Output is correct
7 Correct 2 ms 1872 KB Output is correct
8 Correct 2 ms 1872 KB Output is correct
9 Correct 2 ms 1872 KB Output is correct
10 Correct 2 ms 1872 KB Output is correct
11 Correct 2 ms 1872 KB Output is correct
12 Correct 3 ms 1872 KB Output is correct
13 Correct 2 ms 1872 KB Output is correct
14 Correct 2 ms 1872 KB Output is correct
15 Correct 3 ms 1872 KB Output is correct
16 Correct 2 ms 1872 KB Output is correct
17 Correct 2 ms 1872 KB Output is correct
18 Correct 3 ms 1872 KB Output is correct
19 Correct 2 ms 1872 KB Output is correct
20 Correct 2 ms 1872 KB Output is correct
21 Correct 2 ms 1872 KB Output is correct
22 Correct 2 ms 2128 KB Output is correct
23 Correct 2 ms 2128 KB Output is correct
24 Correct 4 ms 2128 KB Output is correct
25 Correct 4 ms 2128 KB Output is correct
26 Correct 3 ms 2128 KB Output is correct
27 Correct 3 ms 2128 KB Output is correct
28 Correct 2 ms 2128 KB Output is correct
29 Correct 3 ms 2128 KB Output is correct
30 Correct 14 ms 3152 KB Output is correct
31 Correct 4 ms 2384 KB Output is correct
32 Correct 16 ms 3920 KB Output is correct
33 Correct 12 ms 3736 KB Output is correct
34 Correct 1149 ms 4688 KB Output is correct
35 Correct 383 ms 4324 KB Output is correct
36 Correct 27 ms 4136 KB Output is correct
37 Correct 31 ms 3920 KB Output is correct
38 Correct 26 ms 3900 KB Output is correct
39 Correct 19 ms 3696 KB Output is correct
40 Correct 919 ms 4960 KB Output is correct
41 Correct 178 ms 4016 KB Output is correct
42 Correct 112 ms 3916 KB Output is correct
43 Correct 33 ms 4424 KB Output is correct
44 Correct 816 ms 4736 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1872 KB Output is correct
2 Correct 2 ms 1872 KB Output is correct
3 Correct 2 ms 1872 KB Output is correct
4 Correct 2 ms 1872 KB Output is correct
5 Correct 2 ms 1872 KB Output is correct
6 Correct 3 ms 1872 KB Output is correct
7 Correct 2 ms 1872 KB Output is correct
8 Correct 2 ms 1872 KB Output is correct
9 Correct 2 ms 1872 KB Output is correct
10 Correct 2 ms 1872 KB Output is correct
11 Correct 2 ms 1872 KB Output is correct
12 Correct 3 ms 1872 KB Output is correct
13 Correct 2 ms 1872 KB Output is correct
14 Correct 2 ms 1872 KB Output is correct
15 Correct 3 ms 1872 KB Output is correct
16 Correct 2 ms 1872 KB Output is correct
17 Correct 2 ms 1872 KB Output is correct
18 Correct 3 ms 1872 KB Output is correct
19 Correct 2 ms 1872 KB Output is correct
20 Correct 2 ms 1872 KB Output is correct
21 Correct 2 ms 1872 KB Output is correct
22 Correct 2 ms 2128 KB Output is correct
23 Correct 2 ms 2128 KB Output is correct
24 Correct 4 ms 2128 KB Output is correct
25 Correct 4 ms 2128 KB Output is correct
26 Correct 3 ms 2128 KB Output is correct
27 Correct 3 ms 2128 KB Output is correct
28 Correct 2 ms 2128 KB Output is correct
29 Correct 3 ms 2128 KB Output is correct
30 Correct 14 ms 3152 KB Output is correct
31 Correct 4 ms 2384 KB Output is correct
32 Correct 16 ms 3920 KB Output is correct
33 Correct 12 ms 3736 KB Output is correct
34 Correct 1149 ms 4688 KB Output is correct
35 Correct 383 ms 4324 KB Output is correct
36 Correct 27 ms 4136 KB Output is correct
37 Correct 31 ms 3920 KB Output is correct
38 Correct 26 ms 3900 KB Output is correct
39 Correct 19 ms 3696 KB Output is correct
40 Correct 919 ms 4960 KB Output is correct
41 Correct 178 ms 4016 KB Output is correct
42 Correct 112 ms 3916 KB Output is correct
43 Correct 33 ms 4424 KB Output is correct
44 Correct 816 ms 4736 KB Output is correct
45 Runtime error 5 ms 3884 KB Execution killed with signal 11
46 Halted 0 ms 0 KB -