#include <bits/stdc++.h>
using namespace std;
long long n, d, m ;
struct neveu
{
int a, b ;
} v [ 1000005 ];
bool check(long long caz )
{
int ziua = 1 ;
for ( int i = 1; i <= m ; i += caz, ziua ++ )
{
if ( v[ i ].a < ziua )
return false ;
if ( ziua > n )
return false ;
}
return true ;
}
bool compare ( neveu x, neveu y)
{
return ( x. a < y . a );
}
int main()
{
cin >> n >> d >> m ;
for ( int i = 1; i <= m ; i ++ )
{
cin >> v[ i ].a ;
v [ i ].a += d ;
v [ i] . b = i ;
}
sort ( v + 1, v + m + 1, compare) ;
long long poz = 1e9 ;
int st = 1, dr = m ;
while ( st <= dr )
{
long long mij = ( st + dr ) / 2 ;
if ( check ( mij ) == true )
{
poz = mij ;
dr = mij - 1;
}
else
st = mij + 1;
}
cout << poz << '\n' ;
long long masini = poz ;
long long ziua = 1 ;
for ( int i = 1; i <= m ; i ++ )
{
cout << v [ i ].b << " ";
masini -- ;
if ( masini == 0 )
{
cout << 0 << '\n';
masini = poz ;
ziua ++ ;
}
}
if (masini != poz )
{
cout << 0 << '\n';
}
while ( ziua <= n )
{
cout << 0 << '\n';
ziua ++ ;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
23 ms |
1612 KB |
Output isn't correct |
2 |
Incorrect |
30 ms |
1608 KB |
Output isn't correct |
3 |
Incorrect |
22 ms |
1612 KB |
Output isn't correct |
4 |
Incorrect |
26 ms |
1564 KB |
Output isn't correct |
5 |
Incorrect |
22 ms |
1604 KB |
Output isn't correct |
6 |
Incorrect |
35 ms |
1580 KB |
Output isn't correct |
7 |
Incorrect |
22 ms |
1688 KB |
Output isn't correct |
8 |
Incorrect |
22 ms |
1688 KB |
Output isn't correct |
9 |
Incorrect |
35 ms |
1752 KB |
Extra information in the output file |
10 |
Incorrect |
47 ms |
1860 KB |
Extra information in the output file |
11 |
Incorrect |
27 ms |
1612 KB |
Extra information in the output file |
12 |
Correct |
56 ms |
3088 KB |
Output is correct |
13 |
Incorrect |
87 ms |
4608 KB |
Extra information in the output file |
14 |
Correct |
145 ms |
6100 KB |
Output is correct |
15 |
Incorrect |
133 ms |
7524 KB |
Output isn't correct |
16 |
Incorrect |
190 ms |
9060 KB |
Extra information in the output file |
17 |
Incorrect |
231 ms |
10520 KB |
Extra information in the output file |
18 |
Incorrect |
213 ms |
12000 KB |
Extra information in the output file |
19 |
Incorrect |
251 ms |
13724 KB |
Extra information in the output file |
20 |
Incorrect |
216 ms |
10532 KB |
Extra information in the output file |