This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include "dango3.h"
using namespace std ;
int n , m ;
vector < int > aux ;
int comp[ 10007 ] ;
int ask ( int tp ) {
if ( tp == 0 ) { return 0 ; }
aux.clear ( ) ;
for ( int i = 1 ; i <= n * m ; ++ i ) {
if ( comp[ i ] > tp ) {
aux.push_back ( i ) ;
}
}
return ( m - Query ( aux ) ) ;
}
vector < int > gr[ 27 ] ;
void Solve ( int N , int M ) {
n = N , m = M ;
for ( int i = 1 ; i <= n * m ; ++ i ) {
comp[ i ] = 32 ;
}
for ( int i = 1 ; i <= n * m ; ++ i ) {
int l , r , mid ;
l = 1 ;
r = m ;
while ( l < r ) {
mid = ( l + r ) / 2 ;
comp[ i ] = mid ;
int ret = ask ( mid ) ;
if ( ret <= mid ) { r = mid ; }
else { l = mid + 1 ; }
}
comp[ i ] = r ;
gr[ comp[ i ] ].push_back ( i ) ;
}
for ( int i = 1 ; i <= m ; ++ i ) {
Answer ( gr[ i ] ) ;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |