#include "Alice.h"
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define vll vector<ll>
#define pll pair<ll, ll>
typedef long long ll;
// 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().
vector<pair<int,int>> Alice(){
ll n=5000;
ll tar=setN(n);
vector<pair<int, int>> re;
if(tar<=n){
for(ll i=1;i<=n;i++){
if(i==tar) continue;
re.pb({i, tar});
}
}
return re;
}
#include "Bob.h"
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define vll vector<ll>
#define pll pair<ll, ll>
typedef long long ll;
// 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
ll n=5000;
vll cnt(n+1);
for(auto &[x, y]:V){
cnt[x]++;
cnt[y]++;
}
for(ll i=1;i<=n;i++){
if(cnt[i]>1){
return i;
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
# 2번째 컴파일 단계
Bob.cpp: In function 'long long int Bob(std::vector<std::pair<int, int> >)':
Bob.cpp:29:1: warning: control reaches end of non-void function [-Wreturn-type]
29 | }
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |