제출 #988987

#제출 시각아이디문제언어결과실행 시간메모리
988987parlimoosCloud Computing (CEOI18_clo)C++14
0 / 100
5 ms6748 KiB
//Be Name KHODA #pragma GCC optimize("Ofast") #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define pb push_back #define pp pop_back #define lb lower_bound #define ub upper_bound #define arr(x) array<ll , x> #define endl '\n' #define cl clear #define bg begin int n , m , sum; vector<int> ord; vector<arr(3)> a; ll dp[400][1000] , o; ll f(int i , int j){ if(dp[i][j] != -1) return dp[i][j]; if(i >= n + m or j >= sum) return 0; dp[i][j] = f(i + 1 , j); dp[i][j] = max(dp[i][j] , f(i , j + 1)); if(j + a[i][0] <= sum and ord[j] >= a[i][1]){ dp[i][j] = max(dp[i][j] , a[i][2] + f(i + 1 , j + a[i][0])); } return dp[i][j]; } int main(){ ios::sync_with_stdio(0); cin.tie(0); cin >> n; for(int i = 0 ; i < n ; i++){ int c , f , v; cin >> c >> f >> v; a.pb({c , f , v}) , o -= (1ll * v) , sum += c; for(int i = 0 ; i < c ; i++) ord.pb(f); } cin >> m; for(int i = 0 ; i < m ; i++){ int c , f , v; cin >> c >> f >> v; a.pb({c , f , v}); } fill(&dp[0][0] , &dp[3999][10000] , -1); sort(a.bg() , a.end() , [](arr(3) a , arr(3) b){ return (a[1] < b[1]); }); sort(ord.bg() , ord.end()); exit(0); cout << f(0 , 0) + o; }

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

clo.cpp: In function 'int main()':
clo.cpp:50:9: warning: array subscript 10000 is above array bounds of 'll [1000]' {aka 'long long int [1000]'} [-Warray-bounds]
   50 |     fill(&dp[0][0] , &dp[3999][10000] , -1);
      |     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...