Submission #16544232


Source Code Expand

Copy
#include <stdio.h>

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

        for (k = 0; k < 3; k++)
        {
                if (company[k][j] > human[k][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 1350 Byte
Status TLE
Exec Time 2205 ms
Memory 3092 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:25:9: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   25 |         scanf("%d%d", &n, &m);
      |         ^~~~~~~~~~~~~~~~~~~~~
./Main.c:28:17: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   28 |                 scanf("%d%d%d%d", &company[0][i], &company[1][i], &company[2][i], &company[3][i]);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./Main.c:32:17: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   32 |                 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 2932 KB
10-random-01.txt AC 5 ms 1904 KB
10-random-02.txt AC 454 ms 2328 KB
10-random-03.txt TLE 2205 ms 2468 KB
10-random-04.txt AC 929 ms 2560 KB
20-absW-00.txt TLE 2205 ms 3092 KB
20-absW-01.txt AC 7 ms 1860 KB
20-absW-02.txt TLE 2205 ms 2616 KB
20-absW-03.txt TLE 2205 ms 2528 KB
20-absW-04.txt AC 801 ms 2220 KB
30-balance-00.txt TLE 2205 ms 3048 KB
30-balance-01.txt AC 7 ms 1896 KB
30-balance-02.txt AC 253 ms 2204 KB
30-balance-03.txt TLE 2205 ms 2688 KB
30-balance-04.txt AC 1167 ms 2520 KB
40-limit_dim-00.txt TLE 2205 ms 3052 KB
40-limit_dim-01.txt TLE 2205 ms 3048 KB
40-limit_dim-02.txt TLE 2205 ms 2940 KB
40-limit_dim-03.txt TLE 2205 ms 3020 KB
40-limit_dim-04.txt TLE 2205 ms 2940 KB
40-limit_dim-05.txt TLE 2205 ms 3040 KB
40-limit_dim-06.txt TLE 2205 ms 3032 KB
Corner1.txt AC 6 ms 1900 KB
Sample1.txt AC 1 ms 1904 KB