Submission #722804

# Submission time Handle Problem Language Result Execution time Memory
722804 2023-04-12T22:42:31 Z vjudge1 Collecting Stamps 3 (JOI20_ho_t3) C++17
0 / 100
2000 ms 1912 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int dp[205][2005];
int v[205], te[205], p[205];
int n, len;

int dist(int a, int b){
    return min(abs(v[a] - v[b]), min(v[a], v[b]) + len - max(v[a], v[b]));
    if(v[a] == 0 || v[b] == 0) return max(v[a], v[b]);
}

int solve(int i, int t){
    ll ans;
    if(t <= te[i]) ans = 1;
    else ans = 0;

    int ma = 0;
    for(int j = 1; j<=n; j++){
        if(j == i || p[j] == 1) continue;
        p[j] = 1;
        ma = max(ma, solve(j, dist(j, i) + t));
        p[j] = 0;
    }
    return ans + ma;
}

int main(){
    memset(dp, -1, sizeof(dp));
    cin >> n >> len;
    for(int i = 1; i<=n; i++) cin >> v[i];
    for(int i = 1; i<=n; i++) cin >> te[i];
    v[0] = 0;
    te[0] = -1;

    cout << solve(0, 0) << endl;;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1876 KB Output is correct
2 Correct 1 ms 1876 KB Output is correct
3 Correct 30 ms 1912 KB Output is correct
4 Correct 2 ms 1908 KB Output is correct
5 Correct 2 ms 1796 KB Output is correct
6 Execution timed out 2075 ms 1876 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1876 KB Output is correct
2 Correct 1 ms 1876 KB Output is correct
3 Correct 30 ms 1912 KB Output is correct
4 Correct 2 ms 1908 KB Output is correct
5 Correct 2 ms 1796 KB Output is correct
6 Execution timed out 2075 ms 1876 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1876 KB Output is correct
2 Correct 1 ms 1876 KB Output is correct
3 Correct 30 ms 1912 KB Output is correct
4 Correct 2 ms 1908 KB Output is correct
5 Correct 2 ms 1796 KB Output is correct
6 Execution timed out 2075 ms 1876 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1876 KB Output is correct
2 Correct 1 ms 1876 KB Output is correct
3 Correct 30 ms 1912 KB Output is correct
4 Correct 2 ms 1908 KB Output is correct
5 Correct 2 ms 1796 KB Output is correct
6 Execution timed out 2075 ms 1876 KB Time limit exceeded
7 Halted 0 ms 0 KB -