답안 #701713

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
701713 2023-02-22T02:12:38 Z alanl Preokret (COCI18_preokret) C++14
50 / 50
1 ms 340 KB
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define s second
#define rep(X, a,b) for(int X=a;X<b;++X)
#define ALL(a) (a).begin(), (a).end()
#define SZ(a) (int)(a).size()
#define NL "\n"
using namespace std;
typedef pair<long long,long long> pll;
typedef pair<int,int> pii;
typedef long long ll;
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << "," << p.second << ')'; }
template<typename A> ostream& operator<<(ostream &os, const vector<A> &p){
	for(const auto &a:p)
		os << a << " ";
	os << "\n";
	return os;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int a;
	cin>>a;
	vector<pii> save;
	rep(i,0,a){
		int x;
		cin>>x;
		save.pb({x, 0});
	}
	cin>>a;
	rep(i,0,a){
		int x;
		cin>>x;
		save.pb({x, 1});
	}
	sort(ALL(save));
	int pt[2]={0, 0};
	pt[save[0].s]++;
	int turn=0, lose=1-save[0].s, half=0;
	for(auto x:save){
		if(x.f<=1440) half++;
		if(x==save[0]) continue;
		if(pt[x.s]==pt[1-x.s] && lose==x.s){
			turn++;
			lose=1-x.s;
		}
		pt[x.s]++;
	}
	cout<<half<<NL;
	cout<<turn<<NL;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 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 328 KB Output is correct
10 Correct 0 ms 212 KB Output is correct