Submission #545189

# Submission time Handle Problem Language Result Execution time Memory
545189 2022-04-03T23:01:30 Z chonka Super Dango Maker (JOI22_dango3) C++17
100 / 100
3225 ms 532 KB
#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
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 364 KB Output is correct
2 Correct 24 ms 368 KB Output is correct
3 Correct 24 ms 376 KB Output is correct
4 Correct 24 ms 340 KB Output is correct
5 Correct 22 ms 368 KB Output is correct
6 Correct 22 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 739 ms 436 KB Output is correct
2 Correct 752 ms 436 KB Output is correct
3 Correct 788 ms 428 KB Output is correct
4 Correct 804 ms 448 KB Output is correct
5 Correct 713 ms 460 KB Output is correct
6 Correct 706 ms 428 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2894 ms 512 KB Output is correct
2 Correct 2903 ms 516 KB Output is correct
3 Correct 3200 ms 532 KB Output is correct
4 Correct 3225 ms 528 KB Output is correct
5 Correct 2737 ms 520 KB Output is correct
6 Correct 2733 ms 516 KB Output is correct