Submission #1078379

# Submission time Handle Problem Language Result Execution time Memory
1078379 2024-08-27T16:03:10 Z Marco_Escandon Magic Show (APIO24_show) C++17
0 / 100
3 ms 1588 KB
#include "Alice.h"
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
std::vector<std::pair<int,int>> Alice(){
	ll n=5000;
    long long x = setN(n);
	map<pair<ll,ll>,ll> mapa;
	vector<pair<ll,ll>> temp;
	ll a=x/5000+1;ll b=x%5000+1;
	mapa[{a,b}]=1;
	mapa[{b,a}]=1;
	temp.push_back({a,b});
	ll c1=1;
	for(int i=1; i<=n; i++)
	{
		if(c1>=(n-2)/2&&i!=b&&mapa[{i,b}]==0)
		{
			temp.push_back({i,b});
			mapa[{i,b}]=1;
			mapa[{b,i}]=1;
		}
		if(i!=a&&c1<(n-2)/2&&mapa[{i,a}]==0)
		{
			temp.push_back({i,a});
			mapa[{i,a}]=1;
			mapa[{a,i}]=1;
			c1++;
		}
	}
    return temp;
}
//#include "Bob.h"
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
long long Bob(std::vector<std::pair<int,int>> V){
	vector<ll> v(5001,0);
	pair<ll,ll> a={0,0};
	for(auto i:V)
	{
		v[i.first]++;
		v[i.second]++;
		a=max(max(make_pair(i.first,i.second),make_pair(i.second,i.first)),a);
	}
	pair<ll,ll> bs={0,0};
	for(int i=0; i<5001; i++)
	{
		bs=max(make_pair(v[i],i),bs);
	}
	v[bs.second]=0;
	pair<ll,ll> bs2={0,0};
	for(int i=0; i<5001; i++)
	{
		bs2=max(make_pair(v[i],i),bs2);
	}
	if(bs2.first<=1) bs2=bs;
	//cout<<bs.second<<" "<<bs2.second<<"\n";
	if(a.second==bs.second||a.first==bs.second)
		swap(bs,bs2);
	if(bs2.second-1==0) bs.second++;
    return (bs.second-1)*5000+bs2.second-1;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1584 KB Correct.
2 Incorrect 2 ms 1588 KB Incorrect answer.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1584 KB Correct.
2 Incorrect 2 ms 1588 KB Incorrect answer.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1584 KB Correct.
2 Incorrect 2 ms 1588 KB Incorrect answer.
3 Halted 0 ms 0 KB -