답안 #722805

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
722805 2023-04-12T22:43:28 Z vjudge1 Collecting Stamps 3 (JOI20_ho_t3) C++17
0 / 100
2000 ms 296 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

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(){
    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;;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 25 ms 296 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Execution timed out 2067 ms 212 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 25 ms 296 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Execution timed out 2067 ms 212 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 25 ms 296 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Execution timed out 2067 ms 212 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 25 ms 296 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Execution timed out 2067 ms 212 KB Time limit exceeded
7 Halted 0 ms 0 KB -