Submission #842150

#TimeUsernameProblemLanguageResultExecution timeMemory
842150SUNWOOOOOOOOJail (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() { for (int i = 1; i <= m; i++) { if (st[i][0] > st[i][1]) swap(st[i][0], st[i][1]); } 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 (stderr)

jail.cpp: In function 'int main()':
jail.cpp:26:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |     scanf("%d", &q);
      |     ~~~~~^~~~~~~~~~
jail.cpp:28:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |         scanf("%d", &n);
      |         ~~~~~^~~~~~~~~~
jail.cpp:31:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |             scanf("%d %d", &a, &b);
      |             ~~~~~^~~~~~~~~~~~~~~~~
jail.cpp:35:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   35 |         scanf("%d", &m);
      |         ~~~~~^~~~~~~~~~
jail.cpp:37:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |             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...