Contest Duration: - (local time) (120 minutes) Back to Home

Submission #169133

Source Code Expand

Copy
```#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#define MINF 0xc0c0c0c0

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;

static const double EPS = 1e-8;

int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

int main(){
int N;
map<string,int> vote;
int max_v = 0;
vector<int> coins;
while(~scanf("%d",&N)){
for(int i=0;i<N;i++){
int coin;
scanf("%d",&coin);
coins.push_back(coin);
}
sort(coins.begin(),coins.end());

double total_patterns = 0.0;
double total_count = 0.0;
do{
int surface[coins.size()];
fill(surface,surface+coins.size(),1);

for(int i=0;i<coins.size();i++){
for(int j=i+1;j<coins.size();j++){
if(coins[j] % coins[i] == 0){
surface[j] = (surface[j] == 1 ? 0 : 1);
}
}
}
total_count += (double)count(surface,surface+coins.size(),1);
total_patterns += 1.0;
}while(next_permutation(coins.begin(),coins.end()));

printf("%.7lf\n",total_count / total_patterns);
}
}```

#### Submission Info

Submission Time 2014-05-10 21:23:42+0900 C - コイン okaoka C++ (G++ 4.6.4) 99 1426 Byte TLE 2035 ms 936 KB

#### Compile Error

```./Main.cpp: In function ‘int main()’:
./Main.cpp:43:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
```

#### Judge Result

Score / Max Score 0 / 0 99 / 99 0 / 1
Status
 AC × 3
 AC × 20
 AC × 22 TLE × 18
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
sample_01.txt AC 21 ms 924 KB
sample_02.txt AC 20 ms 928 KB
sample_03.txt AC 23 ms 776 KB
subtask1_01.txt AC 19 ms 796 KB
subtask1_02.txt AC 22 ms 800 KB
subtask1_03.txt AC 20 ms 796 KB
subtask1_04.txt AC 32 ms 804 KB
subtask1_05.txt AC 31 ms 800 KB
subtask1_06.txt AC 21 ms 924 KB
subtask1_07.txt AC 29 ms 800 KB
subtask1_08.txt AC 23 ms 752 KB
subtask1_09.txt AC 21 ms 928 KB
subtask1_10.txt AC 32 ms 808 KB
subtask1_11.txt AC 21 ms 924 KB
subtask1_12.txt AC 29 ms 920 KB
subtask1_13.txt AC 21 ms 796 KB
subtask1_14.txt AC 21 ms 920 KB
subtask1_15.txt AC 28 ms 808 KB
subtask1_16.txt AC 30 ms 808 KB
subtask1_17.txt AC 32 ms 800 KB
subtask1_18.txt AC 24 ms 932 KB
subtask1_19.txt AC 33 ms 812 KB
subtask1_20.txt AC 35 ms 808 KB
subtask2_01.txt AC 1299 ms 804 KB
subtask2_02.txt AC 21 ms 928 KB
subtask2_03.txt TLE 2031 ms 880 KB
subtask2_04.txt TLE 2029 ms 876 KB
subtask2_05.txt TLE 2030 ms 800 KB
subtask2_06.txt TLE 2029 ms 796 KB
subtask2_07.txt TLE 2030 ms 884 KB
subtask2_08.txt TLE 2029 ms 796 KB
subtask2_09.txt TLE 2030 ms 808 KB
subtask2_10.txt TLE 2029 ms 808 KB
subtask2_11.txt TLE 2029 ms 812 KB
subtask2_12.txt TLE 2035 ms 808 KB
subtask2_13.txt TLE 2032 ms 936 KB
subtask2_14.txt TLE 2029 ms 804 KB
subtask2_15.txt TLE 2029 ms 884 KB
subtask2_16.txt TLE 2030 ms 808 KB
subtask2_17.txt TLE 2029 ms 932 KB
subtask2_18.txt TLE 2030 ms 884 KB
subtask2_19.txt TLE 2028 ms 808 KB
subtask2_20.txt TLE 2029 ms 808 KB