Submission #158163

#TimeUsernameProblemLanguageResultExecution timeMemory
158163fedoseevtimofeyWorst Reporter 3 (JOI18_worst_reporter3)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const int K = 30; int L[K], R[K]; const int N = 5e5 + 7; int tm[N]; const ll Inf = 1e9 + 7; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.setf(ios::fixed); cout.precision(20); #ifdef LOCAL freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int n, q; cin >> n >> q; vector <int> d(n + 1); for (int i = 1; i <= n; ++i) cin >> d[i]; d[0] = 1; ++n; int m; { vector <pair <int, int>> seg; int lst = 0; for (int i = 1; i < n; ++i) { if (d[i] > d[lst]) { seg.push_back({lst, i - 1}); lst = i; } } seg.push_back({lst, n - 1}); for (int i = 0; i < min(K, (int)seg.size()); ++i) { L[i] = seg[i].first; R[i] = seg[i].second; } m = min(K, (int)seg.size()); tm[0] = 1; for (int i = 1; i < min(K, (int)seg.size()); ++i) { int a = L[i - 1]; int b = L[i]; ll t = (ll)tm[i - 1] * (d[b] + d[a] - 1) / d[a]; t = min(t, Inf); tm[i] = t; } } while (q--) { int t, l, r; cin >> t >> l >> r; int ans = 0; for (int i = 0; i < m; ++i) { int cnt = t / tm[i]; ll pl = -L[i], pr = -R[i]; pl += (ll)cnt * d[L[i]]; pr += (ll)cnt * d[L[i]]; swap(pl, pr); pl = max(pl, (ll)l); pr = min(pr, (ll)r); ans += max(0LL, pr - pl + 1); } cout << ans << '\n'; } }

Compilation message (stderr)

worst_reporter3.cpp: In function 'int main()':
worst_reporter3.cpp:43:9: error: reference to 'tm' is ambiguous
         tm[0] = 1;
         ^~
worst_reporter3.cpp:11:5: note: candidates are: int tm [500007]
 int tm[N];
     ^~
In file included from /usr/include/c++/7/ctime:42:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:49,
                 from worst_reporter3.cpp:1:
/usr/include/time.h:133:8: note:                 struct tm
 struct tm
        ^~
worst_reporter3.cpp:47:24: error: reference to 'tm' is ambiguous
             ll t = (ll)tm[i - 1] * (d[b] + d[a] - 1) / d[a];
                        ^~
worst_reporter3.cpp:11:5: note: candidates are: int tm [500007]
 int tm[N];
     ^~
In file included from /usr/include/c++/7/ctime:42:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:49,
                 from worst_reporter3.cpp:1:
/usr/include/time.h:133:8: note:                 struct tm
 struct tm
        ^~
worst_reporter3.cpp:49:13: error: reference to 'tm' is ambiguous
             tm[i] = t;
             ^~
worst_reporter3.cpp:11:5: note: candidates are: int tm [500007]
 int tm[N];
     ^~
In file included from /usr/include/c++/7/ctime:42:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:49,
                 from worst_reporter3.cpp:1:
/usr/include/time.h:133:8: note:                 struct tm
 struct tm
        ^~
worst_reporter3.cpp:57:27: error: reference to 'tm' is ambiguous
             int cnt = t / tm[i];
                           ^~
worst_reporter3.cpp:11:5: note: candidates are: int tm [500007]
 int tm[N];
     ^~
In file included from /usr/include/c++/7/ctime:42:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:49,
                 from worst_reporter3.cpp:1:
/usr/include/time.h:133:8: note:                 struct tm
 struct tm
        ^~