Submission #9298

#TimeUsernameProblemLanguageResultExecution timeMemory
9298httraceN-orthotope (kriii2_N)C++98
4 / 4
0 ms1672 KiB
#include <iostream> using namespace std; int main(){ int N; int s1[11], e1[11], s2[11], e2[11]; int i; int flag[11]; int check = 0; int result = 0; cin >> N; for (i = 0; i < N; i++){ cin >> s1[i] >> e1[i]; } for (i = 0; i < N; i++){ cin >> s2[i] >> e2[i]; } for (i = 0; i < N; i++){ if (e1[i] < s2[i]){ flag[i] = 0; check = 1; } else if (e1[i] == s2[i]){ flag[i] = 1; result += flag[i]; } else{ if (s2[i] >= s1[i]){ flag[i] = 2; result += flag[i]; } else{ if (s1[i] > e2[i]){ flag[i] = 0; check = 1; } else if (s1[i] == e2[i]){ flag[i] = 1; result += flag[i]; } else{ flag[i] = 2; result += flag[i]; } } } } if (check == 1) cout << -1; else cout << result - N; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...