56362023-08-30 18:39:19TomaSajtBejgli (80 pont)cpp17Accepted 80/8032ms6664 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;

  vector<int> a(n);
  for (int& ai : a) cin >> ai;

  int cnt = 0;
  map<int, int> cnts;
  for (int i = 0; i < n; i += a[i]) cnt++, cnts[a[i]]++;

  cout << cnt << '\n';
  cout << max_element(cnts.begin(), cnts.end(), [](auto& p1, auto& p2) { return p1.second < p2.second; })->first;
}
SubtaskSumTestVerdictTimeMemory
base80/80
1Accepted0/03ms1808 KiB
2Accepted0/03ms2064 KiB
3Accepted4/42ms2272 KiB
4Accepted4/43ms2492 KiB
5Accepted4/42ms2460 KiB
6Accepted4/43ms2840 KiB
7Accepted4/43ms2860 KiB
8Accepted4/43ms2900 KiB
9Accepted4/43ms2956 KiB
10Accepted4/43ms3092 KiB
11Accepted4/43ms2980 KiB
12Accepted4/43ms3104 KiB
13Accepted4/44ms3272 KiB
14Accepted4/44ms3156 KiB
15Accepted4/46ms3512 KiB
16Accepted4/46ms3756 KiB
17Accepted4/413ms4220 KiB
18Accepted4/419ms5128 KiB
19Accepted4/426ms5320 KiB
20Accepted4/427ms5788 KiB
21Accepted4/432ms6352 KiB
22Accepted4/423ms6664 KiB