답안 #1037333

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1037333 2024-07-28T14:08:45 Z RaresFelix Shortcut (IOI16_shortcut) C++17
0 / 100
0 ms 348 KB
#include "shortcut.h"
#include <bits/stdc++.h>

using namespace std;

using vi = vector<int>;
using ll = long long;
using vll = vector<ll>;
using ii = pair<int, int>;

const ll INF = 1e18;

bool ok(int n, vi l, vi d, ll L, int c) {
    vll sl(n, 0);
    for (int i = 1; i < sl.size(); ++i)
        sl[i] = sl[i - 1] + l[i - 1];
    for(int a = 0; a < n; ++a)
        for(int b = 0; b < n; ++b) {
            bool re = true;
            for(int i = 0; i < n; ++i) {
                for(int j = i; j < n; ++j) {
                    if(sl[j] - sl[i] + d[i] + d[j] <= L) continue;
                    re &= (abs(sl[i] - sl[a]) + abs(sl[j] - sl[b]) + c + d[i] + d[j]) <= L;
                }
            }
            if(re) return true;
        }
    return false;
}

ll find_shortcut(int n, vi l, vi d, int c) {
    ll st = 0, dr = INF, mij;

    while (st < dr) {
        mij = (st + dr) / 2;
        if (ok(n, l, d, mij, c)) dr = mij;
        else st = mij + 1;
    }

    return st;
}

Compilation message

shortcut.cpp: In function 'bool ok(int, vi, vi, ll, int)':
shortcut.cpp:15:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for (int i = 1; i < sl.size(); ++i)
      |                     ~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB n = 4, 80 is a correct answer
2 Correct 0 ms 348 KB n = 9, 110 is a correct answer
3 Correct 0 ms 348 KB n = 4, 21 is a correct answer
4 Correct 0 ms 348 KB n = 3, 4 is a correct answer
5 Incorrect 0 ms 348 KB n = 2, incorrect answer: jury 62 vs contestant 72
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB n = 4, 80 is a correct answer
2 Correct 0 ms 348 KB n = 9, 110 is a correct answer
3 Correct 0 ms 348 KB n = 4, 21 is a correct answer
4 Correct 0 ms 348 KB n = 3, 4 is a correct answer
5 Incorrect 0 ms 348 KB n = 2, incorrect answer: jury 62 vs contestant 72
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB n = 4, 80 is a correct answer
2 Correct 0 ms 348 KB n = 9, 110 is a correct answer
3 Correct 0 ms 348 KB n = 4, 21 is a correct answer
4 Correct 0 ms 348 KB n = 3, 4 is a correct answer
5 Incorrect 0 ms 348 KB n = 2, incorrect answer: jury 62 vs contestant 72
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB n = 4, 80 is a correct answer
2 Correct 0 ms 348 KB n = 9, 110 is a correct answer
3 Correct 0 ms 348 KB n = 4, 21 is a correct answer
4 Correct 0 ms 348 KB n = 3, 4 is a correct answer
5 Incorrect 0 ms 348 KB n = 2, incorrect answer: jury 62 vs contestant 72
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB n = 4, 80 is a correct answer
2 Correct 0 ms 348 KB n = 9, 110 is a correct answer
3 Correct 0 ms 348 KB n = 4, 21 is a correct answer
4 Correct 0 ms 348 KB n = 3, 4 is a correct answer
5 Incorrect 0 ms 348 KB n = 2, incorrect answer: jury 62 vs contestant 72
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB n = 4, 80 is a correct answer
2 Correct 0 ms 348 KB n = 9, 110 is a correct answer
3 Correct 0 ms 348 KB n = 4, 21 is a correct answer
4 Correct 0 ms 348 KB n = 3, 4 is a correct answer
5 Incorrect 0 ms 348 KB n = 2, incorrect answer: jury 62 vs contestant 72
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB n = 4, 80 is a correct answer
2 Correct 0 ms 348 KB n = 9, 110 is a correct answer
3 Correct 0 ms 348 KB n = 4, 21 is a correct answer
4 Correct 0 ms 348 KB n = 3, 4 is a correct answer
5 Incorrect 0 ms 348 KB n = 2, incorrect answer: jury 62 vs contestant 72
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB n = 4, 80 is a correct answer
2 Correct 0 ms 348 KB n = 9, 110 is a correct answer
3 Correct 0 ms 348 KB n = 4, 21 is a correct answer
4 Correct 0 ms 348 KB n = 3, 4 is a correct answer
5 Incorrect 0 ms 348 KB n = 2, incorrect answer: jury 62 vs contestant 72
6 Halted 0 ms 0 KB -