Submission #241199


Source Code Expand

Copy
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
#include <memory>
#include <time.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXIST2(s,e) (find(ALL(s),(e))!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
const double EPS = 1e-9;
const double PI  = acos(-1.0);

int main(){
	int n;
	cin>>n;
	vi t(n);
	REP(i,n){
		cin>>t[i];
	}
	int ans=INT_MAX;
	REP(mask,1<<n){
		vi tt(2);
		REP(i,n){
			tt[(mask>>i)&1]+=t[i];
		}
		ans=min(ans,max(tt[0],tt[1]));
	}
	cout<<ans<<endl;
}

Submission Info

Submission Time
Task A - 高橋君とお肉
User SSJJ
Language C++ (G++ 4.6.4)
Score 100
Code Size 1296 Byte
Status
Exec Time 30 ms
Memory 920 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 subtask0-sample-01.txt, subtask0-sample-02.txt, subtask0-sample-03.txt
All 100 / 100 subtask0-sample-01.txt, subtask0-sample-02.txt, subtask0-sample-03.txt, subtask1-01.txt, subtask1-02.txt, subtask1-03.txt, subtask1-04.txt, subtask1-05.txt, subtask1-06.txt, subtask1-07.txt, subtask1-08.txt, subtask1-09.txt, subtask1-10.txt, subtask1-11.txt, subtask1-12.txt, subtask1-13.txt, subtask1-14.txt, subtask1-15.txt, subtask1-16.txt
Case Name Status Exec Time Memory
subtask0-sample-01.txt 25 ms 920 KB
subtask0-sample-02.txt 28 ms 880 KB
subtask0-sample-03.txt 28 ms 804 KB
subtask1-01.txt 25 ms 796 KB
subtask1-02.txt 26 ms 864 KB
subtask1-03.txt 25 ms 920 KB
subtask1-04.txt 24 ms 916 KB
subtask1-05.txt 26 ms 792 KB
subtask1-06.txt 30 ms 856 KB
subtask1-07.txt 27 ms 852 KB
subtask1-08.txt 28 ms 856 KB
subtask1-09.txt 27 ms 876 KB
subtask1-10.txt 26 ms 748 KB
subtask1-11.txt 26 ms 872 KB
subtask1-12.txt 25 ms 796 KB
subtask1-13.txt 27 ms 860 KB
subtask1-14.txt 27 ms 796 KB
subtask1-15.txt 27 ms 920 KB
subtask1-16.txt 24 ms 860 KB