제출 #207487

#제출 시각아이디문제언어결과실행 시간메모리
207487mohamedsobhi777학교 설립 (IZhO13_school)C++14
0 / 100
143 ms262148 KiB
#include<bits/stdc++.h> using namespace std ; const int N = 3e5 + 7 ; int n , m , k ; int a[N] , b[N] ; long long dp[500][500][500]; long long solve(int i , int M , int K) { if(i==n) { return (!M && !K?0 : -1e14); } if(dp[i][M][K]!=-1) return dp[i][M][K]; long long ret = solve(i+1 , M , K) ; ret = max(ret , a[i] + solve(i+1 , M-1 , K) ) ; ret = max(ret , solve(i+1 , M , K-1) + b[i] ) ; return dp[i][M][K] = ret ; } int main() { memset(dp , -1 , sizeof dp) ; freopen("school.in" , "r" , stdin) ; freopen("school.out" , "w" , stdout) ; cin>>n>>m>>k ; for(int i= 0 ; i < n ; i++) cin>>a[i]>>b[i]; cout<<solve(0, m , k) ; return 0 ; }

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

school.cpp: In function 'int main()':
school.cpp:30:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("school.in" , "r" , stdin) ; 
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
school.cpp:31:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("school.out" , "w" , stdout) ; 
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...