51172023-04-18 02:38:35tomi7Rendező robot (80 pont)cpp11Wrong answer 3/8071ms6240 KiB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin>>n;
	vector<int> a(n);
	int valasz1=0, valasz2=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(a[i]==i+1 && a[i]>n/2){
			valasz2++;
		}else if(a[i]==i+1 && a[i]<n/2) valasz1++;
		else if(a[i]==i+1 && a[i]==n/2){
			if(valasz1<=valasz2) valasz1++;
			else valasz2++; 
		}
	}
	if(valasz1>=valasz2){
		cout<<valasz1*2-1<<'\n';
	}else{
		cout<<valasz2*2<<'\n';
	}
}
SubtaskSumTestVerdictTimeMemory
base3/80
1Wrong answer0/03ms1808 KiB
2Wrong answer0/03ms1900 KiB
3Wrong answer0/22ms2104 KiB
4Accepted3/33ms2320 KiB
5Wrong answer0/33ms2532 KiB
6Wrong answer0/23ms2752 KiB
7Wrong answer0/23ms2832 KiB
8Wrong answer0/23ms2940 KiB
9Wrong answer0/23ms3072 KiB
10Wrong answer0/23ms3276 KiB
11Wrong answer0/23ms3364 KiB
12Wrong answer0/23ms3360 KiB
13Wrong answer0/23ms3252 KiB
14Wrong answer0/23ms3256 KiB
15Wrong answer0/23ms3364 KiB
16Wrong answer0/23ms3256 KiB
17Wrong answer0/23ms3492 KiB
18Wrong answer0/468ms4940 KiB
19Wrong answer0/468ms5024 KiB
20Wrong answer0/471ms5028 KiB
21Wrong answer0/468ms5112 KiB
22Wrong answer0/468ms5240 KiB
23Wrong answer0/471ms5364 KiB
24Wrong answer0/468ms5576 KiB
25Wrong answer0/468ms5660 KiB
26Wrong answer0/470ms5880 KiB
27Wrong answer0/468ms6240 KiB
28Wrong answer0/468ms6128 KiB
29Wrong answer0/468ms6132 KiB