Submission #9406

#TimeUsernameProblemLanguageResultExecution timeMemory
9406lhch6759N-orthotope (kriii2_N)C++98
0 / 4
0 ms1672 KiB
// 제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] = 0; 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][1] == B[i][1] || A[i][0] == B[i][0]) orthotope[i] = 0; //다른 선분 사이에 있을경우 if (A[i][1] <= B[i][1] && B[i][0] <= A[i][1]) orthotope[i] ++; //A[i][1] if (B[i][0] <= A[i][0] && A[i][0] <= B[i][1]) orthotope[i] ++; // A[i][0] if (B[i][0] >= A[i][0] && B[i][0] <= A[i][1]) orthotope[i] ++; // B[i][0] if (B[i][1] <= A[i][1] && B[i][1] >= A[i][0]) orthotope[i] ++; // B[i][1] if (A[i][1] == B[i][0]) orthotope[i] = -2; //B[i][0] else if (B[i][1] == A[i][0]) orthotope[i] = -2; //A[i][0] if (orthotope[i] == 0) orthotope[i] = -1; if (orthotope[i] == -2) orthotope[i] = 0; } int result = -1; int dot_flag = 0; for (int i = 0; i < case_num; i++){ if (orthotope[i] >= 0){ if (result == -1) result = 0; result++; if (orthotope[i] > 0 ) dot_flag = 1; } } /* if (result == -1){ for (int i = 0; i < case_num; i++){ if (orthotope[i] == 0) result = 0; } } */ if (dot_flag == 0) cout << 0 << endl; else cout << result << endl; cout << result << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...