Submission #890285

# Submission time Handle Problem Language Result Execution time Memory
890285 2023-12-21T00:15:27 Z pcc Preokret (COCI18_preokret) C++14
50 / 50
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>


vector<pii> v;

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n;
	cin>>n;
	for(int i = 0;i<n;i++){
		int k;
		cin>>k;
		v.push_back({k,1});
	}
	cin>>n;
	for(int i = 0;i<n;i++){
		int k;
		cin>>k;
		v.push_back({k,2});
	}
	int ans1 = 0,ans2 = 0;
	sort(v.begin(),v.end());
	int s = 0;
	int pre = 0;
	for(auto &i:v){
		if(i.fs<=2*12*60)ans1++;
		if(i.sc == 1)s--;
		else s++;
		if(pre == 0)pre = s;
		if(s*pre<0){
			ans2++;
			pre = s;
		}
	}
	cout<<ans1<<'\n'<<ans2;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 344 KB Output is correct