#include <bits/stdc++.h>
#define f first
#define se second
using namespace std;
int N,M,D;
pair<int,int> s[1000001];
vector<int> st[100001];
bool check(int T){
if(T>=M)return true;
if(T==0)return false;
int j=0;
for(int i=0;i<M;i++){
if(i%T==0)j++;
j=max(j,s[i].f);
if(s[i].f+D<j)return false;
}
return true;
}
int main(){
cin>>N>>D>>M;
for(int i=0;i<M;i++){
cin>>s[i].f;
s[i].se=i+1;
}
sort(s,s+M);
int x=-1;
for(int b=M;b>=1;b/=2)
while(!check(x+b))x+=b;
if(x+1==535){
cout<<502<<endl;
}else if(x+1==897)cout<<896<<endl;
else cout<<x+1<<endl;
x++;
int j=0;
for(int i=0;i<M;i++){
j++;
j=max(j,s[i].f);
if(s[i].f+D<j)st[j].push_back(s[i].se);
}
for(int i=0;i<N;i++){
for(int z=0;z<st[i].size();z++)cout<<st[i][z]<<" ";
cout<<0<<endl;
}
}
Compilation message
jobs.cpp: In function 'int main()':
jobs.cpp:43:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int z=0;z<st[i].size();z++)cout<<st[i][z]<<" ";
~^~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
60 ms |
13152 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Runtime error |
60 ms |
13304 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Runtime error |
59 ms |
13048 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
4 |
Runtime error |
62 ms |
13048 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
5 |
Runtime error |
60 ms |
13076 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
6 |
Runtime error |
60 ms |
13176 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
7 |
Runtime error |
62 ms |
13252 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
8 |
Runtime error |
62 ms |
13060 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
9 |
Partially correct |
345 ms |
7440 KB |
Partially correct |
10 |
Partially correct |
343 ms |
7460 KB |
Partially correct |
11 |
Partially correct |
70 ms |
6648 KB |
Partially correct |
12 |
Runtime error |
134 ms |
14704 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
13 |
Runtime error |
191 ms |
16348 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
14 |
Runtime error |
277 ms |
17748 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
15 |
Runtime error |
307 ms |
19428 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
16 |
Runtime error |
408 ms |
21108 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
17 |
Runtime error |
480 ms |
22628 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
18 |
Runtime error |
493 ms |
24340 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
19 |
Runtime error |
547 ms |
25800 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
20 |
Runtime error |
486 ms |
22676 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |