Submission #1346044

#TimeUsernameProblemLanguageResultExecution timeMemory
1346044Joon_YorigamiMagic Show (APIO24_show)C++20
5 / 100
2 ms1092 KiB
#include <vector>
#include <bits/stdc++.h>
#include "Alice.h"
using namespace std;
// you may define some global variables, but it does not work if you try to transfer any information from function Alice() to function Bob() through these variables.
// you had better not use the same global variables in function Alice() and in function Bob().

std::vector<std::pair<int,int>> Alice(){
	// add your code here
	
	// change below into your code
    std::vector<std::pair<int,int>> ret;
    long long x = setN(5000);
    if(x<=5000)
    {
        for(int i=1;i<=5000;i++)
        {
            if(i==x)continue;
            ret.push_back({x,i});
        }
        return ret;
    }
    return std::vector<std::pair<int,int>>{{1, 2}, {2, 3}, {2, 4}};
}
#include <vector>
#include <bits/stdc++.h>
#include "Bob.h"
using namespace std;
// you may define some global variables, but it does not work if you try to transfer any information from function Alice() to function Bob() through these variables.
// you had better not use the same global variables in function Alice() and in function Bob().

bool checkIfDumbCase(std::vector<std::pair<int,int>> &adj)
{
    vector<int> degree(5001,0);
    for(auto edge:adj) 
    {
        degree[edge.first]+=1;
        degree[edge.second]+=1;
    }
    int cnt=0;
    for(int i=1;i<=5000;i++)
        cnt+=degree[i]>1;
    return cnt==1;
}

long long Bob(std::vector<std::pair<int,int>> adj){
	// add your code here
    vector<int> degree(5001,0);
    for(auto edge:adj) 
    {
        degree[edge.first]+=1;
        degree[edge.second]+=1;
    }
	if(checkIfDumbCase(adj))
    {
        for(int i=1;i<=5000;i++)
            if(degree[i]>1)
                return i;
    }
    return 3; // change this into your code
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...