// NK
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
typedef pair<int,int> ii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ll> vll;
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define psf push_front
#define pof pop_front
#define mkp make_pair
#define mkt make_tuple
#define all(x) x.begin(), x.end()
#define Bolivia_is_nice ios::sync_with_stdio(false), cin.tie(nullptr)
//typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> ord_set;
void solve(){
int tot = 4*12 * 60;
int mid = tot/2;
int n; cin >> n;
map<int,int> data;
for (int i=0; i<n; ++i){
int x; cin >> x;
data[x] = 1;
}
cin >> n;
for (int i=0; i<n; ++i){
int x; cin >> x;
data[x] = 2;
}
int ans = 0, ho = 0;
int a=0,b=0;
int la = 0, lb = 0;
while(!data.empty()){
auto beg = data.begin();
int curr = beg->second;
while(!data.empty() && curr == data.begin()->second){
if (data.begin()->first <= mid) ans++;
if (curr == 1) a++;
else b++;
data.erase(data.begin());
}
if (la < b && b < a) ho++;
if (lb < a && a < b) ho++;
la = a;
lb = b;
}
cout << ans << '\n' << ho << '\n';
}
int main(){
Bolivia_is_nice;
int t = 1; //cin>>t;
while(t--)
solve();
return 0;
}
/*
~/.emacs
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
492 KB |
Output is correct |
10 |
Correct |
0 ms |
364 KB |
Output is correct |