제출 #384667

#제출 시각아이디문제언어결과실행 시간메모리
384667DarkVoidJob Scheduling (CEOI12_jobs)C++11
100 / 100
404 ms24780 KiB
#pragma GCC optimize("unroll-loops, O3")
#pragma GCC target("avx")
#include <bits/stdc++.h>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)
using namespace std;

int n, q, m;
pair<int, int> a[1000001];

vector<vector<int>> check(int cnt){
    vector<vector<int>> res;
    int k = 1;
    for(int i = 1; i <= n; i++){
        res.emplace_back();
        for(int j = 0; j < cnt && k <= m && a[k].first <= i; j++, k++)
            if(a[k].first + q < i) return {};
            else res.back().push_back(a[k].second);
    }
    if(k <= m) return {};
    else return res;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> q >> m;
    for(int i = 1; i <= m; i++)
        cin >> a[i].first, a[i].second = i;
    sort(a, a + m + 1);
    int l = 1, r = 1e6;
    vector<vector<int>> ans;
    while(l < r){
        int mid = l + (r - l) / 2;
        vector<vector<int>> work = check(mid);
        if(!work.empty()) ans = work, r = mid;
        else l = mid + 1;
    }
    cout << r << '\n';
    for(auto &i : ans){
        for(int j : i) cout << j << ' ';
        cout << "0\n";
    }
    return 0;
}

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

jobs.cpp:1:40: warning: bad option '-f O3' to pragma 'optimize' [-Wpragmas]
    1 | #pragma GCC optimize("unroll-loops, O3")
      |                                        ^
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
    2 | #pragma GCC target("avx")
      |                         ^
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
/var
#Verdict Execution timeMemoryGrader output
Fetching results...