Submission #19428833


Source Code Expand

Copy
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<stack>
#include<numeric>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>

using namespace std;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define BIL ((ll)1e9)
#define MOD ((ll)1e9+7)
#define INF (1LL<<60)           //1LL<<63でオーバーフロー
#define inf (1<<29)             //1<<29でオーバーフロー

int main(int argc,char* argv[]){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
    int n;
    cin >> n;
    vector<int> p(n);
    int w=0;
    for(int i=0;i<n;i++){
        cin >> p[i];
        w+=p[i];
    }
    vector<bool> dp(w+1,false);
    dp[0]=true;
    for(int i=0;i<n;i++){
        for(int j=1;j<w+1;j++){
            if(j-p[i]>=0) dp[j]=dp[j-p[i]];
        }
    }
    int ans=0;
    for(int i=0;i<w+1;i++) if(dp[i]) ans++;
    cout << ans << endl;
    return 0;
}

Submission Info

Submission Time
Task A - コンテスト
User tayu0110
Language C++ (GCC 9.2.1)
Score 0
Code Size 1156 Byte
Status WA
Exec Time 8 ms
Memory 3624 KB

Compile Error

./Main.cpp: In function ‘int main(int, char**)’:
./Main.cpp:31:14: warning: unused parameter ‘argc’ [-Wunused-parameter]
   31 | int main(int argc,char* argv[]){
      |          ~~~~^~~~
./Main.cpp:31:25: warning: unused parameter ‘argv’ [-Wunused-parameter]
   31 | int main(int argc,char* argv[]){
      |                   ~~~~~~^~~~~~

Judge Result

Set Name All
Score / Max Score 0 / 2
Status
AC × 3
WA × 2
Set Name Test Cases
All 00, 01, 02, 90, 91
Case Name Status Exec Time Memory
00 WA 8 ms 3540 KB
01 WA 2 ms 3428 KB
02 AC 7 ms 3600 KB
90 AC 2 ms 3624 KB
91 AC 2 ms 3456 KB