Submission #4568199


Source Code Expand

Copy
#include <iostream>
#include <vector>
#include <bitset>
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i = 0; i < N; ++i) cin >> A[i];
  bitset<4000001> bit = 0;
  bit[0] = 1;
  int s = 0;
  for(int i = 0; i < N; ++i){
    bit |= (bit<<A[i]);
    s += A[i];
  }
  for(int i = (s+1)/2; i <= s; ++i){
    if(bit[i]){
      cout << i << endl;
      return 0;
    }
  }
}

Submission Info

Submission Time
Task C - Median Sum
User TAB
Language C++14 (GCC 5.4.1)
Score 700
Code Size 430 Byte
Status
Exec Time 418 ms
Memory 1664 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt
All 700 / 700 sample_01.txt, sample_02.txt, sample_01.txt, sample_02.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt, subtask_1_16.txt, subtask_1_17.txt, subtask_1_18.txt, subtask_1_19.txt, subtask_1_20.txt, subtask_1_21.txt, subtask_1_22.txt, subtask_1_23.txt, subtask_1_24.txt, subtask_1_25.txt, subtask_1_26.txt, subtask_1_27.txt, subtask_1_28.txt, subtask_1_29.txt, subtask_1_30.txt, subtask_1_31.txt, subtask_1_32.txt, subtask_1_33.txt, subtask_1_34.txt, subtask_1_35.txt, subtask_1_36.txt, subtask_1_37.txt, subtask_1_38.txt
Case Name Status Exec Time Memory
sample_01.txt 3 ms 1664 KB
sample_02.txt 2 ms 1664 KB
subtask_1_01.txt 2 ms 1664 KB
subtask_1_02.txt 2 ms 1664 KB
subtask_1_03.txt 2 ms 1664 KB
subtask_1_04.txt 417 ms 1664 KB
subtask_1_05.txt 418 ms 1664 KB
subtask_1_06.txt 417 ms 1664 KB
subtask_1_07.txt 416 ms 1664 KB
subtask_1_08.txt 416 ms 1664 KB
subtask_1_09.txt 416 ms 1664 KB
subtask_1_10.txt 417 ms 1664 KB
subtask_1_11.txt 418 ms 1664 KB
subtask_1_12.txt 417 ms 1664 KB
subtask_1_13.txt 417 ms 1664 KB
subtask_1_14.txt 417 ms 1664 KB
subtask_1_15.txt 402 ms 1664 KB
subtask_1_16.txt 410 ms 1664 KB
subtask_1_17.txt 413 ms 1664 KB
subtask_1_18.txt 409 ms 1664 KB
subtask_1_19.txt 412 ms 1664 KB
subtask_1_20.txt 416 ms 1664 KB
subtask_1_21.txt 418 ms 1664 KB
subtask_1_22.txt 417 ms 1664 KB
subtask_1_23.txt 418 ms 1664 KB
subtask_1_24.txt 401 ms 1664 KB
subtask_1_25.txt 2 ms 1664 KB
subtask_1_26.txt 3 ms 1664 KB
subtask_1_27.txt 3 ms 1664 KB
subtask_1_28.txt 3 ms 1664 KB
subtask_1_29.txt 4 ms 1664 KB
subtask_1_30.txt 4 ms 1664 KB
subtask_1_31.txt 5 ms 1664 KB
subtask_1_32.txt 6 ms 1664 KB
subtask_1_33.txt 12 ms 1664 KB
subtask_1_34.txt 23 ms 1664 KB
subtask_1_35.txt 23 ms 1664 KB
subtask_1_36.txt 418 ms 1664 KB
subtask_1_37.txt 409 ms 1664 KB
subtask_1_38.txt 418 ms 1664 KB