Submission #800787

#TimeUsernameProblemLanguageResultExecution timeMemory
800787biankMeetings (IOI18_meetings)C++14
19 / 100
5542 ms756828 KiB
#include "meetings.h" #include <bits/stdc++.h> using namespace std; #define SIZE(x) (int)x.size() #define ll long long const ll INF = 1e16; vector<ll> minimum_costs(vector<int> H, vector<int> L, vector<int> R) { int Q = SIZE(L); int N = SIZE(H); vector <vector <int>> c(N, vector <int> (N, INF)); vector <vector <ll>> p(N, vector <ll> (N+1)); for (int i=0; i<N; i++) { c[i][i] = H[i]; p[i][0] = 0; for (int j=i-1; j>=0; j--) { c[i][j] = max(c[i][j+1], H[j]); } for (int j=i+1; j<N; j++) { c[i][j] = max(c[i][j-1], H[j]); } for (int j=0; j<N; j++) { p[i][j+1] = p[i][j] + c[i][j]; //cerr << c[i][j] << ' '; } //cerr << endl; } //cerr << "============" << endl; for (int i=0; i<N; i++) { for (int j=0; j<N+1; j++) { //cerr << p[i][j] << ' '; } //cerr << endl; } vector <ll> s(Q); for (int i=0; i<Q; i++) { s[i] = INF; for (int j=0; j<N; j++) { s[i] = min(s[i], p[j][R[i]+1] - p[j][L[i]]); } } return s; }

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:15:47: warning: overflow in conversion from 'long long int' to 'std::vector<int>::value_type' {aka 'int'} changes value from '10000000000000000' to '1874919424' [-Woverflow]
   15 |   vector <vector <int>> c(N, vector <int> (N, INF));
      |                                               ^~~
#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...