답안 #488774

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
488774 2021-11-20T12:14:58 Z Theo830 도로 폐쇄 (APIO21_roads) C++17
7 / 100
39 ms 6728 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e9+7;
const ll MOD = 998244353;
typedef pair<ll,ll> ii;
#define iii pair<ii,ll>
#define f(i,a,b) for(ll i = a;i < b;i++)
#define pb push_back
#define vll vector<ll>
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
///I hope I will get uprating and don't make mistakes
///I will never stop programming
///sqrt(-1) Love C++
///Please don't hack me
///@TheofanisOrfanou Theo830
///Think different approaches (bs,dp,greedy,graphs,shortest paths,mst)
///Stay Calm
///Look for special cases
///Beware of overflow and array bounds
///Think the problem backwards
///APIO 2021 vc
#include "roads.h"
std::vector<long long> minimum_closure_costs(int N, std::vector<int> U,std::vector<int> V,std::vector<int> W){
    vll ans;
    ll sum = 0;
    for(auto x:W){
        sum += x;
    }
    ll n = N;
    ans.pb(sum);
    ll dp[n] = {0};
    dp[1] = W[0];
    f(i,1,n-1){
        dp[i+1] = max(dp[i-1] + W[i],dp[i]);
    }
    ans.pb(sum - dp[n-1]);
    f(i,2,n){
        ans.pb(0);
    }
    return ans;
}



# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 332 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 32 ms 3956 KB Output is correct
3 Correct 37 ms 6372 KB Output is correct
4 Correct 39 ms 6728 KB Output is correct
5 Correct 39 ms 6704 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 0 ms 208 KB Output is correct
12 Correct 20 ms 3552 KB Output is correct
13 Correct 34 ms 5960 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 31 ms 5432 KB Output is correct
16 Correct 38 ms 5940 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 34 ms 4384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 34 ms 4384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 332 KB Output isn't correct
3 Halted 0 ms 0 KB -