41902023-03-16 04:07:06tomi7Programtermék verseny (70 pont)cpp11Wrong answer 3/7037ms5648 KiB
// Source: https://usaco.guide/general/io

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

long long lko(long long n, long long m){
	if(n%m==0 || m%n==0){
		return min(n, m);
	}
	if(n>m){
		return lko(n%m, m);
	}else{
		return lko(m%n, n);
	}
}

int main() {
	int n, k;
	cin>>n>>k;
	vector<int> a(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	int bronz=n/2;
	int ezust=n/4;
	int arany=n/12;
	int versenyzok=0;
	bool b=true;
	bool x=true;
	bool z=true;
	for(int i=0;i<n;i++){
		if(a[i]>a[k-1]){
			versenyzok++;
		}
		if(versenyzok==arany && i-1>k && b){
			cout<<i-1<<'\n';
			b=false;
		}else if(versenyzok==arany && i<k && b){
			cout<<0<<'\n';
			b=false;
		}
		if(versenyzok==ezust && i-1>k && x){
			cout<<i-1<<'\n';
			x=false;
		}else if(versenyzok==ezust && i<k && x){
			cout<<0<<'\n';
			x=false;
		}if(versenyzok==bronz && i-1>k && z){
			cout<<i-1<<'\n';
			z=false;
			return 0;
		}else if(versenyzok==bronz && i<k && z){
			cout<<0<<'\n';
			z=false;
			return 0;
		}
	}
	if(b){
		cout<<n<<'\n';
	}
	if(x){
		cout<<n<<'\n';
	}
	if(z){
		cout<<n<<'\n';
	}
}
SubtaskSumTestVerdictTimeMemory
base3/70
1Wrong answer0/03ms1812 KiB
2Wrong answer0/03ms2008 KiB
3Wrong answer0/037ms2924 KiB
4Wrong answer0/33ms2428 KiB
5Wrong answer0/33ms2512 KiB
6Wrong answer0/33ms2640 KiB
7Accepted3/33ms2884 KiB
8Wrong answer0/33ms3000 KiB
9Wrong answer0/33ms3216 KiB
10Wrong answer0/33ms3272 KiB
11Wrong answer0/33ms3500 KiB
12Wrong answer0/33ms3700 KiB
13Wrong answer0/33ms3788 KiB
14Wrong answer0/44ms3796 KiB
15Wrong answer0/419ms4228 KiB
16Wrong answer0/423ms4448 KiB
17Wrong answer0/427ms4696 KiB
18Wrong answer0/46ms4432 KiB
19Wrong answer0/48ms4728 KiB
20Wrong answer0/412ms4980 KiB
21Wrong answer0/437ms5420 KiB
22Wrong answer0/437ms5648 KiB
23Wrong answer0/432ms5484 KiB