답안 #78355

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
78355 2018-10-04T05:20:18 Z SamAnd Job Scheduling (CEOI12_jobs) C++17
0 / 100
239 ms 31224 KB
#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
const int N=1000006;
struct ban
{
    int x,i;
};
bool operator<(const ban& a,const ban& b)
{
    if(a.x<b.x)
        return true;
    if(a.x>b.x)
        return false;
    return a.i<b.i;
}

int n,d,m;
ban a[N];

bool stg(int x)
{
    int o=1,xx=0;
    for(int i=0;i<m;++i)
    {
        while(a[i].x>o)
        {
            ++o;
            xx=0;
        }
        if(o>n)
            return false;
        ++xx;
        if(xx==x)
        {
            ++o;
            xx=0;
        }
    }
    return true;
}

int byn()
{
    int l=1,r=m;
    while((r-l)>3)
    {
        int mid=(l+r)/2;
        if(stg(mid))
            r=mid;
        else
            l=mid;
    }
    for(int mid=l;mid<=r;++mid)
        if(stg(mid))
            return mid;
}

int main()
{
    //freopen("input.txt","r",stdin);
    scanf("%d%d%d",&n,&d,&m);
    for(int i=0;i<m;++i)
    {
        scanf("%d",&a[i].x);
        a[i].i=i;
    }
    sort(a,a+m);
    cout<<byn()<<endl;
    return 0;
}

Compilation message

jobs.cpp: In function 'int byn()':
jobs.cpp:57:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
jobs.cpp: In function 'int main()':
jobs.cpp:62:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d",&n,&d,&m);
     ~~~~~^~~~~~~~~~~~~~~~~~~
jobs.cpp:65:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&a[i].x);
         ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 17 ms 1528 KB Output isn't correct
2 Incorrect 19 ms 1836 KB Output isn't correct
3 Incorrect 17 ms 2268 KB Output isn't correct
4 Incorrect 21 ms 2468 KB Output isn't correct
5 Incorrect 17 ms 2936 KB Output isn't correct
6 Incorrect 20 ms 3160 KB Output isn't correct
7 Incorrect 18 ms 3400 KB Output isn't correct
8 Incorrect 16 ms 3764 KB Output isn't correct
9 Incorrect 26 ms 4048 KB Output isn't correct
10 Incorrect 25 ms 4300 KB Output isn't correct
11 Incorrect 40 ms 4680 KB Unexpected end of file - int32 expected
12 Incorrect 55 ms 6216 KB Unexpected end of file - int32 expected
13 Incorrect 91 ms 8208 KB Unexpected end of file - int32 expected
14 Incorrect 126 ms 10988 KB Unexpected end of file - int32 expected
15 Incorrect 139 ms 13588 KB Unexpected end of file - int32 expected
16 Incorrect 178 ms 17428 KB Unexpected end of file - int32 expected
17 Incorrect 195 ms 21400 KB Unexpected end of file - int32 expected
18 Incorrect 221 ms 25392 KB Output isn't correct
19 Incorrect 239 ms 29640 KB Output isn't correct
20 Incorrect 202 ms 31224 KB Unexpected end of file - int32 expected