Submission #778066

# Submission time Handle Problem Language Result Execution time Memory
778066 2023-07-10T05:48:24 Z vjudge1 Preokret (COCI18_preokret) C++17
50 / 50
1 ms 416 KB
#include<bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
#define ll long long
#define pb push_back
#define N 100005
#define f first
#define s second
#define M 4*12*60

int main(){
	lalala;
	int n;cin>>n;
	vector<int> v;
	int arr[M+1],brr[M+1], turn[M+1];

	for(int i=0;i<n;i++){
		int a;cin>>a;
		arr[a]++;
		v.pb(a);
	}
	cin>>n;
	for(int i=0;i<n;i++){
		int a;cin>>a;
		brr[a]++;
		v.pb(a);
	}
	int kucuk=0,toplam=0;	
	for(int i=1;i<=M;i++){
		arr[i]+=arr[i-1];
		brr[i]+=brr[i-1];
		turn[i]=0;
		if(kucuk==1&&arr[i]>brr[i]){
			turn[i]=1;
			kucuk=2;
		}
		else if(kucuk==2&&arr[i]<brr[i]){
			turn[i]=2;
			kucuk=1;
		}
		else{
			if(arr[i]>brr[i])kucuk=2;
			if(brr[i]>arr[i])kucuk=1;
		}
		if(i==M/2){
			toplam=arr[i]+brr[i];
		}

	}
	sort(v.begin(),v.end());
	cout<<toplam<<endl;
	int cev=0;
	for(auto u:v){
		if(turn[u])cev++;
	}
	cout<<cev<<endl;

}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 356 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 416 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct