Submission #9655

#TimeUsernameProblemLanguageResultExecution timeMemory
9655effservN-orthotope (kriii2_N)C++98
4 / 4
0 ms1212 KiB
/* 문제 */ // 2014. #include <cstdio> #include <cmath> #include <algorithm> #include <vector> #include <queue> #include <functional> #include <cstring> #include <string> #include <map> using namespace std; int det[12]; vector <int> s[2], e[2]; int main() { int n,ans = 0; scanf("%d", &n); for (int i = 0; i < n; i++) { int x, y; scanf("%d%d", &x, &y); s[0].push_back(x); e[0].push_back(y); } bool det2 = false; for (int i = 0; i < n; i++) { int x, y; scanf("%d%d", &x, &y); if (s[0][i] > x) { if (e[0][i] > y) { det[i] = y - s[0][i]; } else { det[i] = e[0][i] - s[0][i]; } } else { if (e[0][i] > y) { det[i] = y - x; } else { det[i] = e[0][i] - x; } } if (det[i] < 0) { det2 = true; } } if (det2 == true) { printf("-1\n"); return 0; } for (int i = 0; i < n; i++) { if (det[i] > 0) ans++; } printf("%d\n", ans); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...