Contest Duration: ~ (local time)

Submission #2099469

Source Code Expand

Copy
```#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main(void) {
int i,j;
int n;
cin>>n;
vi num(13,0);
rep(i,n){
int d;
cin>>d;
num[d]++;
}

rep(i,13)if(num[i]>=3){
cout<<0<<endl;
return 0;
}

vi t(25,0);
if(num[0]){
cout<<0<<endl;
return 0;
}

rep(i,13)if(num[i]==2){
t[i]++;
t[24-i]++;
}

t[0]++;
int ans=0;
int bit;
rep(bit,1<<13){
vector<bool> tmp(24,false);
rep(i,13)if(num[i]==1){
if((bit&(1<<i))!=0)tmp[i]=true;
else tmp[24-i]=true;
}
int m=INF;
rep(i,24)rep(j,24)if(i!=j)
if((t[i]||tmp[i]) && (t[j]||tmp[j])){
int d=abs(i-j);
m=min(m, min(d,24-d));
}
ans=max(ans,m);
}
cout<<ans<<endl;
}
```

#### Submission Info

Submission Time 2018-02-16 23:59:58+0900 C - Time Gap rika0384 C++14 (GCC 5.4.1) 500 1390 Byte AC 15 ms 256 KB

#### Test Cases

Set Name Score / Max Score Test Cases
sample 0 / 0 sample-01.txt, sample-02.txt, sample-03.txt
All 500 / 500 sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, 01-25.txt, 01-26.txt, 01-27.txt, 01-28.txt, 01-29.txt, 01-30.txt, 01-31.txt, 01-32.txt, 01-33.txt, 01-34.txt, 01-35.txt, 01-36.txt, 01-37.txt, 01-38.txt, 01-39.txt, 01-40.txt, 01-41.txt, 01-42.txt, 01-43.txt, sample-01.txt, sample-02.txt, sample-03.txt
Case Name Status Exec Time Memory
01-01.txt 11 ms 256 KB
01-02.txt 11 ms 256 KB
01-03.txt 11 ms 256 KB
01-04.txt 1 ms 256 KB
01-05.txt 1 ms 256 KB
01-06.txt 1 ms 256 KB
01-07.txt 1 ms 256 KB
01-08.txt 12 ms 256 KB
01-09.txt 1 ms 256 KB
01-10.txt 13 ms 256 KB
01-11.txt 1 ms 256 KB
01-12.txt 1 ms 256 KB
01-13.txt 1 ms 256 KB
01-14.txt 1 ms 256 KB
01-15.txt 1 ms 256 KB
01-16.txt 1 ms 256 KB
01-17.txt 11 ms 256 KB
01-18.txt 11 ms 256 KB
01-19.txt 10 ms 256 KB
01-20.txt 10 ms 256 KB
01-21.txt 11 ms 256 KB
01-22.txt 11 ms 256 KB
01-23.txt 10 ms 256 KB
01-24.txt 11 ms 256 KB
01-25.txt 11 ms 256 KB
01-26.txt 11 ms 256 KB
01-27.txt 10 ms 256 KB
01-28.txt 11 ms 256 KB
01-29.txt 11 ms 256 KB
01-30.txt 11 ms 256 KB
01-31.txt 12 ms 256 KB
01-32.txt 12 ms 256 KB
01-33.txt 12 ms 256 KB
01-34.txt 14 ms 256 KB
01-35.txt 15 ms 256 KB
01-36.txt 11 ms 256 KB
01-37.txt 13 ms 256 KB
01-38.txt 12 ms 256 KB
01-39.txt 15 ms 256 KB
01-40.txt 1 ms 256 KB
01-41.txt 1 ms 256 KB
01-42.txt 1 ms 256 KB
01-43.txt 10 ms 256 KB
sample-01.txt 10 ms 256 KB
sample-02.txt 10 ms 256 KB
sample-03.txt 1 ms 256 KB