Submission #56443

# Submission time Handle Problem Language Result Execution time Memory
56443 2018-07-11T10:49:33 Z Batrr Job Scheduling (CEOI12_jobs) C++14
0 / 100
706 ms 33792 KB
#include <bits/stdc++.h>

#define ll long long                   
#define f first 
#define s second 
#define pb push_back               
#define mp make_pair 
#define o cout<<"BUG"<<endl;
#define IOS ios_base::sync_with_stdio(0);
using namespace std;                    
const ll maxn=1e6+123,inf=1e18,mod=1e9+7;
int n,m,d,b[maxn];
pair<int,int>a[maxn];
bool check(int mx,bool flag){
    queue<int>q;
    for(int i=1,j=0;i<=n;i++){
        while(j<m && a[j].f==i)
            q.push(a[j++].s);
        int cur=mx;
        while(!q.empty() && cur){
            if(b[q.front()]+d<i)
                return 0;
            if(flag)
                cout<<q.front()<<" ";
            q.pop();
            cur--;
        }
        if(flag)
            cout<<0<<endl;
    }
    return q.empty();
}
int main(){
    #ifdef LOCAL
        freopen ("test.in", "r", stdin);
    #endif
    IOS
    cin>>n>>d>>m;
    for(int i=0;i<m;i++){
        cin>>a[i].f;
        a[i].s=i+1;
        b[i+1]=a[i].f;
    }
    sort(a,a+m);
    int l=1,r=1e6;
    while(l<=r){
        int m=(l+r)/2;
        if( !check(m,0) )
            l=m+1;
        else
            r=m-1;
    }
    check(l,1);
}
# Verdict Execution time Memory Grader output
1 Incorrect 58 ms 2808 KB Output isn't correct
2 Incorrect 50 ms 3156 KB Output isn't correct
3 Incorrect 70 ms 3596 KB Output isn't correct
4 Incorrect 69 ms 4144 KB Output isn't correct
5 Incorrect 54 ms 4336 KB Output isn't correct
6 Incorrect 48 ms 4680 KB Output isn't correct
7 Incorrect 58 ms 4892 KB Output isn't correct
8 Incorrect 57 ms 5152 KB Output isn't correct
9 Incorrect 214 ms 5320 KB Expected EOLN
10 Incorrect 187 ms 5516 KB Expected EOLN
11 Incorrect 54 ms 5644 KB Expected EOLN
12 Incorrect 94 ms 8460 KB Expected EOLN
13 Incorrect 182 ms 11504 KB Expected EOLN
14 Incorrect 343 ms 15356 KB Expected EOLN
15 Incorrect 268 ms 19068 KB Expected EOLN
16 Incorrect 361 ms 23668 KB Expected EOLN
17 Incorrect 518 ms 28888 KB Expected EOLN
18 Runtime error 604 ms 33792 KB Memory limit exceeded 33792 {'time-wall': '0.665', 'max-rss': '11096', 'csw-forced': '45', 'cg-mem': '33792', 'time': '0.604', 'csw-voluntary': '5'} 32768
19 Runtime error 706 ms 33792 KB Memory limit exceeded 33792 {'time-wall': '0.760', 'max-rss': '12236', 'csw-forced': '48', 'cg-mem': '33792', 'time': '0.706', 'csw-voluntary': '5'} 32768
20 Runtime error 468 ms 33792 KB Memory limit exceeded 33792 {'time-wall': '0.520', 'max-rss': '9896', 'csw-forced': '74', 'cg-mem': '33792', 'time': '0.468', 'csw-voluntary': '5'} 32768