1)
#include <iostream>
#include <vector>
using namespace std;
int main(){
srand(time(NULL));
int n;
cin >> n;
vector<int> a(n);
for(auto &i : a)
i = rand() % 1001 - 500;
pair<int,int> k1,k2;
k1 = k2 = {-1e9,-1};
for(int i = 0; i < n; i++){
if(a[i] > k1.first){
k2 = k1;
k1 = {a[i],i+1};
}
else if(a[i] > k2.first)
k2 = {a[i],i+1};
cout << k1.second << " " << k2.second;
2)
cin >> i;
int cnt = 1, mx = a[0];
for(int i = 1; i < n; i++){
if(a[i] == mx)
cnt++;
else if(a[i] > mx){
cnt = 1;
mx = a[i];
cout << cnt;
1)
#include <iostream>
#include <vector>
using namespace std;
int main(){
srand(time(NULL));
int n;
cin >> n;
vector<int> a(n);
for(auto &i : a)
i = rand() % 1001 - 500;
pair<int,int> k1,k2;
k1 = k2 = {-1e9,-1};
for(int i = 0; i < n; i++){
if(a[i] > k1.first){
k2 = k1;
k1 = {a[i],i+1};
}
else if(a[i] > k2.first)
k2 = {a[i],i+1};
}
cout << k1.second << " " << k2.second;
}
2)
#include <iostream>
#include <vector>
using namespace std;
int main(){
int n;
cin >> n;
vector<int> a(n);
for(auto &i : a)
cin >> i;
int cnt = 1, mx = a[0];
for(int i = 1; i < n; i++){
if(a[i] == mx)
cnt++;
else if(a[i] > mx){
cnt = 1;
mx = a[i];
}
}
cout << cnt;
}