Submission #59226

#TimeUsernameProblemLanguageResultExecution timeMemory
59226Just_Solve_The_ProblemNew Home (APIO18_new_home)C++11
5 / 100
5081 ms24780 KiB
#include <bits/stdc++.h> using namespace std; const int N = (int)3e5 + 7; int n, k, q; int x[N], t[N], a[N], b[N]; int mn[404]; main() { scanf("%d %d %d", &n, &k, &q); for (int i = 1; i <= n; i++) { scanf("%d %d %d %d", &x[i], &t[i], &a[i], &b[i]); } while (q--) { int l, y; scanf("%d %d", &l, &y); memset(mn, 63, sizeof mn); for (int i = 1; i <= n; i++) { if (a[i] <= y && y <= b[i]) { mn[t[i]] = min(mn[t[i]], abs(l - x[i])); } } int ans = -1; for (int i = 1; i <= k; i++) { if (mn[i] == mn[0]) { ans = -1; break; } if (ans == -1 || ans < mn[i]) { ans = mn[i]; } } printf("%d\n", ans); } }

Compilation message (stderr)

new_home.cpp:11:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
new_home.cpp: In function 'int main()':
new_home.cpp:12: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:14: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:18: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...