Submission #993966

# Submission time Handle Problem Language Result Execution time Memory
993966 2024-06-06T22:31:56 Z MilosMilutinovic Magic Show (APIO24_show) C++17
100 / 100
3 ms 1316 KB
#include "Alice.h"
#include <bits/stdc++.h>

using namespace std;

vector<pair<int, int>> Alice() {
  long long x = setN(5000);
  vector<pair<int, int>> edges;
  edges.emplace_back(1, 2);
  int t = 0;
  for (int i = 3; i <= 5000;) {
    vector<int> one, zero;
    for (int j = 0; j < 60; j++) {
      if (i + j > 5000) {
        continue;
      }
      int b = (i + j) % 60;
      if (x >> b & 1) {
        one.push_back(i + j);
      } else {
        zero.push_back(i + j);
      }
    }
    if (t == 0) {
      for (int i : one) {
        edges.emplace_back(1, i);
      }
      for (int i : zero) {
        edges.emplace_back(2, i);
      }
    } else {
      for (int i : one) {
        edges.emplace_back(2, i);
      } 
      for (int i : zero) {
        edges.emplace_back(1, i);
      }
    }
    i += 60;
    t ^= 1;
  }
  return edges;
}
#include <bits/stdc++.h>
#include "Bob.h"

using namespace std;

long long Bob(vector<pair<int,int>> v) {
  int n = 5000;
  vector<vector<int>> g(n + 1);
  for (auto& p : v) {
    g[p.first].push_back(p.second);
    g[p.second].push_back(p.first);
  }
  long long res = 0;
  int t = 0;
  for (int i = 3; i <= 5000; ) {
    for (int j = 0; j < 60; j++) {
      if (i + j > 5000) {
        break;
      }
      int b = (i + j) % 60;
      for (int c : g[i + j]) {
        if (c == 1 && t == 0) {
          res |= (1LL << b);
        }
        if (c == 2 && t == 1) {
          res |= (1LL << b);
        }
      }
    }
    i += 60;
    t ^= 1;
  }
  return res;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1064 KB Correct.
2 Correct 2 ms 1064 KB Correct.
3 Correct 2 ms 1064 KB Correct.
4 Correct 2 ms 1064 KB Correct.
5 Correct 2 ms 1068 KB Correct.
6 Correct 2 ms 1064 KB Correct.
7 Correct 2 ms 1064 KB Correct.
8 Correct 2 ms 1064 KB Correct.
9 Correct 2 ms 1064 KB Correct.
10 Correct 2 ms 1064 KB Correct.
11 Correct 2 ms 1064 KB Correct.
12 Correct 1 ms 1064 KB Correct.
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1064 KB Correct.
2 Correct 2 ms 1064 KB Correct.
3 Correct 2 ms 1064 KB Correct.
4 Correct 2 ms 1064 KB Correct.
5 Correct 2 ms 1068 KB Correct.
6 Correct 2 ms 1064 KB Correct.
7 Correct 2 ms 1064 KB Correct.
8 Correct 2 ms 1064 KB Correct.
9 Correct 2 ms 1064 KB Correct.
10 Correct 2 ms 1064 KB Correct.
11 Correct 2 ms 1064 KB Correct.
12 Correct 1 ms 1064 KB Correct.
13 Correct 2 ms 1064 KB Correct.
14 Correct 2 ms 1064 KB Correct.
15 Correct 2 ms 1076 KB Correct.
16 Correct 2 ms 1072 KB Correct.
17 Correct 2 ms 1064 KB Correct.
18 Correct 2 ms 1064 KB Correct.
19 Correct 2 ms 1064 KB Correct.
20 Correct 1 ms 1064 KB Correct.
21 Correct 2 ms 1076 KB Correct.
22 Correct 2 ms 1064 KB Correct.
23 Correct 2 ms 1128 KB Correct.
24 Correct 2 ms 1064 KB Correct.
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1064 KB Correct.
2 Correct 2 ms 1064 KB Correct.
3 Correct 2 ms 1064 KB Correct.
4 Correct 2 ms 1064 KB Correct.
5 Correct 2 ms 1068 KB Correct.
6 Correct 2 ms 1064 KB Correct.
7 Correct 2 ms 1064 KB Correct.
8 Correct 2 ms 1064 KB Correct.
9 Correct 2 ms 1064 KB Correct.
10 Correct 2 ms 1064 KB Correct.
11 Correct 2 ms 1064 KB Correct.
12 Correct 1 ms 1064 KB Correct.
13 Correct 2 ms 1064 KB Correct.
14 Correct 2 ms 1064 KB Correct.
15 Correct 2 ms 1076 KB Correct.
16 Correct 2 ms 1072 KB Correct.
17 Correct 2 ms 1064 KB Correct.
18 Correct 2 ms 1064 KB Correct.
19 Correct 2 ms 1064 KB Correct.
20 Correct 1 ms 1064 KB Correct.
21 Correct 2 ms 1076 KB Correct.
22 Correct 2 ms 1064 KB Correct.
23 Correct 2 ms 1128 KB Correct.
24 Correct 2 ms 1064 KB Correct.
25 Correct 2 ms 1064 KB Correct.
26 Correct 2 ms 1060 KB Correct.
27 Correct 2 ms 1012 KB Correct.
28 Correct 2 ms 1064 KB Correct.
29 Correct 2 ms 1064 KB Correct.
30 Correct 2 ms 1064 KB Correct.
31 Correct 1 ms 1064 KB Correct.
32 Correct 2 ms 1068 KB Correct.
33 Correct 2 ms 1076 KB Correct.
34 Correct 1 ms 1064 KB Correct.
35 Correct 3 ms 1072 KB Correct.
36 Correct 1 ms 1072 KB Correct.
37 Correct 2 ms 1064 KB Correct.
38 Correct 1 ms 1064 KB Correct.
39 Correct 1 ms 1064 KB Correct.
40 Correct 2 ms 1064 KB Correct.
41 Correct 2 ms 1316 KB Correct.
42 Correct 1 ms 1064 KB Correct.
43 Correct 2 ms 1064 KB Correct.
44 Correct 3 ms 1064 KB Correct.