제출 #1327478

#제출 시각아이디문제언어결과실행 시간메모리
1327478Ekber_EkberWatching (JOI13_watching)C++20
50 / 100
1095 ms15420 KiB
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#include <bits/stdc++.h>
#define GOOD_LUCK ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
// #define int long long
#define endl "\n"
#define ff first
#define ss second
#define pb push_back
#define all(v) v.begin(), v.end()
using namespace std;

constexpr int MAX = 2e+5 + 1, INF = 1e+9, MOD = 1e+9 + 7, K = 31;

void _() {
    int n, p, q;
    cin >> n >> p >> q;
    vector <int> v(n);
    for (int &i : v) cin >> i;
    if (p + q >= n) {
        cout << 1;
        return;
    }
    v.pb(-INF);
    sort(all(v));
    int l = 1, r = INF, res;
    while (l <= r) {
        int m = (l + r) / 2;
        vector <vector <int>> dp(n+1, vector <int>(p+1, INF));
        dp[0][0] = 0;
        for (int i = 1; i <= n; i++) {
            for (int j = 0; j <= p; j++) {
                int ans = INF;
                if (j) {
                    int x = v[i] - m + 1;
                    auto it = lower_bound(all(v), x);
                    --it;
                    int id = it - v.begin();
                    ans = min(ans, dp[id][j-1]);
                }
                int x = v[i] - 2 * m + 1;
                auto it = lower_bound(all(v), x);
                --it;
                int id = it - v.begin();
                if (id != i) ans = min(ans, dp[id][j] + 1);
                dp[i][j] = ans;
            }
        }
        if (*min_element(all(dp[n])) <= q) {
            res = m;
            r = m - 1;
        }
        else l = m + 1;
    }
    cout << res;
}

signed main() {

    GOOD_LUCK

    int tests=1;
    // cin >> tests;
    for (int i=1; i <= tests; i++) {
        _();
        cout << endl;
    }

    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

watching.cpp:21:39: warning: bad option '-fwhole-program' to pragma 'optimize' [-Wpragmas]
   21 | #pragma GCC optimize("-fwhole-program")
      |                                       ^
watching.cpp:28:41: warning: bad option '-fstrict-overflow' to pragma 'optimize' [-Wpragmas]
   28 | #pragma GCC optimize("-fstrict-overflow")
      |                                         ^
watching.cpp:30:41: warning: bad option '-fcse-skip-blocks' to pragma 'optimize' [-Wpragmas]
   30 | #pragma GCC optimize("-fcse-skip-blocks")
      |                                         ^
watching.cpp:44:51: warning: bad option '-funsafe-loop-optimizations' to pragma 'optimize' [-Wpragmas]
   44 | #pragma GCC optimize("-funsafe-loop-optimizations")
      |                                                   ^
watching.cpp:59:8: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
   59 | void _() {
      |        ^
watching.cpp:59:8: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
watching.cpp:59:8: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
watching.cpp:59:8: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
watching.cpp:102:13: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
  102 | signed main() {
      |             ^
watching.cpp:102:13: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
watching.cpp:102:13: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
watching.cpp:102:13: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...