Submission #9520

#TimeUsernameProblemLanguageResultExecution timeMemory
9520jaehadadN-orthotope (kriii2_N)C++14
4 / 4
0 ms1676 KiB
#include<cstdio> #include<cassert> #include<cstring> #include<map> #include<set> #include<time.h> #include<algorithm> #include<stack> #include<queue> #include<utility> #include<cmath> #include<iostream> #include<string> #include<vector> using namespace std; int main() { int n; cin >> n; vector<int> s(n), e(n); for(int i = 0; i < n; ++i) cin >> s[i] >> e[i]; int neg = 0, pos = 0; for(int i = 0; i < n; ++i) { int si, ei; cin >> si >> ei; s[i] = max(si, s[i]); e[i] = min(ei, e[i]); if(e[i] - s[i] < 0) ++neg; if(e[i] - s[i] > 0) ++pos; } if(neg) cout << -1 << endl; else cout << pos << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...