# | Submission time^{} |
Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|

875972 | 2023-11-20T22:51:35 Z | AlphaMale06 | Game (IOI14_game) | C++14 | 265 ms | 26708 KB |

#include <bits/stdc++.h> #include "game.h" using namespace std; const int N = 1501; int cnt[N][N]; int p[N]; int sz[N]; void make(int i){ p[i]=i; sz[i]=1; } int f(int a){ if(p[a]==a)return a; return p[a]=f(p[a]); } void un(int u, int v){ p[v]=u; sz[u]+=sz[v]; } int hasEdge(int u, int v){ u=f(u); v=f(v); int szu=sz[u]; int szv=sz[v]; int k=szu+szv; int num=k*(k-1)/2 - szu*(szu-1)/2 -szv*(szv-1)/2; if(cnt[u][v]==num-1){ if(szu<szv){ swap(u, v); } un(u, v); for(int i=0; i< N; i++){ if(i!=u){ cnt[u][i]+=cnt[v][i]; cnt[i][u]+=cnt[v][i]; } } return 1; } else{ cnt[u][v]++; cnt[v][u]++; return 0; } } void initialize(int n){ for(int i=0; i< n; i++)make(i); }

# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|

1 | Correct | 4 ms | 10584 KB | Output is correct |

2 | Correct | 2 ms | 10588 KB | Output is correct |

3 | Correct | 2 ms | 10584 KB | Output is correct |

4 | Correct | 2 ms | 10588 KB | Output is correct |

5 | Correct | 2 ms | 10588 KB | Output is correct |

6 | Correct | 1 ms | 10588 KB | Output is correct |

7 | Correct | 1 ms | 10588 KB | Output is correct |

8 | Correct | 1 ms | 10688 KB | Output is correct |

9 | Correct | 1 ms | 10588 KB | Output is correct |

10 | Correct | 2 ms | 10588 KB | Output is correct |

11 | Correct | 1 ms | 10588 KB | Output is correct |

12 | Correct | 2 ms | 10692 KB | Output is correct |

13 | Correct | 1 ms | 10688 KB | Output is correct |

14 | Correct | 1 ms | 10588 KB | Output is correct |

15 | Correct | 1 ms | 10588 KB | Output is correct |

16 | Correct | 1 ms | 10688 KB | Output is correct |

17 | Correct | 2 ms | 10820 KB | Output is correct |

18 | Correct | 1 ms | 10588 KB | Output is correct |

19 | Correct | 1 ms | 10588 KB | Output is correct |

20 | Correct | 1 ms | 10588 KB | Output is correct |

21 | Correct | 2 ms | 10588 KB | Output is correct |

22 | Correct | 2 ms | 10588 KB | Output is correct |

23 | Correct | 2 ms | 10588 KB | Output is correct |

24 | Correct | 2 ms | 10588 KB | Output is correct |

# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|

1 | Correct | 2 ms | 10588 KB | Output is correct |

2 | Correct | 2 ms | 10588 KB | Output is correct |

3 | Correct | 2 ms | 10588 KB | Output is correct |

4 | Correct | 1 ms | 10588 KB | Output is correct |

5 | Correct | 1 ms | 10588 KB | Output is correct |

6 | Correct | 2 ms | 10584 KB | Output is correct |

7 | Correct | 2 ms | 10584 KB | Output is correct |

8 | Correct | 2 ms | 10588 KB | Output is correct |

9 | Correct | 2 ms | 10588 KB | Output is correct |

10 | Correct | 2 ms | 10588 KB | Output is correct |

11 | Correct | 2 ms | 10588 KB | Output is correct |

12 | Correct | 1 ms | 10588 KB | Output is correct |

13 | Correct | 1 ms | 10588 KB | Output is correct |

14 | Correct | 1 ms | 10588 KB | Output is correct |

15 | Correct | 1 ms | 10588 KB | Output is correct |

16 | Correct | 1 ms | 10588 KB | Output is correct |

17 | Correct | 2 ms | 10596 KB | Output is correct |

18 | Correct | 1 ms | 10596 KB | Output is correct |

19 | Correct | 1 ms | 10596 KB | Output is correct |

20 | Correct | 1 ms | 10588 KB | Output is correct |

21 | Correct | 1 ms | 10588 KB | Output is correct |

22 | Correct | 1 ms | 10588 KB | Output is correct |

23 | Correct | 1 ms | 10588 KB | Output is correct |

24 | Correct | 2 ms | 10588 KB | Output is correct |

25 | Correct | 2 ms | 10844 KB | Output is correct |

26 | Correct | 2 ms | 10844 KB | Output is correct |

27 | Correct | 2 ms | 10844 KB | Output is correct |

28 | Correct | 2 ms | 10076 KB | Output is correct |

29 | Correct | 2 ms | 10844 KB | Output is correct |

30 | Correct | 2 ms | 10844 KB | Output is correct |

31 | Correct | 5 ms | 10076 KB | Output is correct |

32 | Correct | 2 ms | 10844 KB | Output is correct |

33 | Correct | 2 ms | 10076 KB | Output is correct |

34 | Correct | 3 ms | 10188 KB | Output is correct |

35 | Correct | 2 ms | 10844 KB | Output is correct |

36 | Correct | 2 ms | 10868 KB | Output is correct |

37 | Correct | 3 ms | 10332 KB | Output is correct |

38 | Correct | 3 ms | 10332 KB | Output is correct |

39 | Correct | 3 ms | 10332 KB | Output is correct |

40 | Correct | 3 ms | 10332 KB | Output is correct |

41 | Correct | 3 ms | 10180 KB | Output is correct |

42 | Correct | 3 ms | 10332 KB | Output is correct |

43 | Correct | 3 ms | 10696 KB | Output is correct |

44 | Correct | 3 ms | 10072 KB | Output is correct |

45 | Correct | 3 ms | 10332 KB | Output is correct |

46 | Correct | 3 ms | 10332 KB | Output is correct |

47 | Correct | 3 ms | 10332 KB | Output is correct |

48 | Correct | 3 ms | 10332 KB | Output is correct |

49 | Correct | 3 ms | 10184 KB | Output is correct |

50 | Correct | 3 ms | 10184 KB | Output is correct |

51 | Correct | 3 ms | 10332 KB | Output is correct |

52 | Correct | 3 ms | 10332 KB | Output is correct |

53 | Correct | 3 ms | 10332 KB | Output is correct |

54 | Correct | 3 ms | 10328 KB | Output is correct |

# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|

1 | Correct | 1 ms | 10588 KB | Output is correct |

2 | Correct | 1 ms | 10588 KB | Output is correct |

3 | Correct | 2 ms | 10844 KB | Output is correct |

4 | Correct | 1 ms | 10588 KB | Output is correct |

5 | Correct | 2 ms | 10588 KB | Output is correct |

6 | Correct | 1 ms | 10588 KB | Output is correct |

7 | Correct | 1 ms | 10588 KB | Output is correct |

8 | Correct | 2 ms | 10588 KB | Output is correct |

9 | Correct | 1 ms | 10692 KB | Output is correct |

10 | Correct | 1 ms | 10588 KB | Output is correct |

11 | Correct | 1 ms | 10588 KB | Output is correct |

12 | Correct | 1 ms | 10588 KB | Output is correct |

13 | Correct | 1 ms | 10588 KB | Output is correct |

14 | Correct | 1 ms | 10588 KB | Output is correct |

15 | Correct | 2 ms | 10588 KB | Output is correct |

16 | Correct | 1 ms | 10588 KB | Output is correct |

17 | Correct | 1 ms | 10588 KB | Output is correct |

18 | Correct | 2 ms | 10588 KB | Output is correct |

19 | Correct | 2 ms | 10588 KB | Output is correct |

20 | Correct | 1 ms | 10588 KB | Output is correct |

21 | Correct | 1 ms | 10588 KB | Output is correct |

22 | Correct | 1 ms | 10588 KB | Output is correct |

23 | Correct | 2 ms | 10588 KB | Output is correct |

24 | Correct | 2 ms | 10588 KB | Output is correct |

25 | Correct | 2 ms | 10844 KB | Output is correct |

26 | Correct | 2 ms | 10844 KB | Output is correct |

27 | Correct | 2 ms | 10840 KB | Output is correct |

28 | Correct | 2 ms | 10076 KB | Output is correct |

29 | Correct | 2 ms | 10844 KB | Output is correct |

30 | Correct | 2 ms | 10844 KB | Output is correct |

31 | Correct | 2 ms | 10076 KB | Output is correct |

32 | Correct | 2 ms | 10844 KB | Output is correct |

33 | Correct | 2 ms | 10076 KB | Output is correct |

34 | Correct | 3 ms | 10328 KB | Output is correct |

35 | Correct | 2 ms | 10844 KB | Output is correct |

36 | Correct | 2 ms | 10872 KB | Output is correct |

37 | Correct | 3 ms | 10332 KB | Output is correct |

38 | Correct | 3 ms | 10332 KB | Output is correct |

39 | Correct | 3 ms | 10188 KB | Output is correct |

40 | Correct | 3 ms | 10332 KB | Output is correct |

41 | Correct | 3 ms | 10332 KB | Output is correct |

42 | Correct | 3 ms | 10332 KB | Output is correct |

43 | Correct | 3 ms | 10840 KB | Output is correct |

44 | Correct | 3 ms | 10072 KB | Output is correct |

45 | Correct | 3 ms | 10328 KB | Output is correct |

46 | Correct | 3 ms | 10332 KB | Output is correct |

47 | Correct | 3 ms | 10332 KB | Output is correct |

48 | Correct | 3 ms | 10332 KB | Output is correct |

49 | Correct | 3 ms | 10332 KB | Output is correct |

50 | Correct | 3 ms | 10332 KB | Output is correct |

51 | Correct | 3 ms | 10332 KB | Output is correct |

52 | Correct | 3 ms | 10328 KB | Output is correct |

53 | Correct | 3 ms | 10332 KB | Output is correct |

54 | Correct | 3 ms | 10188 KB | Output is correct |

55 | Correct | 32 ms | 12092 KB | Output is correct |

56 | Correct | 30 ms | 11856 KB | Output is correct |

57 | Correct | 41 ms | 12116 KB | Output is correct |

58 | Correct | 33 ms | 12008 KB | Output is correct |

59 | Correct | 30 ms | 11856 KB | Output is correct |

60 | Correct | 30 ms | 11860 KB | Output is correct |

61 | Correct | 40 ms | 11968 KB | Output is correct |

62 | Correct | 30 ms | 12024 KB | Output is correct |

63 | Correct | 30 ms | 11856 KB | Output is correct |

64 | Correct | 28 ms | 11872 KB | Output is correct |

65 | Correct | 31 ms | 11348 KB | Output is correct |

66 | Correct | 32 ms | 12108 KB | Output is correct |

67 | Correct | 30 ms | 12124 KB | Output is correct |

68 | Correct | 30 ms | 12120 KB | Output is correct |

69 | Correct | 32 ms | 12012 KB | Output is correct |

70 | Correct | 32 ms | 11996 KB | Output is correct |

71 | Correct | 38 ms | 12096 KB | Output is correct |

72 | Correct | 29 ms | 11864 KB | Output is correct |

73 | Correct | 29 ms | 11868 KB | Output is correct |

74 | Correct | 29 ms | 11860 KB | Output is correct |

75 | Correct | 31 ms | 11860 KB | Output is correct |

76 | Correct | 65 ms | 13648 KB | Output is correct |

77 | Correct | 65 ms | 13616 KB | Output is correct |

78 | Correct | 78 ms | 13676 KB | Output is correct |

79 | Correct | 79 ms | 13920 KB | Output is correct |

80 | Correct | 66 ms | 13692 KB | Output is correct |

81 | Correct | 71 ms | 13536 KB | Output is correct |

82 | Correct | 68 ms | 13548 KB | Output is correct |

83 | Correct | 90 ms | 13660 KB | Output is correct |

84 | Correct | 65 ms | 13648 KB | Output is correct |

85 | Correct | 121 ms | 17928 KB | Output is correct |

86 | Correct | 110 ms | 17884 KB | Output is correct |

87 | Correct | 116 ms | 17748 KB | Output is correct |

88 | Correct | 111 ms | 17952 KB | Output is correct |

89 | Correct | 112 ms | 17956 KB | Output is correct |

90 | Correct | 110 ms | 17744 KB | Output is correct |

91 | Correct | 124 ms | 17884 KB | Output is correct |

92 | Correct | 112 ms | 17748 KB | Output is correct |

93 | Correct | 113 ms | 17748 KB | Output is correct |

94 | Correct | 255 ms | 26488 KB | Output is correct |

95 | Correct | 265 ms | 26676 KB | Output is correct |

96 | Correct | 248 ms | 26708 KB | Output is correct |

97 | Correct | 251 ms | 26588 KB | Output is correct |

98 | Correct | 256 ms | 26548 KB | Output is correct |

99 | Correct | 247 ms | 26452 KB | Output is correct |

100 | Correct | 250 ms | 26588 KB | Output is correct |