Submission #1366733

#TimeUsernameProblemLanguageResultExecution timeMemory
1366733ahmdnawazMagic Show (APIO24_show)C++20
0 / 100
3 ms592 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 = {88, 135, 254, 293, 349, 362, 619, 833, 862, 943, 966, 1079, 1090, 1134, 1193, 1552, 1588, 1631, 1661, 1681, 1725, 1756, 1875, 1915, 1975, 2009, 2045, 2065, 2161, 2191, 2217, 2249, 2260, 2325, 2426, 2565, 2627, 2641, 2838, 2902, 2954, 2974, 2988, 3044, 3102, 3156, 3188, 3221, 3314, 3342, 3396, 3419, 3482, 3537, 3920, 3941, 4010, 4171, 4181, 4197};
    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 < 10; 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 = {88, 135, 254, 293, 349, 362, 619, 833, 862, 943, 966, 1079, 1090, 1134, 1193, 1552, 1588, 1631, 1661, 1681, 1725, 1756, 1875, 1915, 1975, 2009, 2045, 2065, 2161, 2191, 2217, 2249, 2260, 2325, 2426, 2565, 2627, 2641, 2838, 2902, 2954, 2974, 2988, 3044, 3102, 3156, 3188, 3221, 3314, 3342, 3396, 3419, 3482, 3537, 3920, 3941, 4010, 4171, 4181, 4197};
	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...