Submission #1011227

# Submission time Handle Problem Language Result Execution time Memory
1011227 2024-06-30T06:59:32 Z MilosMilutinovic MP3 Player (CEOI10_mp3player) C++14
10 / 100
1000 ms 1496 KB
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, trg;
  cin >> n >> m >> trg;
  vector<char> op(n);
  vector<int> val(n);
  for (int i = 0; i < n; i++) {
    cin >> op[i] >> val[i];
  }
  const int inf = (int) 1e9;
  vector<int> qt(1, -1);
  qt.push_back(val[0]);
  qt.push_back(inf);
  for (int i = 1; i < n; i++) {
    qt.push_back(val[i] - val[i - 1]);
  }
  pair<int, int> res = {-1, -1};
  for (int t : qt) {
    for (int v1 = 0; v1 <= m; v1++) {
      int v2 = v1;
      for (int i = 1; i < n; i++) {
        int d = val[i] - val[i - 1];
        if (d <= t) {
          if (op[i] == '+') {
            v2 = min(v2 + 1, m);
          } else {
            v2 = max(v2 - 1, 0);
          }
        }
      }
      if (v2 == trg) {
        res = max(res, {t, v1});
      }
    }
  }
  if (res.first == inf) {
    cout << "infinity" << '\n';
  } else {
    cout << res.first << " " << res.second << '\n';
  }
  return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 745 ms 484 KB Output is correct
2 Correct 767 ms 596 KB Output is correct
3 Incorrect 40 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 518 ms 456 KB Output is correct
2 Correct 481 ms 344 KB Output is correct
3 Correct 568 ms 480 KB Output is correct
4 Correct 10 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1071 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1046 ms 604 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1071 ms 604 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1100 ms 856 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1026 ms 980 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1004 ms 1492 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1038 ms 1496 KB Time limit exceeded
2 Halted 0 ms 0 KB -