이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// 제2회 kriiICPC
// 
// 
#include <iostream>
#include <vector>
using namespace std;
int main(){
	int case_num;
	cin >> case_num;
	int A[12][2];
	int B[12][2];
	int orthotope[12]; //안겹칠 경우 -1, 한점에서 만나는경우 0, 선이 겹치는 경우 1
	
	//input
	for (int nc = 0; nc < case_num; nc++){
		orthotope[nc] = -1;
	
		for (int n = 0; n < 2; n++){
			cin >> A[nc][n];	
		}
	}
	for (int nc = 0; nc < case_num; nc++){
		for (int n = 0; n < 2; n++){
			cin >> B[nc][n];
		}
	}
	
	//
	
	for (int i = 0; i < case_num; i++){
		if (A[i][0] > B[i][1] || A[i][1] < B[i][0]) {
			orthotope[i] = -1;
		}
		else{
			// 점으로 만난 경우
			if (A[i][1] == B[i][0] ||
				B[i][1] == A[i][0] )  orthotope[i] = 0; 
			else{
				orthotope[i] = 1;
				/*
				// 선분으로 만난 경우
				if (A[i][1] <= B[i][1] && B[i][0] <= A[i][1]
					) orthotope[i] = 1; //A[i][1]
				if (B[i][0] <= A[i][0] && A[i][0] <= B[i][1]
					) orthotope[i] = 1; // A[i][0]
				if (B[i][0] >= A[i][0] && B[i][0] <= A[i][1]
					) orthotope[i] = 1; // B[i][0]
				if (B[i][1] <= A[i][1] && B[i][1] >= A[i][0]
					) orthotope[i] = 1; // B[i][1]
					*/
			}
		}
	}
	int result = -1;
	int dot_count = 0;
	for (int i = 0; i < case_num; i++){
		if (orthotope[i] == -1){
			result = -1; break;
		}
		else if (orthotope[i] > 0){
			if (result == -1) result = 0;
			result++;
		}
		else if (orthotope[i] == 0) dot_count++;
	}
	
	if (result == -1 && dot_count == case_num) result = 0;
	cout << result << endl;
	
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |