Submission #842761

# Submission time Handle Problem Language Result Execution time Memory
842761 2023-09-03T11:07:51 Z SUNWOOOOOOOO Jail (JOI22_jail) C++17
0 / 100
1 ms 344 KB
#include <bits/stdc++.h>
using namespace std;
using pint = array <int, 2>;
const int mxN = 120005;
vector <int> ans;
vector <pint> v1, v2;
int n, m;

int solve()
{
    sort(v1.begin(), v1.end());
    sort(v2.begin(), v2.end());
    for (int i = 0; i < m; i++) {
        if (v1[i][1] != v2[i][1]) return 0;
    }
    return 1;
}

int main()
{
    int q;
    scanf("%d", &q);
    while (q--) {
        scanf("%d", &n);
        for (int i = 0, a, b; i < n - 1; i++) scanf("%d %d", &a, &b);
        scanf("%d", &m);
        v1.clear(); v2.clear();
        for (int i = 0, s, t; i < m; i++) {
            scanf("%d %d", &s, &t);
            v1.push_back({s, i});
            v2.push_back({t, i});
        }
        ans.push_back(solve());
    }

    for (int elm : ans) {
        if (elm) printf("YES\n");
        else printf("NO\n");
    }

    return 0;
}

Compilation message

jail.cpp: In function 'int main()':
jail.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |     scanf("%d", &q);
      |     ~~~~~^~~~~~~~~~
jail.cpp:24:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |         scanf("%d", &n);
      |         ~~~~~^~~~~~~~~~
jail.cpp:25:52: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |         for (int i = 0, a, b; i < n - 1; i++) scanf("%d %d", &a, &b);
      |                                               ~~~~~^~~~~~~~~~~~~~~~~
jail.cpp:26:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |         scanf("%d", &m);
      |         ~~~~~^~~~~~~~~~
jail.cpp:29:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |             scanf("%d %d", &s, &t);
      |             ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -