提出 #4286373


ソースコード 拡げる

#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#define N 10020
#define M 20
using namespace std;

const int c[] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};

int A[M];
int f[N][M];

int main(void)
{
    int n, m;
    int i, j, k;

    scanf("%d %d", &n, &m);
    for(i = 1; i <= m; i ++)
    {
        scanf("%d", &A[i]);
        f[c[A[i]]][A[i]] = 1;
    }

    sort(A + 1, A + m + 1);

    for(i = 2; i < n; i ++)
        for(j = 1; j <= m; j ++)
            if(f[i][A[j]])
                for(k = 1; k <= m; k ++)
                    f[i + c[A[k]]][A[k]] = max(f[i + c[A[k]]][A[k]], f[i][A[j]] + 1);

    for(i = n; i; i -= c[A[k]])
    {
        for(j = 1, k = 0; j <= m; j ++)
            if(f[i][A[j]] && f[i][A[k]] <= f[i][A[j]])
                k = j;
        putchar(A[k] + '0');
    }

    return 0;
}

提出情報

提出日時
問題 D - Match Matching
ユーザ Ufowoqqqo
言語 C++14 (GCC 5.4.1)
得点 400
コード長 893 Byte
結果 AC
実行時間 4 ms
メモリ 1024 KiB

コンパイルエラー

./Main.cpp: In function ‘int main()’:
./Main.cpp:20:27: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &n, &m);
                           ^
./Main.cpp:23:27: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &A[i]);
                           ^

ジャッジ結果

セット名 All Sample
得点 / 配点 400 / 400 0 / 0
結果
AC × 29
AC × 3
セット名 テストケース
All 0_random_1, 0_random_2, 0_random_3, 0_random_4, 0_random_5, 0_random_6, 0_random_7, 0_random_8, 1_normal_1, 1_normal_2, 1_normal_3, 1_normal_4, 1_normal_5, 1_normal_6, 2_corner_1, 2_corner_2, 2_corner_3, 2_corner_4, 2_corner_5, 2_corner_6, 3_hand_1, 3_hand_2, 3_hand_3, 3_hand_4, 3_hand_5, 3_hand_6, sample_01, sample_02, sample_03
Sample sample_01, sample_02, sample_03
ケース名 結果 実行時間 メモリ
0_random_1 AC 1 ms 256 KiB
0_random_2 AC 1 ms 256 KiB
0_random_3 AC 2 ms 384 KiB
0_random_4 AC 2 ms 1024 KiB
0_random_5 AC 3 ms 1024 KiB
0_random_6 AC 2 ms 1024 KiB
0_random_7 AC 2 ms 768 KiB
0_random_8 AC 1 ms 384 KiB
1_normal_1 AC 2 ms 640 KiB
1_normal_2 AC 2 ms 1024 KiB
1_normal_3 AC 2 ms 640 KiB
1_normal_4 AC 2 ms 896 KiB
1_normal_5 AC 2 ms 896 KiB
1_normal_6 AC 2 ms 640 KiB
2_corner_1 AC 2 ms 512 KiB
2_corner_2 AC 1 ms 256 KiB
2_corner_3 AC 2 ms 896 KiB
2_corner_4 AC 1 ms 384 KiB
2_corner_5 AC 1 ms 256 KiB
2_corner_6 AC 2 ms 512 KiB
3_hand_1 AC 2 ms 1024 KiB
3_hand_2 AC 1 ms 256 KiB
3_hand_3 AC 1 ms 256 KiB
3_hand_4 AC 1 ms 256 KiB
3_hand_5 AC 1 ms 256 KiB
3_hand_6 AC 4 ms 1024 KiB
sample_01 AC 1 ms 256 KiB
sample_02 AC 1 ms 256 KiB
sample_03 AC 1 ms 256 KiB