Submission #778066

#TimeUsernameProblemLanguageResultExecution timeMemory
778066vjudge1Preokret (COCI18_preokret)C++17
50 / 50
1 ms416 KiB
#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 timeMemoryGrader output
Fetching results...