Submission #991517

#TimeUsernameProblemLanguageResultExecution timeMemory
991517Muaath_5Magic Show (APIO24_show)C++17
5 / 100
2 ms832 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...