Submission #874474

# Submission time Handle Problem Language Result Execution time Memory
874474 2023-11-17T06:47:01 Z vjudge1 Job Scheduling (CEOI12_jobs) C++17
30 / 100
292 ms 22892 KB
//In His Name
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
typedef pair<int, int> pii;
typedef pair<long long, int> pli;
typedef pair<long long, long long> pll;
#define F first
#define S second
#define pb push_back
#define bug(x) cout << "Ah shit , here we go again : " << x <<endl
#define all(x) x.begin() , x.end()
#define ceil(x,y) x/y + min(1ll,x%y)
const int maxn = 5e3 + 10, MOD = 1e9 + 7;
const ll INF = 1e18;

int n , d , m;
vector<int> v;
bool check(int mid){
    vector<int> s;
    for(int i : v) s.pb(i);
    int cnt = 1 , flag = 0;
    for(int i = 0 ; i < s.size(); i++){
        if(cnt - s[i] > d) return false;
        if(cnt < s[i]) flag = 0 , cnt++ ;
        flag++;
        if(flag == mid) flag = 0 , cnt++;

    }
    return true;
}

signed main(){
    ios_base::sync_with_stdio(false);

    cin >> n >> d >> m;
    for(int i = 1 ; i <= m ; i++){
        int x;
        cin >> x;
        v.pb(x);
    }
    sort(all(v));
    int l = 1 , r = 1e9;
    while(r - l > 1){
        int mid = (l+r) >> 1;
        if(check(mid)) r = mid;
        else l = mid;
    }
    cout << r << "\n";
    int cnt = 0;
    for(int i = 1 ; i <= m ; i++) cout << i%n+1 << " ";
    cout << 0 <<"\n";
    for(int i = 1 ; i < n ; i++) cout << 0 << "\n";

}

Compilation message

jobs.cpp: In function 'bool check(long long int)':
jobs.cpp:24:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     for(int i = 0 ; i < s.size(); i++){
      |                     ~~^~~~~~~~~~
jobs.cpp: In function 'int main()':
jobs.cpp:51:9: warning: unused variable 'cnt' [-Wunused-variable]
   51 |     int cnt = 0;
      |         ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 3140 KB Output isn't correct
2 Incorrect 40 ms 3372 KB Output isn't correct
3 Incorrect 31 ms 3140 KB Output isn't correct
4 Incorrect 32 ms 3140 KB Output isn't correct
5 Incorrect 40 ms 3156 KB Output isn't correct
6 Incorrect 33 ms 3140 KB Output isn't correct
7 Incorrect 32 ms 3128 KB Output isn't correct
8 Incorrect 31 ms 3140 KB Output isn't correct
9 Correct 44 ms 3136 KB Output is correct
10 Correct 39 ms 3144 KB Output is correct
11 Partially correct 35 ms 3128 KB Partially correct
12 Partially correct 71 ms 5776 KB Partially correct
13 Partially correct 119 ms 10308 KB Partially correct
14 Partially correct 142 ms 11276 KB Partially correct
15 Partially correct 159 ms 12480 KB Partially correct
16 Partially correct 235 ms 20176 KB Partially correct
17 Partially correct 269 ms 21956 KB Partially correct
18 Partially correct 271 ms 22892 KB Partially correct
19 Partially correct 292 ms 22832 KB Partially correct
20 Partially correct 272 ms 20384 KB Partially correct