Submission #871133

#TimeUsernameProblemLanguageResultExecution timeMemory
871133NeroZeinNew Home (APIO18_new_home)C++17
0 / 100
5081 ms19516 KiB
#include "bits/stdc++.h" #define int long long using namespace std; #ifdef Nero #include "Deb.h" #else #define deb(...) #endif signed main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n, k, q; cin >> n >> k >> q; vector<bool> on(k); vector<long long> x(n), tp(n), l(n), r(n); for (int i = 0; i < n; ++i) { cin >> x[i] >> tp[i] >> l[i] >> r[i]; --tp[i]; } while (q--) { long long y, t; cin >> y >> t; long long ans = 0; vector<int> to_turn_off; for (int i = 0; i < n; ++i) { if (l[i] <= t && t <= r[i]) { ans = max(ans, abs(y - x[i])); if (!on[tp[i]]) { on[tp[i]] = true; to_turn_off.push_back(tp[i]); } } } if (to_turn_off.size() != k) { cout << -1 << '\n'; } else { cout << ans << '\n'; } for (int i : to_turn_off) { on[i] = false; } } return 0; }

Compilation message (stderr)

new_home.cpp: In function 'int main()':
new_home.cpp:36:28: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   36 |     if (to_turn_off.size() != k) {
      |         ~~~~~~~~~~~~~~~~~~~^~~~
#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...