Submission #169411

#TimeUsernameProblemLanguageResultExecution timeMemory
169411AngusRitossaNew Home (APIO18_new_home)C++14
5 / 100
5092 ms14036 KiB
#include <bits/stdc++.h> using namespace std; int n, k, q; int x[300010], t[300010], a[300010], b[300010]; int closestoftype[300010]; int main() { scanf("%d%d%d", &n, &k, &q); for (int i = 0; i < n; i++) { scanf("%d%d%d%d", &x[i], &t[i], &a[i], &b[i]); } for (int i = 0; i < q; i++) { int l, y; scanf("%d%d", &l, &y); fill_n(closestoftype, k+1, 1e9); for (int j = 0; j < n; j++) { if (a[j] <= y && y <= b[j]) { closestoftype[t[j]] = min(closestoftype[t[j]], abs(l-x[j])); } } int ans = 0; for (int i = 1; i <= k; i++) ans = max(ans, closestoftype[i]); if (ans == 1e9) printf("-1\n"); else printf("%d\n", ans); } }

Compilation message (stderr)

new_home.cpp: In function 'int main()':
new_home.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d", &n, &k, &q);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~
new_home.cpp:11:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d%d%d", &x[i], &t[i], &a[i], &b[i]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
new_home.cpp:16:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &l, &y);
   ~~~~~^~~~~~~~~~~~~~~~
#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...