CODE FESTIVAL 2016 Exhibition

Submission #1387724

Source codeソースコード

    #include<bits/stdc++.h>
    using namespace std;
    const int MAXN = 20000;
    int N;
    long long int A[MAXN];
    int arr[MAXN];
     
    int solve()
    {
        std::bitset<MAXN*10> b(1);
        for(int i=0; i<N; ++i)
            b |= (b << arr[i]) | ( b >> ((MAXN*10) - arr[i]));
        for(int i=MAXN*10-1; i>=0; --i)
            if(b[i])
                return i/MAXN;
        
    }
     
    int main()
    {
        scanf("%d", &N);
        for(int i=0; i<N; ++i)
            scanf("%lld", A+i);
        int ans = 0;
        for(int x=1; x<18; ++x)
        {
            long long p10=1;
            for(int j=0; j<x; ++j) p10 *= 10;
            for(int i=0; i<N; ++i)
            {
                if(p10 < 10 * MAXN)
                    arr[i] = (A[i]%p10)*((10 * MAXN)/p10);
                else
                    arr[i] = (A[i]%p10)/(p10/(10 * MAXN));
            }
            ans += solve();
        }
        printf("%d\n", ans);
    }

Submission

Task問題 B - Exact Payment
User nameユーザ名 HYEA
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 TLE
Score得点 0
Source lengthソースコード長 1003 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Compiler messageコンパイルメッセージ

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

Test case

Set

Set name Score得点 / Max score Cases
sample - sample-01.txt,sample-02.txt
All 0 / 1500 sample-01.txt,sample-02.txt,01-01.txt,01-02.txt,01-03.txt,01-04.txt,01-05.txt,01-06.txt,01-07.txt,01-08.txt,01-09.txt,01-10.txt,01-11.txt,01-12.txt,01-13.txt,01-14.txt,01-15.txt,01-16.txt,01-17.txt,01-18.txt,01-19.txt,01-20.txt,01-21.txt,01-22.txt,01-23.txt,01-24.txt,01-25.txt,01-26.txt,01-27.txt,01-28.txt,01-29.txt,01-30.txt,01-31.txt,01-32.txt,01-33.txt,01-34.txt,01-35.txt,01-36.txt,01-37.txt,01-38.txt,01-39.txt,01-40.txt,01-41.txt,01-42.txt,01-43.txt,01-44.txt,01-45.txt,01-46.txt,01-47.txt,01-48.txt,01-49.txt,01-50.txt,01-51.txt,01-52.txt,01-53.txt,01-54.txt,01-55.txt,01-56.txt,01-57.txt,01-58.txt,01-59.txt,01-60.txt,01-61.txt,01-62.txt,01-63.txt,01-64.txt,01-65.txt,01-66.txt,01-67.txt,01-68.txt,01-69.txt,01-70.txt,01-71.txt,01-72.txt,01-73.txt,01-74.txt,01-75.txt,01-76.txt,01-77.txt,01-78.txt,01-79.txt,01-80.txt,01-81.txt,01-82.txt,01-83.txt,01-84.txt,01-85.txt,01-86.txt,01-87.txt,01-88.txt,01-89.txt,01-90.txt,01-91.txt,01-92.txt,01-93.txt,01-94.txt,01-95.txt,01-96.txt,01-97.txt,01-98.txt,sample-01.txt,sample-02.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
01-01.txt AC 4 ms 384 KB
01-02.txt AC 4 ms 384 KB
01-03.txt AC 3 ms 384 KB
01-04.txt AC 3 ms 384 KB
01-05.txt AC 3 ms 384 KB
01-06.txt TLE
01-07.txt TLE
01-08.txt TLE
01-09.txt TLE
01-10.txt TLE
01-11.txt TLE
01-12.txt TLE
01-13.txt TLE
01-14.txt TLE
01-15.txt TLE
01-16.txt TLE
01-17.txt TLE
01-18.txt TLE
01-19.txt TLE
01-20.txt TLE
01-21.txt TLE
01-22.txt TLE
01-23.txt TLE
01-24.txt TLE
01-25.txt TLE
01-26.txt TLE
01-27.txt TLE
01-28.txt TLE
01-29.txt TLE
01-30.txt TLE
01-31.txt TLE
01-32.txt TLE
01-33.txt TLE
01-34.txt TLE
01-35.txt TLE
01-36.txt TLE
01-37.txt TLE
01-38.txt TLE
01-39.txt TLE
01-40.txt TLE
01-41.txt TLE
01-42.txt TLE
01-43.txt TLE
01-44.txt TLE
01-45.txt TLE
01-46.txt TLE
01-47.txt TLE
01-48.txt TLE
01-49.txt TLE
01-50.txt TLE
01-51.txt TLE
01-52.txt TLE
01-53.txt TLE
01-54.txt TLE
01-55.txt TLE
01-56.txt TLE
01-57.txt TLE
01-58.txt TLE
01-59.txt TLE
01-60.txt TLE
01-61.txt TLE
01-62.txt TLE
01-63.txt TLE
01-64.txt TLE
01-65.txt TLE
01-66.txt TLE
01-67.txt TLE
01-68.txt TLE
01-69.txt TLE
01-70.txt TLE
01-71.txt TLE
01-72.txt TLE
01-73.txt TLE
01-74.txt TLE
01-75.txt TLE
01-76.txt TLE
01-77.txt TLE
01-78.txt TLE
01-79.txt TLE
01-80.txt TLE
01-81.txt TLE
01-82.txt TLE
01-83.txt TLE
01-84.txt TLE
01-85.txt TLE
01-86.txt TLE
01-87.txt TLE
01-88.txt TLE
01-89.txt TLE
01-90.txt TLE
01-91.txt TLE
01-92.txt TLE
01-93.txt TLE
01-94.txt TLE
01-95.txt TLE
01-96.txt TLE
01-97.txt TLE
01-98.txt TLE
sample-01.txt AC 5 ms 384 KB
sample-02.txt AC 4 ms 384 KB