이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,popcnt,sse4,abm")
#include <bits/stdc++.h>
using namespace std;
#ifdef WAIMAI
#define debug(HEHE...) cout << "[" << #HEHE << "] : ", dout(HEHE)
void dout() {cout << '\n';}
template<typename T, typename...U>
void dout(T t, U...u) {cout << t << (sizeof...(u) ? ", " : ""), dout(u...);}
#else
#define debug(...) 7122
#endif
#define ll long long
#define Waimai ios::sync_with_stdio(false), cin.tie(0)
#define FOR(x,a,b) for (int x = a, I = b; x <= I; x++)
#define pb emplace_back
#define F first
#define S second
const int SIZE = 12e4 + 5;
int n, m;
tuple<int, int, int> p[SIZE];
void solve() {
cin >> n;
FOR (i, 2, n) {
int a, b;
cin >> a >> b;
}
cin >> m;
FOR (i, 1, m) {
int l, r;
cin >> l >> r;
p[i] = {min(l, r), max(l, r), l > r};
}
sort(p + 1, p + m + 1);
int last = 0, t;
FOR (i, 1, m) {
auto [l, r, ty] = p[i];
if (r <= last) {
cout << "No\n";
return;
}
if (l <= last && ty != t) {
cout << "No\n";
return;
}
last = r;
t = ty;
}
cout << "Yes\n";
}
int main() {
Waimai;
int tt;
cin >> tt;
while (tt--) solve();
}
컴파일 시 표준 에러 (stderr) 메시지
jail.cpp: In function 'void solve()':
jail.cpp:47:23: warning: 't' may be used uninitialized in this function [-Wmaybe-uninitialized]
47 | if (l <= last && ty != t) {
| ~~~~~~~~~~^~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |