41822023-03-15 22:42:38tomi7Programtermék verseny (70 pont)cpp11Wrong answer 27/7041ms4720 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;
		}
	}
}
SubtaskSumTestVerdictTimeMemory
base27/70
1Accepted0/03ms1812 KiB
2Wrong answer0/03ms2004 KiB
3Wrong answer0/037ms3236 KiB
4Wrong answer0/33ms2592 KiB
5Wrong answer0/33ms2668 KiB
6Wrong answer0/33ms2744 KiB
7Wrong answer0/33ms2752 KiB
8Wrong answer0/33ms2764 KiB
9Wrong answer0/33ms2840 KiB
10Wrong answer0/33ms2836 KiB
11Wrong answer0/33ms2840 KiB
12Accepted3/33ms2948 KiB
13Wrong answer0/34ms2976 KiB
14Wrong answer0/44ms3204 KiB
15Wrong answer0/419ms3460 KiB
16Accepted4/423ms3712 KiB
17Accepted4/426ms3928 KiB
18Wrong answer0/46ms3648 KiB
19Accepted4/48ms3808 KiB
20Wrong answer0/413ms4036 KiB
21Accepted4/437ms4592 KiB
22Accepted4/441ms4720 KiB
23Accepted4/432ms4672 KiB