(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #1123709

#TimeUsernameProblemLanguageResultExecution timeMemory
1123709underwaterkillerwhaleMeetings (IOI18_meetings)C++20
19 / 100
5587 ms6088 KiB
#include <bits/stdc++.h> #define ll long long #define rep(i, m, n) for (int i = (m); i <= (n); i++) #define REB(i, m, n) for (int i = (m); i >= (n); i--) #define iter(v, id) for (auto v : id) #define pii pair<int, int> #define pll pair<ll, ll> #define MP make_pair #define fs first #define se second #define bit(msk, i) ((msk >> i) & 1) #define pb push_back #define SZ(v) (int)v.size() #define ALL(v) v.begin(), v.end() using namespace std; mt19937_64 rd(chrono::steady_clock::now().time_since_epoch().count()); ll Rand(ll l, ll r) { return uniform_int_distribution<ll>(l, r)(rd); } const int N = 2e5 + 7; const int Mod = 1e9 + 7; const ll INF = 1e18 + 7; const int BASE = 137; int n, Q; int a[N]; pii qr[N]; namespace sub2 { int suf[N], pre[N]; ll ssuf[N], spre[N]; vector<ll> solution() { vector<ll> Ans(Q + 3, INF); rep (i, 1, n) { suf[i] = pre[i] = ssuf[i] = spre[i] = a[i]; REB (j, i - 1, 1) suf[j] = max(suf[j + 1], a[j]), ssuf[j] = ssuf[j + 1] + suf[j]; rep (j, i + 1, n) pre[j] = max(pre[j - 1], a[j]), spre[j] = spre[j - 1] + pre[j]; rep (q, 1, Q) { if (qr[q].fs <= i && i <= qr[q].se) Ans[q] = min(Ans[q], ssuf[qr[q].fs] + spre[qr[q].se] - a[i]); } } // rep (i, 1, Q) { // cout << Ans[i] <<"\n"; // } return vector<ll> (Ans.begin() + 1, Ans.begin() + 1 + Q); } } vector<ll> minimum_costs (vector<int> H, vector<int> L, vector<int> R) { n = SZ(H); Q = SZ(L); rep (i, 1, n) a[i] = H[i - 1]; rep (i, 1, Q) qr[i].fs = L[i - 1] + 1, qr[i].se = R[i - 1] + 1; if (n <= 5000 && Q <= 5000) return sub2 :: solution(); // else if (sub3 :: check()) sub3 :: solution(); } void process() { cin >> n >> Q; rep (i, 1, n) cin >> a[i]; rep (i, 1, Q) { cin >> qr[i].fs >> qr[i].se; } if (n <= 5000 && Q <= 5000) sub2 :: solution(); // else if (sub3 :: check()) sub3 :: solution(); } //#define file(name) if(fopen(name".inp","r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); } //main () { //// file("c"); // ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); // int num_Test = 1; //// cin >> num_Test; // while (num_Test--) { // process(); // } //} /* onepunch +28 */

Compilation message (stderr)

meetings.cpp: In function 'std::vector<long long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)':
meetings.cpp:58:1: warning: control reaches end of non-void function [-Wreturn-type]
   58 | }
      | ^
#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...