Submission #16553213


Source Code Expand

Copy
#include <stdio.h>

int             check_condition(int human[3][50000], int company[4][50000], int i, int j)
{
        int k;

        if (company[0][j] > human[0][i])
                return (0);
        if (company[1][j] > human[1][i])
                return (0);
        if (company[2][j] > human[2][i])
                return (0);
        return (1);
}

int             main(void)
{
        int     n;
        int     m;
        int     company[4][50000];
        int     human[3][50000];
        int     answer[50000] = {0};
        int     i;
        int     j;

        scanf("%d%d", &n, &m);
        for (i = 0; i < n; i++)
        {
                scanf("%d%d%d%d", &company[0][i], &company[1][i], &company[2][i], &company[3][i]);
        }
        for (i = 0; i < m; i++)
        {
                scanf("%d%d%d", &human[0][i], &human[1][i], &human[2][i]);
        }
        for (i = 0; i < m; i++)
        {
                for (j = 0; j < n; j++)
                {
                        if (check_condition(human, company, i, j))
                        {
                                if (answer[i] < company[3][j])
                                        answer[i] = company[3][j];
                        }
                }
        }
        for (i = 0; i < m; i++)
        {
                printf("%d\n", answer[i]);
        }
        return (0);
}

Submission Info

Submission Time
Task C - Optimal Recommendations
User atsuk
Language C (GCC 9.2.1)
Score 0
Code Size 1421 Byte
Status TLE
Exec Time 2205 ms
Memory 3092 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:26:9: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   26 |         scanf("%d%d", &n, &m);
      |         ^~~~~~~~~~~~~~~~~~~~~
./Main.c:29:17: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   29 |                 scanf("%d%d%d%d", &company[0][i], &company[1][i], &company[2][i], &company[3][i]);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./Main.c:33:17: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   33 |                 scanf("%d%d%d", &human[0][i], &human[1][i], &human[2][i]);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 10
TLE × 14
Set Name Test Cases
All 10-random-00.txt, 10-random-01.txt, 10-random-02.txt, 10-random-03.txt, 10-random-04.txt, 20-absW-00.txt, 20-absW-01.txt, 20-absW-02.txt, 20-absW-03.txt, 20-absW-04.txt, 30-balance-00.txt, 30-balance-01.txt, 30-balance-02.txt, 30-balance-03.txt, 30-balance-04.txt, 40-limit_dim-00.txt, 40-limit_dim-01.txt, 40-limit_dim-02.txt, 40-limit_dim-03.txt, 40-limit_dim-04.txt, 40-limit_dim-05.txt, 40-limit_dim-06.txt, Corner1.txt, Sample1.txt
Case Name Status Exec Time Memory
10-random-00.txt TLE 2205 ms 3044 KB
10-random-01.txt AC 5 ms 1900 KB
10-random-02.txt AC 436 ms 2392 KB
10-random-03.txt TLE 2205 ms 2352 KB
10-random-04.txt AC 877 ms 2520 KB
20-absW-00.txt TLE 2205 ms 3040 KB
20-absW-01.txt AC 7 ms 1884 KB
20-absW-02.txt TLE 2205 ms 2652 KB
20-absW-03.txt TLE 2205 ms 2672 KB
20-absW-04.txt AC 757 ms 2320 KB
30-balance-00.txt TLE 2205 ms 3092 KB
30-balance-01.txt AC 9 ms 1852 KB
30-balance-02.txt AC 243 ms 2200 KB
30-balance-03.txt TLE 2205 ms 2636 KB
30-balance-04.txt AC 1101 ms 2548 KB
40-limit_dim-00.txt TLE 2205 ms 3036 KB
40-limit_dim-01.txt TLE 2205 ms 3040 KB
40-limit_dim-02.txt TLE 2205 ms 3076 KB
40-limit_dim-03.txt TLE 2205 ms 3076 KB
40-limit_dim-04.txt TLE 2205 ms 2940 KB
40-limit_dim-05.txt TLE 2205 ms 3036 KB
40-limit_dim-06.txt TLE 2205 ms 3080 KB
Corner1.txt AC 5 ms 1860 KB
Sample1.txt AC 6 ms 1904 KB