제출 #842145

#제출 시각아이디문제언어결과실행 시간메모리
842145SUNWOOOOOOOOJail (JOI22_jail)C++17
0 / 100
1 ms3932 KiB
#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;
}

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...