QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#433037 | #8780. Training, Round 2 | Milan | WA | 32ms | 3632kb | C++23 | 1.4kb | 2024-06-07 22:47:23 | 2024-06-07 22:47:24 |
Judging History
answer
#include <bits/stdc++.h>
#define MULTI int _; cin >> _; while (_--)
#define fi first
#define se second
#define pb(a) push_back(a)
#define rep(i, n) for (int i = 0; i < n; i++)
#define reps(i, n, m) for (int i = n; i <= m; i++)
#define repsv(i, n, m) for (int i = n; i >= m; i--)
#define vsz(a) (int)(a.size())
#define mp(a, b) make_pair(a, b)
#define all(a) a.begin(), a.end()
using namespace std;
typedef pair<double, double> pdd;
typedef pair<int, int> pii;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
#ifdef LOCAL
#include "debugs.hpp"
#else
#define dbg(...) 0
#endif
#define NO INT_MIN
void solve(){
int n;
int ib, tb;
cin >> n >> ib >> tb;
vi dp(5005, NO);
dp[0] = 0;
rep(_i, n){
int i1, i2, t1, t2;
cin >> i1 >> i2 >> t1 >> t2;
i1 -= ib, i2 -= ib, t1 -= tb, t2 -= tb;
repsv(j, n, 0){
if(dp[j] != NO){
if(i1 <= j && i2 >= j && dp[j] >= t1 && dp[j] <= t2){
dp[j+1] = max(dp[j+1], dp[j]);
dp[j]++;
}
}
}
}
int res = 0;
reps(j, 1, n)
res = max(res, j + dp[j]);
cout << res << '\n';
}
int main(){
ios_base::sync_with_stdio(false); cin.tie(0);
// MULTI
solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3556kb
input:
3 0 0 0 1 0 1 1 1 0 1 1 1 1 1
output:
3
result:
ok single line: '3'
Test #2:
score: 0
Accepted
time: 32ms
memory: 3632kb
input:
5000 801577551 932138594 801577551 801577551 932138594 932138594 801577552 801577552 932138594 932138594 801577552 801577552 932138595 932138595 801577552 801577552 932138596 932138596 801577553 801577553 932138596 932138596 801577553 801577553 932138597 932138597 801577553 801577553 932138598 93213...
output:
5000
result:
ok single line: '5000'
Test #3:
score: 0
Accepted
time: 28ms
memory: 3632kb
input:
5000 932138594 801577551 932138594 932138594 801577551 801577551 932138594 932138594 801577552 801577552 932138595 932138595 801577552 801577552 932138596 932138596 801577552 801577552 932138596 932138596 801577553 801577553 932138597 932138597 801577553 801577553 932138598 932138598 801577553 80157...
output:
5000
result:
ok single line: '5000'
Test #4:
score: 0
Accepted
time: 31ms
memory: 3628kb
input:
5000 76836128 716580777 76836128 76836128 716580777 716580777 76836129 76836129 716580777 716580777 76836130 76836130 716580777 716580777 76836131 76836131 716580777 716580777 76836131 76836131 716580778 716580778 76836131 76836131 716580779 716580779 76836131 76836131 716580780 716580780 76836128 7...
output:
4994
result:
ok single line: '4994'
Test #5:
score: -100
Wrong Answer
time: 32ms
memory: 3628kb
input:
5000 716580777 76836128 716580777 716580777 76836128 76836128 716580777 716580777 76836129 76836129 716580777 716580777 76836130 76836130 716580777 716580777 76836131 76836131 716580778 716580778 76836131 76836131 716580779 716580779 76836131 76836131 716580780 716580780 76836131 76836131 716580778 ...
output:
7
result:
wrong answer 1st lines differ - expected: '4994', found: '7'