Submission #97598


Source Code Expand

Copy
#include<cstdio> 
#include<cstring> 
#include<vector> 
#include<cmath>
#define REP(i,m) for(int i=0;i<m;++i) 
#define REPN(i,m,in) for(int i=in;i<m;++i) 
#define ALL(t) (t).begin(),(t).end() 
#define pb push_back 
#define mp make_pair 
#define fr first 
#define sc second 
#define dump(x)  cerr << #x << " = " << (x) << endl 
#define prl cerr<<"called:"<< __LINE__<<endl 
using namespace std; 
static const int INF =500000000;  
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;} 
typedef long long int lint; 
typedef pair<int,int> pi; 

int n,k;
int R[1050];

vector<double> dp[2][1050];

void solve(vector<double>& out,vector<double>& a,vector<double>& b,int id){
	int n=a.size();
	out.resize(n*2);
	REP(i,n){
		REP(j,n){
			double dif=R[id+j+n]-R[id+i];
			dif/=400;
			
			double win=1/(1.0+pow(10.0,dif));
			out[i]+=win*a[i]*b[j];
			out[j+n]+=(1-win)*a[i]*b[j];
		}
	}
}

int main(){
	cin>>k;
	n=(1<<k);
	REP(i,n) cin>>R[i];

	int cur=0,nxt=1;
	REP(i,n) dp[cur][i].pb(1.0);

	int m=n;
	while(m>1){
		int m2=(m/2);
		REP(i,m2) dp[nxt][i].clear();
		
		int group=dp[cur][0].size();
		REP(i,m2){
			solve(dp[nxt][i],dp[cur][i*2],dp[cur][i*2+1],i*group*2);
		}

		m/=2;
		swap(cur,nxt);
	}
	REP(i,n) printf("%.8f\n",dp[cur][0][i]);
	
	return 0; 
} 

Submission Info

Submission Time
Task C - トーナメント
User hogloid
Language C++ (G++ 4.6.4)
Score 0
Code Size 1350 Byte
Status CE

Compile Error

./Main.cpp: In function ‘void debug(T, T)’:
./Main.cpp:17:55: error: ‘cerr’ was not declared in this scope
./Main.cpp:17:69: error: ‘cerr’ was not declared in this scope
./Main.cpp:17:75: error: ‘endl’ was not declared in this scope
./Main.cpp: In function ‘int main()’:
./Main.cpp:42:2: error: ‘cin’ was not declared in this scope