Submission #833489

# Submission time Handle Problem Language Result Execution time Memory
833489 2023-08-22T06:10:38 Z vjudge1 Exam (eJOI20_exam) C++17
0 / 100
1000 ms 720 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int MX = 1e5 + 5;

int N;
int H[MX], T[MX], dp[MX];

int main() {
      cin.tie(0); ios_base::sync_with_stdio(0);

      cin >> N;
      for(int i = 1; i <= N; i++) cin >> H[i];
      for(int i = 1; i <= N; i++) cin >> T[i];

      for(int i = 1; i <= N; i++) {

            for(int j = i - 1; j >= 0; j--) {

                  int cnt = 0;
                  for(int k = j + 1; k <= N; k++) {
                        if(H[k] > H[i]) break;
                        if(T[k] == H[i]) cnt++;

                        if(k >= i)
                              dp[k] = max(dp[k], dp[j] + cnt);
                  }

                  if(H[j] > H[i]) break;
            }

      }

      // for(int i = 1; i <= N; i++) {
      //       cout << dp[i] << " ";
      // }
      // cout << '\n';
      
      cout << dp[N] << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Incorrect 0 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 340 KB Output is correct
2 Execution timed out 1087 ms 468 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 25 ms 340 KB Output is correct
2 Execution timed out 1038 ms 720 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Incorrect 0 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Incorrect 0 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -