| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1317557 | haithamcoder | Team Coding (EGOI24_teamcoding) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
const ll LOG = 31;
const ll MOD = 1000000007;
const ll inf = 1e17;
const ll B = 2305843009213693951;
#define db(x) cerr << #x << " = " << x << " | "
#define dbg(x) cerr << #x << " = " << x << "\n"
#define Algerian ios::sync_with_stdio(0);
#define OI cin.tie(NULL);
int main() {
Algerian OI
ll n, k;
cin >> n >> k;
vector<ll> a(n), p(n);
vector<vector<ll>> ch(n);
for (ll i = 0; i < n; i++) cin >> a[i];
for (ll i = 0; i < n; i++) {
cin >> p[i];
if (p[i] != -1) ch[p[i]].push_back(i);
}
vector<ll> freq(k);
ll res = 0;
for (ll i = 0; i < n; i++) {
res = max(res, ++freq[a[i]]);
}
cout << res << " 0\n";
return 0;
}
S
