제출 #917993

#제출 시각아이디문제언어결과실행 시간메모리
917993waldiFinancial Report (JOI21_financial)C++17
14 / 100
4050 ms5968 KiB
#include <bits/stdc++.h> #define FOR(i,p,k) for(int i=(p);i<=(k);++i) #define REP(i,n) FOR(i,0,(n)-1) #define ssize(x) (int(x.size())) #define all(x) (x).begin(),(x).end() using namespace std; int main(){ int n, d; scanf("%d%d", &n, &d); vector<int> wej(n+1); FOR(i, 1, n) scanf("%d", &wej[i]); vector<int> prawo(n+1); FOR(i, 1, n){ int ost = i; prawo[i] = i; FOR(j, i+1, n){ if(wej[j] <= wej[i]) ost = j; if(j-ost > d) break; prawo[i] = j; } } vector<int> dp(n+1, 0); FOR(i, 1, n){ ++dp[i]; FOR(j, i+1, prawo[i]) if(wej[j] > wej[i]) dp[j] = max(dp[j], dp[i]); } int wyn = 0; FOR(i, 1, n) if(prawo[i] == n) wyn = max(wyn, dp[i]); printf("%d", wyn); return 0; }

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

Main.cpp: In function 'int main()':
Main.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |  scanf("%d%d", &n, &d);
      |  ~~~~~^~~~~~~~~~~~~~~~
Main.cpp:12:20: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  FOR(i, 1, n) scanf("%d", &wej[i]);
      |               ~~~~~^~~~~~~~~~~~~~~
#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...