Submission #8540465


Source Code Expand

#include <bits/stdc++.h>
#define off  exit( 0 )
#define cn   continue
#define rt   return
#define sc   scanf
#define pr   printf
#define pb   push_back
#define pf   push_front
#define p_f  pop_front
#define p_b  pop_back
#define ff   first
#define ss   second
#define ll   long long
#define ld   long double
#define N    100256
#define M    998244353
#define I    1000000000000000000
#define pdd  pair < ld, ld >
#define pll  pair < ll, ll >
#define pii  pair < int, int >
#define sqr( a )           a * a
#define all( c )           c.begin(), c.end()
#define srt( c )           sort( all( c ) )
#define rev( c )           reverse( all( c ) )
#define srtr( c )          sort( c.rbegin(), c.rend() );
using namespace std;

ll n, m, a[ 505 ][ 505 ], ans = M;
bool ok[ 505 ];
void solve()
{
    sc( "%I64d%I64d", &n, &m );
    for( int i = 0; i < n; i ++ )
        for( int j = 0; j <m; j ++ )
        {
            cin >> a[i][j];
            a[i][j] --;
        }

    for( int k = 0; k < m; k ++ )
    {
        ll v[ 505 ];
        memset( v, 0LL, sizeof v );
        for( int i = 0; i < n; i ++ )
            for( int j = 0; j < m; j ++ )
                if( !ok[ a[i][j] ] )
                {
                    v[ a[i][j] ] ++;
                    break;
                }
        ll cnt = 0, t;
        for( int i = 0; i < m; i ++ )
            if( cnt < v[ i ] )
            {
                cnt = v[ i ];
                t = i;
            }
        ans = min( ans, cnt );
        ok[t] = 1;
    }

    pr( "%I64d", ans );
}

int main()
{
    int tt = 1;
    //sc( "%d", &tt );
    for( int i = 1; i <= tt; i ++ )
        solve();
}










Submission Info

Submission Time
Task B - Sports Festival
User vjudge4
Language C++14 (GCC 5.4.1)
Score 700
Code Size 1652 Byte
Status AC
Exec Time 31 ms
Memory 1408 KB

Compile Error

./Main.cpp: In function ‘void solve()’:
./Main.cpp:32:30: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=]
     sc( "%I64d%I64d", &n, &m );
                              ^
./Main.cpp:32:30: warning: format ‘%d’ expects argument of type ‘int*’, but argument 3 has type ‘long long int*’ [-Wformat=]
./Main.cpp:62:22: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
     pr( "%I64d", ans );
                      ^
./Main.cpp:32:31: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     sc( "%I64d%I64d", &n, &m );
                               ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 700 / 700
Status
AC × 3
AC × 24
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt, subtask_1_16.txt, subtask_1_17.txt, subtask_1_18.txt
Case Name Status Exec Time Memory
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
sample_03.txt AC 1 ms 256 KB
subtask_1_01.txt AC 1 ms 256 KB
subtask_1_02.txt AC 1 ms 640 KB
subtask_1_03.txt AC 2 ms 512 KB
subtask_1_04.txt AC 3 ms 640 KB
subtask_1_05.txt AC 1 ms 640 KB
subtask_1_06.txt AC 6 ms 1408 KB
subtask_1_07.txt AC 8 ms 1408 KB
subtask_1_08.txt AC 4 ms 1408 KB
subtask_1_09.txt AC 2 ms 1408 KB
subtask_1_10.txt AC 3 ms 384 KB
subtask_1_11.txt AC 6 ms 512 KB
subtask_1_12.txt AC 2 ms 256 KB
subtask_1_13.txt AC 8 ms 640 KB
subtask_1_14.txt AC 21 ms 1408 KB
subtask_1_15.txt AC 29 ms 1408 KB
subtask_1_16.txt AC 22 ms 1408 KB
subtask_1_17.txt AC 24 ms 1408 KB
subtask_1_18.txt AC 31 ms 1408 KB