이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#ifndef MUAATH_5
#include "Alice.h"
#endif
#ifdef MUAATH_5
const int X_LIM = 5000;
int n__;
long long setN(int n) {
n__ = n;
return 231; // rand
}
#endif
// 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
vector<pair<int,int>> sol;
// change below into your code
const int n = 5000;
long long x = setN(n);
for (int i = 1; i <= n; i++) {
if (x != i)
sol.push_back({x, i});
}
return sol;
}
#ifdef MUAATH_5
int main()
{
const int t = 1;
cout << t << '\n';
for (int _ = 0; _ < t; _++) {
auto res = Alice();
cout << res.size() << '\n';
for (auto [u, v] : res) {
cout << u << ' ' << v << '\n';
}
assert(int(res.size()) == n__-1);
}
}
#endif
#include <bits/stdc++.h>
using namespace std;
#ifndef MUAATH_5
#include "Bob.h"
#endif
// 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().
int freq[5001];
long long Bob(std::vector<std::pair<int,int>> V){
memset(freq, 0, sizeof freq);
for (auto [u, v] : V)
freq[u]++, freq[v]++;
int mx = max_element(freq, freq+5001)-freq;
return mx;
}
#ifdef MUAATH_5
int main()
{
int m;
cin >> m;
vector<pair<int, int>> vv(m);
for (int i = 0; i < m; i++) {
int u, v;
cin >> u >> v;
if (u > v) swap(u, v);
vv[i] = {u, v};
}
sort(vv.begin(), vv.end());
cout << Bob(vv);
}
#endif
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |