Submission #5412710


Source Code Expand

#include<bits/stdc++.h>
using namespace std;

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define SORTG(v) sort(v.begin(),v.end(),greater<>())
#define SORT(v) sort(v.begin(),v.end())
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/3

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<string> Vs;

template<class T> void chmax(T& a, T b) {if(a<b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a>b){a=b;}}
void YesNo(int a) {if(a){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}}
void YESNO(int a) {if(a){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}}
void AorB(int a,string b,string c) {if(a){cout<<b<<endl;}else{cout<<c<<endl;}}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
void start(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);}
signed main(){start();
    int n;
    cin>>n;
    Vi a(n);
    REP(i,0,n) cin>>a[i];
    map<int,int> mp;
    mp[0]=1;
    
    REP(i,0,n){
        auto newmp = mp;
        for(auto x : newmp){
            mp[x.first+a[i]]=1;
        }
        mp[a[i]]=1;
    }
    cout<<mp.size()<<endl;
    return 0;
}

Submission Info

Submission Time
Task A - コンテスト
User hanaoka_
Language C++14 (GCC 5.4.1)
Score 2
Code Size 1350 Byte
Status AC
Exec Time 29 ms
Memory 896 KB

Judge Result

Set Name All
Score / Max Score 2 / 2
Status
AC × 5
Set Name Test Cases
All 00, 01, 02, 90, 91
Case Name Status Exec Time Memory
00 AC 1 ms 256 KB
01 AC 8 ms 640 KB
02 AC 29 ms 896 KB
90 AC 1 ms 256 KB
91 AC 1 ms 256 KB