| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 86097 | ffrich | Preokret (COCI18_preokret) | C++14 | 3 ms | 596 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
using namespace std;
	vector < pair < int , int > > lebronzejames;
	
int main(){
	int ans1 = 0, ans2 = 0;
	int A; cin >> A;
	for(int i = 0; i < A; i++){
		int min; cin >> min;
		if(min <= 1440) ans1++;
		lebronzejames.push_back(make_pair(min,1));
	}
	int B; cin >> B;
	for(int i = 0; i < B; i++){
		int min; cin >> min;
		if(min <= 1440) ans1++;
		lebronzejames.push_back(make_pair(min,-1));
	} sort(lebronzejames.begin(),lebronzejames.end());
	
	int lastdiff = 0;
	int vodstvo = 0;
	for(int i = 0; i < A+B; i++){
		
		lastdiff += lebronzejames[i].second;
		if(lastdiff > 0 && vodstvo == -1){
			ans2++;
			vodstvo = 1;
		}
		else if(lastdiff < 0 && vodstvo == 1){
			ans2++;
			vodstvo = -1;
		}
		else if(lastdiff > 0 && vodstvo == 0) vodstvo = 1;
		else if(lastdiff < 0 && vodstvo == 0) vodstvo = -1;
		
	} cout << ans1 << endl << ans2;
return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
