Submission #757263

# Submission time Handle Problem Language Result Execution time Memory
757263 2023-06-12T22:10:39 Z Seb Roller Coaster Railroad (IOI16_railroad) C++17
0 / 100
51 ms 7244 KB
#include "railroad.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const ll INF = 1e10;

ll ans = INF;

bool vis[16];
vector <int> v,S,T;

void checkeo() {
    ll aux=0;
    for (int i=1;i<8;i++) aux += max(T[v[i-1]]-S[v[i]],0);
    ans = min(ans,aux);
    return;
}

void bruta() {
    if (!v.empty() && v.size()==8) {
        checkeo();
        return;
    }
    for (int i=0;i<8;i++) if (vis[i]==false) {
        v.push_back(i);
        vis[i] = true;
        bruta();
        v.pop_back();
    }
    return;
}

long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
    int n = (int) s.size();
    swap(S,s);
    swap(T,t);
    bruta();
    return ans;
}

Compilation message

railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:37:9: warning: unused variable 'n' [-Wunused-variable]
   37 |     int n = (int) s.size();
      |         ^
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB answer is not correct: 737884319 instead of 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB answer is not correct: 737884319 instead of 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 51 ms 7244 KB answer is not correct: 1 instead of 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB answer is not correct: 737884319 instead of 0
2 Halted 0 ms 0 KB -