Submission #917995

#TimeUsernameProblemLanguageResultExecution timeMemory
917995waldiFinancial Report (JOI21_financial)C++17
0 / 100
4010 ms2648 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(j-ost > d) break; if(wej[j] <= wej[i]) ost = j; 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]){ printf("%d %d\n", i, j); 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; }

Compilation message (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...