제출 #1334571

#제출 시각아이디문제언어결과실행 시간메모리
1334571ThylOne마술쇼 (APIO24_show)C++17
0 / 100
3 ms580 KiB
#include <vector>
#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
    const int N = 5000;
    long long x = setN(N);
    std::vector<std::pair<int,int>> re;
    for(int i = 1 ; i <= N ; i++){
        if(i != x)re.emplace_back(i, x);
    }
    return re;
}
#include <vector>
#include <algorithm>
using namespace std;
#include "Bob.h"

// 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().

long long Bob(std::vector<std::pair<int,int>> V){
	// add your code here
	std::vector<int> occ(V.size()+42, 0);
    int m_occ = 0;
    int val = -1;
    for(auto p:V){
        occ[p.first]++;
        occ[p.second]++;
        if(occ[p.first] > m_occ){
            m_occ = occ[p.first];
            val = p.first;
        }
        if(occ[p.second] > m_occ){
            m_occ = occ[p.second];
            val = p.second;
        }
    }
    return val; // change this into your code
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...