Submission #103117

#TimeUsernameProblemLanguageResultExecution timeMemory
103117E869120New Home (APIO18_new_home)C++14
5 / 100
5062 ms13784 KiB
#include <iostream> #include <cmath> #include <algorithm> using namespace std; #pragma warning (disable: 4996) int N, K, Q, X[1 << 19], T[1 << 19], A[1 << 19], B[1 << 19], score[1 << 19]; int 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]); } for (int i = 1; i <= Q; i++) { int L, Y; scanf("%d%d", &L, &Y); for (int j = 1; j <= K; j++) score[j] = (1 << 30); for (int j = 1; j <= N; j++) { if (!(A[j] <= Y && Y <= B[j])) continue; score[T[j]] = min(score[T[j]], abs(L - X[j])); } int maxn = 0; for (int j = 1; j <= K; j++) maxn = max(maxn, score[j]); if (maxn == (1 << 30)) maxn = -1; printf("%d\n", maxn); } return 0; }

Compilation message (stderr)

new_home.cpp:5:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
 #pragma warning (disable: 4996)
 
new_home.cpp: In function 'int main()':
new_home.cpp:10: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:12: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:15:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int L, Y; 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...