Submission #5865968


Source Code Expand

#include <iostream>
#include <cstdio>
#include <set>
using namespace std;

int main(int argc, char *argv[])
{
    int n;
    int p;
    set<int> s;
    s.insert(0);
    cin>>n;
    for (int i = 0; i < n; ++i) {
        scanf("%d", &p);
        set<int> newset;
        for (auto c : s) {
            newset.insert(c + p);
        }
        for (auto c: newset) {
            s.insert(c);
        }
    }
    printf("%d", s.size());
    return 0;
}

Submission Info

Submission Time
Task A - コンテスト
User vintersnow
Language C++14 (GCC 5.4.1)
Score 0
Code Size 473 Byte
Status WA
Exec Time 42 ms
Memory 896 KB

Compile Error

./Main.cpp: In function ‘int main(int, char**)’:
./Main.cpp:23:26: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘std::set<int>::size_type {aka long unsigned int}’ [-Wformat=]
     printf("%d", s.size());
                          ^
./Main.cpp:14:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &p);
                        ^

Judge Result

Set Name All
Score / Max Score 0 / 2
Status
WA × 5
Set Name Test Cases
All 00, 01, 02, 90, 91
Case Name Status Exec Time Memory
00 WA 1 ms 256 KB
01 WA 12 ms 512 KB
02 WA 42 ms 896 KB
90 WA 1 ms 256 KB
91 WA 1 ms 256 KB