Submission #1326052

#TimeUsernameProblemLanguageResultExecution timeMemory
1326052lopkusMatryoshka (JOI16_matryoshka)C++20
0 / 100
1 ms332 KiB
#include <bits/stdc++.h>+ signed main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n, q; std::cin >> n >> q; std::vector<int> r(n + 1), h(n + 1); for(int i = 1; i <= n; i++) { std::cin >> r[i] >> h[i]; } std::vector<int> active; while(q--) { int a, b; std::cin >> a >> b; for(int i = 1; i <= n; i++) { if(r[i] >= a && h[i] <= b) { active.push_back(i); } } int ans = 0; for(int i = 0; i < active.size(); i++) { int ok = 0; for(int j = 0; j < active.size(); j++) { if(i == j) { continue; } if(r[active[j]] > r[active[i]] && h[active[j]] > h[active[i]]) { ok = 1; break; } } if(ok == 0) { ans += 1; } } std::cout << ans << "\n"; active.clear(); } }

Compilation message (stderr)

matryoshka.cpp:1:25: warning: extra tokens at end of #include directive
    1 | #include <bits/stdc++.h>+
      |                         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...