Submission #2549016
Source Code Expand
#include <bits/stdc++.h>
#define Rep(i,n) for(int i=0;i<n;i++)
#define RepU(i,bottom,ceiling) for(int (i)=(bottom);(i)<=(ceiling);(i)++)
#define RepD(i,ceiling,bottom) for(int (i)=(ceiling);(i)>=(bottom);(i)--)
#define vi vector<int>
#define pub(v,el) v.push_back(el)
#define pob(v) v.pop_back
#define ci(a) cin>>a
#define lco(a) cout<<a<<endl
#define co(a) cout<<a
#define len(v) (v.end()-v.begin())
#define vco(v) Rep(i,v.end()-v.begin()){ co(*(i+v.begin())); co(' '); } co('\n')
#define pii pair<int,int>
#define fir first
#define sec second
using namespace std;
typedef long long ll;
const int dir[8][2]={{0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1}};
const int Inf=2e9+1e8;
template <typename T,typename U>
pair<T,U> operator+(const pair<T,U> & l,const pair<T,U> & r) {
return {l.first+r.first,l.second+r.second};
}
template <typename T,typename U>
pair<T,U> operator-(const pair<T,U> & l,const pair<T,U> & r) {
return {l.first-r.first,l.second-r.second};
}
//
double cal(int p,int q,vi arr){
return 1/(1+pow(10,(arr[q]-arr[p])/400));
}
int power2(int n,int e){
int p=n/pow(2,e);
if(n==pow(2,e)*p) return n;
return (p+1)*pow(2,e);
}
int main(){
double win[1025][11];
int k,num=1;
ci(k);
vi rate(pow(2,k));
Rep(i,pow(2,k)){ ci(rate[i]); }
for(int r=0;r<=k;r++){
if(!r){
Rep(i,pow(2,k)) win[i+1][0]=1;
continue;
}
Rep(i,pow(2,k)){
if(power2(i+1,r-1)%2){
for(int s=power2(i+1,r-1)+1;s<=pow(2,r-1)+power2(i+1,r-1);s++){
win[i+1][r]+=win[s][r-1]*cal(i,s-1,rate);
}
}
else{
for(int s=power2(1+i,r-1)-pow(2,r-1);s>power2(1+i,r-1)-2*pow(2,r-1);s--){
win[i+1][r]+=win[s][r-1]*cal(i,s-1,rate);
}
}
win[i+1][r]*=win[i+1][r-1];
if(r==k) printf("%lf\n",win[1+i][r]);
}
}
return 0;
}
Submission Info
Submission Time |
|
Task |
C - トーナメント |
User |
amt |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
2029 Byte |
Status |
WA |
Exec Time |
512 ms |
Memory |
384 KB |
Judge Result
Set Name |
All |
Score / Max Score |
0 / 4 |
Status |
|
Set Name |
Test Cases |
All |
00, 01, 02, 03, 90, 91 |
Case Name |
Status |
Exec Time |
Memory |
00 |
WA |
512 ms |
384 KB |
01 |
WA |
471 ms |
384 KB |
02 |
WA |
467 ms |
384 KB |
03 |
WA |
468 ms |
384 KB |
90 |
AC |
1 ms |
256 KB |
91 |
WA |
1 ms |
256 KB |