답안 #745489

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
745489 2023-05-20T08:32:26 Z Nafeeszx Job Scheduling (CEOI12_jobs) C++14
0 / 100
79 ms 10956 KB
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define trav(a, x) for(auto& a : x)
#define FOR(i, a, b) for (int i=(a); i<=(signed)(b); i++)
#define ROF(i, a, b) for (int i=(a); i>=(signed)(b); i--)
#define F0R(i, a) for (int i=0; i<(signed)(a); i++)
#define vi vector<int>
#define f first
#define s second
#define all(v) (v).begin(), (v).end()
typedef long long ll;

const int mod = 1e9 + 7, MOD = 998244353;

const int N = 2005;

int main() 
{	
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n, m, d;
    cin >> n >> d >> m;
    vector<int> v(m);
    vector<vector<int>> tind(n-d+1);
    F0R(i, m) {
        cin >> v[i];
        tind[v[i]].push_back(i);
    }
    int hi = m, lo = 0;
    while(hi - lo > 1) {
        int mid = (hi+lo)/2;
        bool ok = true;
        int c = 0;
        FOR(i, 1, n-d) {
            if(c + tind[i].size() > mid * (d+1)) {
                ok = false;
                break;
            }
            c = max(0, c+(int)tind[i].size()-mid);
        }
        //cout << mid << '\n';
        if(ok) hi=mid;
        else lo=mid;
    }
    cout << hi << '\n';
    return 0;
} 
 

Compilation message

jobs.cpp: In function 'int main()':
jobs.cpp:36:35: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |             if(c + tind[i].size() > mid * (d+1)) {
      |                ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 1880 KB Unexpected end of file - int32 expected
2 Incorrect 8 ms 1820 KB Unexpected end of file - int32 expected
3 Incorrect 7 ms 1784 KB Unexpected end of file - int32 expected
4 Incorrect 9 ms 1880 KB Unexpected end of file - int32 expected
5 Incorrect 7 ms 1880 KB Unexpected end of file - int32 expected
6 Incorrect 7 ms 1880 KB Unexpected end of file - int32 expected
7 Incorrect 8 ms 1912 KB Unexpected end of file - int32 expected
8 Incorrect 10 ms 1880 KB Unexpected end of file - int32 expected
9 Incorrect 9 ms 3924 KB Unexpected end of file - int32 expected
10 Incorrect 10 ms 3924 KB Unexpected end of file - int32 expected
11 Incorrect 9 ms 1648 KB Unexpected end of file - int32 expected
12 Incorrect 16 ms 2672 KB Unexpected end of file - int32 expected
13 Incorrect 22 ms 3964 KB Unexpected end of file - int32 expected
14 Incorrect 48 ms 5200 KB Unexpected end of file - int32 expected
15 Incorrect 37 ms 5824 KB Unexpected end of file - int32 expected
16 Incorrect 67 ms 7320 KB Unexpected end of file - int32 expected
17 Incorrect 79 ms 8888 KB Unexpected end of file - int32 expected
18 Incorrect 60 ms 8544 KB Unexpected end of file - int32 expected
19 Incorrect 66 ms 10956 KB Unexpected end of file - int32 expected
20 Incorrect 70 ms 8828 KB Unexpected end of file - int32 expected