제출 #464449

#제출 시각아이디문제언어결과실행 시간메모리
464449pavementTwo Antennas (JOI19_antennas)C++17
13 / 100
3067 ms24280 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #ifdef _WIN32 #define getchar_unlocked _getchar_nolock #endif #define int long long #define mp make_pair #define mt make_tuple #define pb push_back #define ppb pop_back #define eb emplace_back #define g0(a) get<0>(a) #define g1(a) get<1>(a) #define g2(a) get<2>(a) #define g3(a) get<3>(a) mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); typedef double db; typedef long long ll; typedef long double ld; typedef pair<int, int> ii; typedef tuple<int, int, int> iii; typedef tuple<int, int, int, int> iiii; typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; int N, Q, H[200005], A[200005], B[200005], T[200005], out[200005]; bool act[200005]; vector<int> toact[200005], todeact[200005]; vector<ii> qu[200005]; main() { memset(T, -1, sizeof T); ios::sync_with_stdio(0); cin.tie(0); cin >> N; for (int i = 1; i <= N; i++) cin >> H[i] >> A[i] >> B[i]; cin >> Q; for (int i = 1, L, R; i <= Q; i++) { cin >> L >> R; qu[R].eb(L, i); } for (int i = 1; i <= N; i++) { for (auto j : toact[i]) act[j] = 1; for (auto j : todeact[i]) act[j] = 0; for (int j = max(1ll, i - B[i]); j <= i - A[i]; j++) if (act[j]) T[j] = max(T[j], llabs(H[i] - H[j])); for (auto u : qu[i]) { int ans = -1; for (int k = u.first; k <= i; k++) ans = max(ans, T[k]); out[u.second] = ans; } if (i + A[i] <= N) toact[i + A[i]].pb(i); if (i + B[i] + 1 <= N) todeact[i + B[i] + 1].pb(i); } for (int i = 1; i <= Q; i++) cout << out[i] << '\n'; }

컴파일 시 표준 에러 (stderr) 메시지

antennas.cpp:33:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   33 | main() {
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...