Submission #1040085

# Submission time Handle Problem Language Result Execution time Memory
1040085 2024-07-31T15:55:30 Z _8_8_ Magic Show (APIO24_show) C++17
35 / 100
1000 ms 263108 KB
#include <bits/stdc++.h>
#include "Alice.h"
using namespace std;
typedef long long ll;
vector<pair<int,int>> vec;
const int N = 5e3;
int p[N + 12];
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int get(int v) {
    if(p[v] == v) return v;
    return p[v] = get(p[v]);
}
bool merge(int x,int y) {
    x = get(x);
    y = get(y);
    if(x == y) return false;
    p[x] = y;
    return 1;
}
vector<pair<int,int>> Alice(){
    long long x = setN(5000);
    iota(p+1,p+N+1,1);
    for(int i = 1;i <= N;i++) {
        for(int j = 1; j <= N; j++) {
            ll t = (i + j) % 60;
            if((x >> t) & 1) {
                vec.push_back({i,j});
            }
        }
    }
    shuffle(vec.begin(),vec.end(),rng);
    vector<pair<int,int>> ans;
    for(auto [x,y]:vec) {
        if(merge(x,y)) {
            ans.push_back({x,y});
        }
    }
    return ans;
}
#include <vector>
#include "Bob.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
long long Bob(std::vector<std::pair<int,int>> V){
    ll X = 0;
    for(auto [x,y]:V) {
        X |= (1ll << ((x + y) % 60));
    }
    return X;
}
# Verdict Execution time Memory Grader output
1 Correct 86 ms 35656 KB Correct.
2 Correct 102 ms 35404 KB Correct.
3 Correct 42 ms 17816 KB Correct.
4 Correct 59 ms 18252 KB Correct.
5 Correct 69 ms 35380 KB Correct.
6 Correct 104 ms 33836 KB Correct.
7 Correct 50 ms 17644 KB Correct.
8 Correct 60 ms 18764 KB Correct.
9 Correct 79 ms 33864 KB Correct.
10 Correct 70 ms 34368 KB Correct.
11 Correct 70 ms 34624 KB Correct.
12 Correct 48 ms 17740 KB Correct.
# Verdict Execution time Memory Grader output
1 Correct 86 ms 35656 KB Correct.
2 Correct 102 ms 35404 KB Correct.
3 Correct 42 ms 17816 KB Correct.
4 Correct 59 ms 18252 KB Correct.
5 Correct 69 ms 35380 KB Correct.
6 Correct 104 ms 33836 KB Correct.
7 Correct 50 ms 17644 KB Correct.
8 Correct 60 ms 18764 KB Correct.
9 Correct 79 ms 33864 KB Correct.
10 Correct 70 ms 34368 KB Correct.
11 Correct 70 ms 34624 KB Correct.
12 Correct 48 ms 17740 KB Correct.
13 Correct 163 ms 66716 KB Correct.
14 Correct 178 ms 66604 KB Correct.
15 Correct 191 ms 67112 KB Correct.
16 Correct 156 ms 68064 KB Correct.
17 Correct 185 ms 68016 KB Correct.
18 Correct 242 ms 68024 KB Correct.
19 Correct 224 ms 66496 KB Correct.
20 Correct 307 ms 66600 KB Correct.
21 Correct 115 ms 35380 KB Correct.
22 Correct 184 ms 66856 KB Correct.
23 Correct 98 ms 35104 KB Correct.
24 Correct 273 ms 68420 KB Correct.
# Verdict Execution time Memory Grader output
1 Correct 86 ms 35656 KB Correct.
2 Correct 102 ms 35404 KB Correct.
3 Correct 42 ms 17816 KB Correct.
4 Correct 59 ms 18252 KB Correct.
5 Correct 69 ms 35380 KB Correct.
6 Correct 104 ms 33836 KB Correct.
7 Correct 50 ms 17644 KB Correct.
8 Correct 60 ms 18764 KB Correct.
9 Correct 79 ms 33864 KB Correct.
10 Correct 70 ms 34368 KB Correct.
11 Correct 70 ms 34624 KB Correct.
12 Correct 48 ms 17740 KB Correct.
13 Correct 163 ms 66716 KB Correct.
14 Correct 178 ms 66604 KB Correct.
15 Correct 191 ms 67112 KB Correct.
16 Correct 156 ms 68064 KB Correct.
17 Correct 185 ms 68016 KB Correct.
18 Correct 242 ms 68024 KB Correct.
19 Correct 224 ms 66496 KB Correct.
20 Correct 307 ms 66600 KB Correct.
21 Correct 115 ms 35380 KB Correct.
22 Correct 184 ms 66856 KB Correct.
23 Correct 98 ms 35104 KB Correct.
24 Correct 273 ms 68420 KB Correct.
25 Correct 733 ms 132380 KB Correct.
26 Correct 601 ms 132248 KB Correct.
27 Correct 582 ms 134044 KB Correct.
28 Correct 785 ms 132244 KB Correct.
29 Correct 550 ms 132152 KB Correct.
30 Correct 594 ms 132328 KB Correct.
31 Correct 739 ms 132104 KB Correct.
32 Correct 787 ms 132528 KB Correct.
33 Correct 651 ms 132124 KB Correct.
34 Correct 574 ms 132112 KB Correct.
35 Correct 631 ms 132120 KB Correct.
36 Correct 523 ms 132280 KB Correct.
37 Correct 718 ms 132056 KB Correct.
38 Correct 739 ms 132092 KB Correct.
39 Correct 856 ms 133828 KB Correct.
40 Execution timed out 1010 ms 263108 KB Time limit exceeded
41 Halted 0 ms 0 KB -