#include <vector>
#include "Alice.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().
using namespace std;
std::vector<std::pair<int,int>> Alice(){
// add your code here
// change below into your code
long long x = setN(5000);
vector<pair<int, int>> tree;
for (int i = 1; i <= 5000; ++i) {
if (i == x) continue;
tree.emplace_back(x, i);
}
return tree;
}
#include <vector>
#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().
using namespace std;
long long Bob(std::vector<std::pair<int,int>> V){
vector<int> cnts(5001, 0);
for (auto &i : V) ++cnts[i.first], ++cnts[i.second];
for (int i = 1; i <= 5000; ++i) {
if (cnts[i] > 1) return i;
}
}
컴파일 시 표준 에러 (stderr) 메시지
# 2번째 컴파일 단계
Bob.cpp: In function 'long long int Bob(std::vector<std::pair<int, int> >)':
Bob.cpp:15:1: warning: control reaches end of non-void function [-Wreturn-type]
15 | }
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |