Submission #1172878

#TimeUsernameProblemLanguageResultExecution timeMemory
1172878lopkusTwo Antennas (JOI19_antennas)C++20
2 / 100
3095 ms4420 KiB
#include <bits/stdc++.h>+ signed main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; std::cin >> n; std::vector<int64_t> h(n + 1), a(n + 1), b(n + 1); for(int i = 1; i <= n; i++) { std::cin >> h[i] >> a[i] >> b[i]; } int q; std::cin >> q; while(q--) { int l, r; std::cin >> l >> r; int64_t ans = - 1; for(int x = l; x <= r; x++) { for(int y = x + 1; y <= r; y++) { if(y - x >= a[x] && y - x <= b[x] && y - x >= a[y] && y - x <= b[y]) { ans = std::max(ans, std::abs(h[x] - h[y])); } } } std::cout << ans << "\n"; } }

Compilation message (stderr)

antennas.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...