Submission #842145

# Submission time Handle Problem Language Result Execution time Memory
842145 2023-09-02T12:45:03 Z SUNWOOOOOOOO Jail (JOI22_jail) C++17
0 / 100
1 ms 3932 KB
#include <bits/stdc++.h>
using namespace std;
using pint = array <int, 2>;
const int mxN = 120005;
vector <int> adj[mxN];
pint st[mxN];
int n, m;

void solve()
{
    sort(st + 1, st + m + 1);
    int ans = 1;
    for (int i = 1; i < m; i++){
        if (st[i][1] > st[i + 1][1]) ans = 0;
    }
    if (ans) printf("YES\n");
    else printf("NO\n");
}

int main()
{
    int q;
    scanf("%d", &q);
    while (q--) {
        scanf("%d", &n);
        for (int i = 1; i <= n; i++) adj[i].clear();
        for (int i = 0, a, b; i < n - 1; i++){
            scanf("%d %d", &a, &b);
            adj[a].push_back(b);
            adj[b].push_back(a);
        }
        scanf("%d", &m);
        for (int i = 1; i <= m; i++) {
            scanf("%d %d", &st[i][0], &st[i][1]);
        }
        solve();
    }

    return 0;
}

Compilation message

jail.cpp: In function 'int main()':
jail.cpp:23:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |     scanf("%d", &q);
      |     ~~~~~^~~~~~~~~~
jail.cpp:25:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |         scanf("%d", &n);
      |         ~~~~~^~~~~~~~~~
jail.cpp:28:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |             scanf("%d %d", &a, &b);
      |             ~~~~~^~~~~~~~~~~~~~~~~
jail.cpp:32:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |         scanf("%d", &m);
      |         ~~~~~^~~~~~~~~~
jail.cpp:34:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |             scanf("%d %d", &st[i][0], &st[i][1]);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 3932 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 3932 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 3932 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 3932 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 3932 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 3932 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 3932 KB Output isn't correct
2 Halted 0 ms 0 KB -