56372023-08-30 18:43:44TomaSajtBejgli (80 pont)cpp17Accepted 80/8034ms5236 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n), cnts(n + 1);
  for (int& ai : a) cin >> ai;
  for (int i = 0; i < n; i += a[i]) cnts[a[i]]++;
  cout << accumulate(cnts.begin(), cnts.end(), 0) << '\n';
  cout << max_element(cnts.begin(), cnts.end()) - cnts.begin();
}
SubtaskSumTestVerdictTimeMemory
base80/80
1Accepted0/03ms1808 KiB
2Accepted0/03ms2056 KiB
3Accepted4/43ms2272 KiB
4Accepted4/43ms2456 KiB
5Accepted4/43ms2640 KiB
6Accepted4/43ms2892 KiB
7Accepted4/42ms2964 KiB
8Accepted4/43ms3064 KiB
9Accepted4/43ms3284 KiB
10Accepted4/43ms3396 KiB
11Accepted4/43ms3512 KiB
12Accepted4/43ms3520 KiB
13Accepted4/44ms3600 KiB
14Accepted4/44ms3628 KiB
15Accepted4/46ms3588 KiB
16Accepted4/46ms3800 KiB
17Accepted4/413ms4308 KiB
18Accepted4/420ms5176 KiB
19Accepted4/427ms5236 KiB
20Accepted4/428ms5140 KiB
21Accepted4/434ms5140 KiB
22Accepted4/423ms5144 KiB