제출 #944148

#제출 시각아이디문제언어결과실행 시간메모리
944148kxd모임들 (IOI18_meetings)C++17
0 / 100
5581 ms1628 KiB
#include "meetings.h" #include <bits/stdc++.h> //#define DEBUG 1106 //#define int long long #define ll long long #define ld long double #define pb push_back #define p_q priority_queue #define m_p make_pair #define pii pair<int,int> #define endl '\n' #define INIT ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define FOR(i,a,b) for(int i = a; i <= b; i++) #define forn(i,n) for (int i = 0; i < n; i++) #define forn1(i,n) for (int i = 1; i <= n; i++) #define all(x) x.begin(),x.end() #define ft first #define sd second #define lowbit(x) (x&(-x)) #define chmax(x,y) x=max(x,y) #define chmin(x,y) x=min(x,y) #ifdef DEBUG #define debug(x) cout << #x << ": " << x << endl; #else #define debug(x) 1106; #endif using namespace std; const int N = 2e5+5; const int inf = 1e9; const int INF = 1e18; const int MOD = 1e9+7; int a[N]; int mxl[N], mxr[N]; vector<ll> minimum_costs(vector<int> h, vector<int> l, vector<int> r) { int n = h.size(); int q = l.size(); vector<ll> c(q); for (int j = 0; j < q; ++j) { ll ans = INF; for(int i = l[j]; i <= r[j]; i++) { ll t = 0; int mx = h[i]; //cout << h[i] << '|'; for(int k = i; k >= l[j]; k--) { chmax(mx,h[k]); t += mx; //cout << '(' << k << ',' << mx << ')'; } mx = 0; for(int k = i+1; k <= r[j]; k++) { chmax(mx,h[k]); t += mx; //cout << '(' << k << ',' << mx << ')'; } chmin(ans,t); //cout << i << ',' << t << endl; } c[j]=ans; //cout << ans << endl; } return c; } /* namespace { int read_int() { int x; if (scanf("%d", &x) != 1) { fprintf(stderr, "Error while reading input\n"); exit(1); } return x; } } int main() { int N = read_int(); int Q = read_int(); std::vector<int> H(N); for (int i = 0; i < N; ++i) { H[i] = read_int(); } std::vector<int> L(Q), R(Q); for (int j = 0; j < Q; ++j) { L[j] = read_int(); R[j] = read_int(); } std::vector<long long> C = minimum_costs(H, L, R); for (size_t j = 0; j < C.size(); ++j) { printf("%lld\n", C[j]); } return 0; } */

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

meetings.cpp:31:17: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   31 | const int INF = 1e18;
      |                 ^~~~
meetings.cpp: In function 'std::vector<long long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)':
meetings.cpp:39:6: warning: unused variable 'n' [-Wunused-variable]
   39 |  int n = h.size();
      |      ^
#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...