Submission #1366755

#TimeUsernameProblemLanguageResultExecution timeMemory
1366755ahmdnawazMagic Show (APIO24_show)C++20
0 / 100
3 ms588 KiB
#include <bits/stdc++.h>
#include "Alice.h"

using namespace std;


using ll = int64_t;

std::vector<std::pair<int,int>> Alice(){
	ll X = setN(5000);
	vector<int> nums = {23, 43, 89, 256, 362, 446, 522, 555, 578, 612, 691, 714, 736, 811, 927, 957, 998, 1028, 1059, 1121, 1163, 1228, 1296, 1412, 1460, 1532, 1646, 1770, 1867, 1889, 1909, 2082, 2150, 2192, 2272, 2322, 2344, 2437, 2481, 2671, 2704, 2771, 2795, 2875, 2930, 2964, 3040, 3095, 3150, 3231, 3274, 3296, 3330, 3402, 3452, 3508, 3557, 3617, 3670, 3697};
    int back = 5000;
    set<pair<int, int>> edges;
    for (int i = 1; i < 5000; i++) edges.insert({i, i + 1});
    for (int i = 1; i < 5000; i++) {
    	auto it = lower_bound(nums.begin(), nums.end(), i);
    	if (it != nums.end() && *it == i) {
    		ll ind = it - nums.begin();
    		if (!((X >> ind) & 1)) continue;
    		for (int j = 0; j < 18; j++) {
    			edges.erase({back - 1, back});
    			edges.insert({i, back});
    			back--;
    		}
    	}
    }
    vector<pair<int, int>> vec;
    for (auto [u, v] : edges) vec.push_back({u, v});
    return vec;
}
#include <bits/stdc++.h>
#include "Bob.h"

using namespace std;


using ll = int64_t;

long long Bob(std::vector<std::pair<int,int>> V){
	vector<int> deg(5001, 0);
	for (auto [u, v] : V) {
		deg[u]++;
		deg[v]++;
	}
	vector<int> nums = {23, 43, 89, 256, 362, 446, 522, 555, 578, 612, 691, 714, 736, 811, 927, 957, 998, 1028, 1059, 1121, 1163, 1228, 1296, 1412, 1460, 1532, 1646, 1770, 1867, 1889, 1909, 2082, 2150, 2192, 2272, 2322, 2344, 2437, 2481, 2671, 2704, 2771, 2795, 2875, 2930, 2964, 3040, 3095, 3150, 3231, 3274, 3296, 3330, 3402, 3452, 3508, 3557, 3617, 3670, 3697};
	ll ans = 0;
	for (ll i = 0; i < 60; i++) {
		ll x = nums[i];
		if (deg[x] > 2) ans |= (1LL << i); 
	}
	return ans; 
}
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...