Submission #953562

# Submission time Handle Problem Language Result Execution time Memory
953562 2024-03-26T08:03:33 Z nhatcao Event Hopping (BOI22_events) C++17
0 / 100
1500 ms 3604 KB
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int n;
  cin >> n;

  vector<int> start_time(n), end_time(n);
  for (int i = 0; i < n; i++) {
    cin >> start_time[i] >> end_time[i];
  }

  sort(start_time.begin(), start_time.end());

  vector<int> dp(n + 1);
  dp[0] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < i; j++) {
      if (end_time[j] < start_time[i]) {
        dp[i] = max(dp[i], dp[j] + 1);
      }
    }
  }

  cout << dp[n] << endl;

  return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1554 ms 3604 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -