Submission #1692015


Source Code Expand

#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,0,-1,1,0,0};
const ld PI=abs(acos(-1));
int s=0,a[5];
bool li[510]={},used[5]={};

int dfs(int now,int d){
	if(used[now]) return 0;
	if(d==3){li[s]=true; return 0;}
	used[now]=true;
	
	REP(i,0,5){
		s+=a[i];
		dfs(i,d+1);
		s-=a[i];
	}
	
	used[now]=false;
	return 0;
}
int main(){
	REP(i,0,5) cin >> a[i];
	
	REP(i,0,5){
		s=a[i];
		dfs(i,1);
	}
	
	int c=0;
	RREP(i,510,0){
		if(li[i]) c++;
		if(c==3){cout << i << endl; break;}
	}
	
	return 0;
}

Submission Info

Submission Time
Task C - 数を3つ選ぶマン
User ecasdqina
Language C++14 (GCC 5.4.1)
Score 100
Code Size 718 Byte
Status AC
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 2
AC × 15
Set Name Test Cases
Sample example_0.txt, example_1.txt
All example_0.txt, example_1.txt, handmade_0.txt, handmade_1.txt, handmade_2.txt, handmade_3.txt, handmade_4.txt, handmade_5.txt, random_0.txt, random_1.txt, random_2.txt, random_3.txt, random_4.txt, example_0.txt, example_1.txt
Case Name Status Exec Time Memory
example_0.txt AC 1 ms 256 KB
example_1.txt AC 1 ms 256 KB
handmade_0.txt AC 1 ms 256 KB
handmade_1.txt AC 1 ms 256 KB
handmade_2.txt AC 1 ms 256 KB
handmade_3.txt AC 1 ms 256 KB
handmade_4.txt AC 1 ms 256 KB
handmade_5.txt AC 1 ms 256 KB
random_0.txt AC 1 ms 256 KB
random_1.txt AC 1 ms 256 KB
random_2.txt AC 1 ms 256 KB
random_3.txt AC 1 ms 256 KB
random_4.txt AC 1 ms 256 KB