제출 #286344

#제출 시각아이디문제언어결과실행 시간메모리
286344kartel모임들 (IOI18_meetings)C++14
19 / 100
701 ms574084 KiB
#include <bits/stdc++.h> //#include "grader.cpp" #include "meetings.h" //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> #define in(x) freopen(x, "r", stdin) #define out(x) freopen(x, "w", stdout) //#pragma GCC optimize("unroll-loops") //#pragma GCC optimize("-O3") //#pragma GCC optimize("Ofast") //#pragma GCC optimize("fast-math") //#pragma GCC optimize("no-stack-protector") #define F first #define S second #define pb push_back #define N +6005 //#define M ll(1e9 + 7) #define sz(x) (int)x.size() #define re return #define oo ll(1e9) #define el '\n' #define Max_A int(1e9) //#define el endl #define pii pair <int, int> #define piii pair <int, pair <int, int> > #define psi pair <string, int> #define err ld(1e-9) #define Max_S int(3e6) #define last(x) (x).back() #define all(x) (x).begin(), (x).end() #define allr(x) (x).rbegin(), (x).rend() #define arr_all(x, n) (x + 1), (x + 1 + n) #define vi vector<int> using namespace std; //using namespace __gnu_pbds; //typedef tree <int, null_type, less_equal <int> , rb_tree_tag, tree_order_statistics_node_update> ordered_set; typedef long long ll; typedef long double ld; ll pr[N][N], mx[N]; vector <ll> minimum_costs(vi h, vi l, vi r) { vector <ll> answers; int q = sz(l); int n = sz(h); for (int center = 0; center < n; center++) { int i = center; mx[i] = h[center]; while (i > 0) { i--; mx[i] = max(1ll * h[i], mx[i + 1]); } i = center; while (i < n - 1) { i++; mx[i] = max(1ll * h[i], mx[i - 1]); } pr[center][0] = mx[0]; for (int i = 1; i < n; i++) pr[center][i] = pr[center][i - 1] + mx[i]; } for (int i = 0; i < q; i++) { ll ans = 1e18; for (int center = l[i]; center <= r[i]; center++) ans = min(ans, pr[center][r[i]] - ((l[i]) ? pr[center][l[i] - 1] : 0)); answers.pb(ans); } return answers; } //int main() //{ // srand(time(0)); // cout.precision(3); // cout << fixed; // ios_base::sync_with_stdio(0); // iostream::sync_with_stdio(0); // ios::sync_with_stdio(0); // cin.tie(NULL); // cout.tie(NULL); // // //// in("input.txt"); //// out("output.txt"); // // //} /* 4 4 0110 0000 1101 1100 */
#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...