Submission #49022

#TimeUsernameProblemLanguageResultExecution timeMemory
49022BTheroNew Home (APIO18_new_home)C++17
5 / 100
5077 ms8052 KiB
// Why am I so stupid? :c #include <bits/stdc++.h> #define pb push_back #define mp make_pair #define all(x) (x).begin(), (x).end() #define fi first #define se second typedef long long ll; using namespace std; const int INF = 1e9; struct shop { int x, tp, l, r; shop() { x = tp = l = r = 0; } } arr[300005]; struct que { int x, t; que() { x = t = 0; } } req[300005]; int ans[300005]; int mn[300005]; int n, k, q; void solve() { scanf("%d %d %d", &n, &k, &q); for (int i = 1; i <= n; ++i) { scanf("%d %d", &arr[i].x, &arr[i].tp); scanf("%d %d", &arr[i].l, &arr[i].r); } for (int i = 1; i <= q; ++i) { scanf("%d %d", &req[i].x, &req[i].t); } for (int i = 1; i <= q; ++i) { for (int j = 1; j <= k; ++j) { mn[j] = INF; } for (int j = 1; j <= n; ++j) { if (arr[j].l <= req[i].t && req[i].t <= arr[j].r) { mn[arr[j].tp] = min(mn[arr[j].tp], abs(req[i].x - arr[j].x)); } } for (int j = 1; j <= k; ++j) { ans[i] = max(ans[i], mn[j]); } } for (int i = 1; i <= q; ++i) { if (ans[i] == INF) { ans[i] = -1; } printf("%d\n", ans[i]); } } int main() { #ifdef BThero freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif // BThero int tt = 1; while (tt--) { solve(); } return 0; }

Compilation message (stderr)

new_home.cpp: In function 'void solve()':
new_home.cpp:41:10: 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:44:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &arr[i].x, &arr[i].tp);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
new_home.cpp:45:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &arr[i].l, &arr[i].r);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
new_home.cpp:49:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &req[i].x, &req[i].t);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...