Submission #596928

# Submission time Handle Problem Language Result Execution time Memory
596928 2022-07-15T09:26:26 Z ioi Collecting Stamps 3 (JOI20_ho_t3) C++14
15 / 100
67 ms 97148 KB
#include<bits/stdc++.h>

using namespace std;

#define debug(x) cout << '[' << #x << " is: " << x << "] " << endl;
#define inF freopen("cardgame.in" , "r" , stdin);
#define outF freopen("cardgame.out" , "w" , stdout);
#define imod(a , n) (a % n + n ) % n
#define sor(v) sort(v.begin() , v.end());
#define print(v) for(auto f : v ) cout << f << " " ;
#define rsor(v) sort(v.rbegin() , v.rend());
#define rev(v) reverse(v.begin() , v.end());
#define scan(v)for(auto &it : v)cin >> it ;
#define ll long long

#define logar(x , y) log(x) / log(y)
#define __sum(n) n * (n + 1) / 2
#define __lcm(a , b) a / __gcd(a , b) * b
#define pii pair<int , int >
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);

//#define int ll

const int N =  202 ,  M = N * 4  , MX = 2e4 + 40;
const ll MOD = 998244353  , oo = 1e9 + 9 , OO = 1e18 , mod = MOD ;
const double pi = acos(-1) , eps = 1e-17 ;

int di[] = {1 , -1 , 0 , 0};
int dj[] = {0 , 0 , 1 , -1};

int n , l ;
int x[N] , t[N];

int dp[N][N][N][3];

int calc(int i , int j , int tim , int now){

  //  cout << i << " " << j << " " << tim << " " << now << endl ;
    if(tim > 200)return 0 ;
    if(i > j)return 0 ;


    int &ret = dp[i][j][tim][now];
    if(~ret)
        return ret ;



    if(now == 0){

        ret = calc(i , j - 1 , tim + x[j + 1] - x[j] , 0) + (tim + x[j + 1] - x[j] <= t[j]);

        ret = max(ret , calc(i + 1 , j , tim + l - x[j + 1] + x[i] , 2) + (tim + l - x[j + 1] + x[i] <= t[i]));

    }
    else if(now == 1){

        ret = calc(i + 1 , j ,x[i] , 2) + (x[i] <= t[i]);
        ret = max(ret , calc(i , j - 1 , l - x[j] , 0) + (l - x[j] <= t[j]));


    }
    else {

        ret = calc(i + 1 , j , tim + x[i] - x[i - 1] , 2) + (tim + x[i] - x[i - 1] <= t[i]);
        ret = max(ret , calc(i , j - 1 , tim + x[i - 1] + l - x[j] , 0) + (tim + x[i - 1] + l - x[j] <= t[j]));

    }

    return ret ;


}


int32_t main()
{
    // inF;
   // inF;outF;
    fastio;

    //Welcome back without <TAWJIHI>


    cin >> n >> l ;

    memset(dp , -1 , sizeof dp);


    for(int i = 0 ; i < n ; i ++)cin >> x[i];

    for(int i = 0 ; i < n ; i ++)cin >> t[i];


    cout << calc(0 , n - 1 , 0 , 1);
}
# Verdict Execution time Memory Grader output
1 Correct 36 ms 97068 KB Output is correct
2 Correct 50 ms 97000 KB Output is correct
3 Correct 45 ms 96980 KB Output is correct
4 Correct 44 ms 97080 KB Output is correct
5 Correct 49 ms 97048 KB Output is correct
6 Correct 49 ms 96972 KB Output is correct
7 Correct 46 ms 97032 KB Output is correct
8 Correct 38 ms 96996 KB Output is correct
9 Correct 47 ms 97016 KB Output is correct
10 Correct 37 ms 96960 KB Output is correct
11 Correct 40 ms 97048 KB Output is correct
12 Correct 44 ms 97044 KB Output is correct
13 Correct 40 ms 97040 KB Output is correct
14 Correct 49 ms 96992 KB Output is correct
15 Correct 47 ms 97088 KB Output is correct
16 Correct 48 ms 96984 KB Output is correct
17 Correct 45 ms 97020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 97068 KB Output is correct
2 Correct 50 ms 97000 KB Output is correct
3 Correct 45 ms 96980 KB Output is correct
4 Correct 44 ms 97080 KB Output is correct
5 Correct 49 ms 97048 KB Output is correct
6 Correct 49 ms 96972 KB Output is correct
7 Correct 46 ms 97032 KB Output is correct
8 Correct 38 ms 96996 KB Output is correct
9 Correct 47 ms 97016 KB Output is correct
10 Correct 37 ms 96960 KB Output is correct
11 Correct 40 ms 97048 KB Output is correct
12 Correct 44 ms 97044 KB Output is correct
13 Correct 40 ms 97040 KB Output is correct
14 Correct 49 ms 96992 KB Output is correct
15 Correct 47 ms 97088 KB Output is correct
16 Correct 48 ms 96984 KB Output is correct
17 Correct 45 ms 97020 KB Output is correct
18 Incorrect 46 ms 97072 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 36 ms 97068 KB Output is correct
2 Correct 50 ms 97000 KB Output is correct
3 Correct 45 ms 96980 KB Output is correct
4 Correct 44 ms 97080 KB Output is correct
5 Correct 49 ms 97048 KB Output is correct
6 Correct 49 ms 96972 KB Output is correct
7 Correct 46 ms 97032 KB Output is correct
8 Correct 38 ms 96996 KB Output is correct
9 Correct 47 ms 97016 KB Output is correct
10 Correct 37 ms 96960 KB Output is correct
11 Correct 40 ms 97048 KB Output is correct
12 Correct 44 ms 97044 KB Output is correct
13 Correct 40 ms 97040 KB Output is correct
14 Correct 49 ms 96992 KB Output is correct
15 Correct 47 ms 97088 KB Output is correct
16 Correct 48 ms 96984 KB Output is correct
17 Correct 45 ms 97020 KB Output is correct
18 Correct 56 ms 97092 KB Output is correct
19 Correct 66 ms 97104 KB Output is correct
20 Correct 49 ms 97092 KB Output is correct
21 Correct 64 ms 97096 KB Output is correct
22 Correct 59 ms 97092 KB Output is correct
23 Correct 61 ms 97012 KB Output is correct
24 Correct 48 ms 97000 KB Output is correct
25 Correct 54 ms 96980 KB Output is correct
26 Correct 49 ms 97060 KB Output is correct
27 Correct 52 ms 96992 KB Output is correct
28 Correct 47 ms 97012 KB Output is correct
29 Correct 49 ms 97084 KB Output is correct
30 Correct 44 ms 97048 KB Output is correct
31 Correct 55 ms 97024 KB Output is correct
32 Correct 48 ms 97072 KB Output is correct
33 Correct 44 ms 97036 KB Output is correct
34 Correct 37 ms 97012 KB Output is correct
35 Correct 47 ms 96972 KB Output is correct
36 Correct 36 ms 97108 KB Output is correct
37 Correct 43 ms 97148 KB Output is correct
38 Correct 52 ms 97044 KB Output is correct
39 Correct 58 ms 97016 KB Output is correct
40 Correct 44 ms 96968 KB Output is correct
41 Correct 52 ms 97100 KB Output is correct
42 Correct 58 ms 97088 KB Output is correct
43 Correct 63 ms 96980 KB Output is correct
44 Correct 50 ms 97104 KB Output is correct
45 Correct 67 ms 97100 KB Output is correct
46 Correct 51 ms 97100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 97068 KB Output is correct
2 Correct 50 ms 97000 KB Output is correct
3 Correct 45 ms 96980 KB Output is correct
4 Correct 44 ms 97080 KB Output is correct
5 Correct 49 ms 97048 KB Output is correct
6 Correct 49 ms 96972 KB Output is correct
7 Correct 46 ms 97032 KB Output is correct
8 Correct 38 ms 96996 KB Output is correct
9 Correct 47 ms 97016 KB Output is correct
10 Correct 37 ms 96960 KB Output is correct
11 Correct 40 ms 97048 KB Output is correct
12 Correct 44 ms 97044 KB Output is correct
13 Correct 40 ms 97040 KB Output is correct
14 Correct 49 ms 96992 KB Output is correct
15 Correct 47 ms 97088 KB Output is correct
16 Correct 48 ms 96984 KB Output is correct
17 Correct 45 ms 97020 KB Output is correct
18 Incorrect 46 ms 97072 KB Output isn't correct
19 Halted 0 ms 0 KB -