제출 #1257778

#제출 시각아이디문제언어결과실행 시간메모리
1257778ilovewaguriFinancial Report (JOI21_financial)C++20
14 / 100
4094 ms2072 KiB
#include<bits/stdc++.h> using namespace std; #define NAME "" #define nl '\n' #define allof(x) x.begin(),x.end() #define allof1(x) x.begin()+1,x.end() #define allofa(x,sz) x,x+sz+1 #define mset(x,val) memset(x,val,sizeof(x)) #define couf(x) cout << fixed << setprecision(x) template<class X,class Y> bool minimize(X &a, Y b){if(a>b) {a=b;return true;}return false;}; template<class X,class Y> bool maximize(X &a, Y b){if(a<b) {a=b;return true;}return false;}; typedef long long ll; const ll mod = (long long)1e9+7; const int INF = (int)1e9; const int MAXN = (int)3e5+5; int a[MAXN],dp[MAXN]; int n,d; void ccps() { ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); if(fopen(NAME".inp","r")) { freopen(NAME".inp","r",stdin); freopen(NAME".out","w",stdout); } } signed main() { ccps(); cin >> n >> d; int res = 1; for (int i = 1; i<=n; i++) { cin >> a[i]; } for (int i = 1; i<=n; i++) { dp[i]=1; int cnt = 0; for (int j = i-1; j>0; j--) { if(a[i]<=a[j]) continue; int num = (i-j-1)/d; if(cnt>=num) maximize(dp[i],dp[j]+1); cnt+=(a[i]>a[j]); } maximize(res,dp[i]); } cout << res; }

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

Main.cpp: In function 'void ccps()':
Main.cpp:23:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |         freopen(NAME".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
Main.cpp:24:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |         freopen(NAME".out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#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...