Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
57516 | Ender | S1 | C++ | 运行出错 | 30 | 133 MS | 484 KB | 1208 | 2022-10-04 11:32:52 |
#include <iostream> #include <algorithm> #include <ctime> #include <cstdio> using namespace std; struct foolish { long long x,id; }temp[11]; int a[11][2],d[11],n; long long ans[11]; const long long four[11] = {1,4,16,64,256,1024,4096,16384,65536,262144,1048576}; bool cmp(const foolish& x,const foolish& y) { return x.x > y.x; } void solve() { for(int i(1);i <= n;i++) { if(d[i] == 1) temp[i].x = 0; else if(d[i] == 2) temp[i].x = a[i][1]; else if(d[i] == 3) temp[i].x = a[i][0]; else if(d[i] == 4) temp[i].x = a[i][0] + a[i][1]; temp[i].id = i; } sort(temp + 1,temp + n + 1,cmp); long long lst = 1; for(int i(1);i <= n;i++) { if(temp[lst].x != temp[i].x) lst = i; ans[temp[i].id]+=(lst); } } void DFS(int k) { if(k == n + 1) { solve(); return; } for(int i(1);i <= 4;i++) { d[k] = i; DFS(k + 1); } return; } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int i; cin>>n; for(i = 1;i <= n;i++) cin>>a[i][0]>>a[i][1]; DFS(1); for(i = 1;i <= n;i++) { cout<<(long double)ans[i] / four[n]; if(ans[i] % four[n] == 0) cout<<".0"; cout<<endl; } return 0; }