QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#668725 | #6819. Largest Unique Wins | MENDAX | WA | 0ms | 4076kb | C++20 | 1.2kb | 2024-10-23 15:41:19 | 2024-10-23 15:41:30 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define x first
#define y second
#define endl '\n'
using namespace std;
const int N=1e6+10,INF=1e14,mod=1e9+7,M=2e5+10;
const double eps = 1e-8;
typedef pair<int,int> PII;
typedef pair<PII,int> PIII;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int qmi(int a,int k){int res=1;while(k){if(k&1) res=res*a%mod;a=a*a%mod;k>>=1;}return res;}
int exgcd(int a,int b,int &x,int &y){
if(!b){
x=1,y=0;
return a;
}
int d=exgcd(b,a%b,y,x);
y-=a/b*x;
return d;
}
void slove(){
int n,m;cin>>n>>m;
vector<vector<double>>val(n+1,vector<double>(m+1,0));
if(n==2){
val[1][m]=1;
val[2][m]=1;
}else if(n<=m){
int no=m;
for(int i=1;i<=n;i++) val[i][no]=1,no--;
}
else {
for(int i=1;i<=m;i++) val[i][i]=1;
for(int i=m+1;i<=n;i++){
double pp=1;
for(int j=1;j<=m;j++){
if(j==m) val[i][j]=pp;
else {
val[i][j]=1.0/m;
pp-=val[i][j];
}
}
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
printf("%.16lf",val[i][j]);
if(j!=m) cout<<" ";
else cout<<endl;
}
}
}
signed main(){
// ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
int T=1;
// cin>>T;
while(T--) slove();
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3840kb
input:
2 2
output:
0.0000000000000000 1.0000000000000000 0.0000000000000000 1.0000000000000000
result:
ok ok 0.0000 0.0000
Test #2:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
3 3
output:
0.0000000000000000 0.0000000000000000 1.0000000000000000 0.0000000000000000 1.0000000000000000 0.0000000000000000 1.0000000000000000 0.0000000000000000 0.0000000000000000
result:
ok ok 1.0000 -1.0000 -1.0000
Test #3:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
3 2
output:
1.0000000000000000 0.0000000000000000 0.0000000000000000 1.0000000000000000 0.5000000000000000 0.5000000000000000
result:
ok ok 0.0000 0.0000 -1.0000
Test #4:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
12 12
output:
0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 1.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000...
result:
ok ok 1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000
Test #5:
score: 0
Accepted
time: 0ms
memory: 3944kb
input:
12 11
output:
1.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 1.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000...
result:
ok ok -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -0.8182 0.8182 -1.0000
Test #6:
score: 0
Accepted
time: 0ms
memory: 4076kb
input:
11 12
output:
0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 1.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000...
result:
ok ok 1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000
Test #7:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
12 3
output:
1.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 1.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 1.0000000000000000 0.3333333333333333 0.3333333333333333 0.3333333333333334 0.3333333333333333 0.3333333333333333 0.3333333333333334 0.3333333333333...
result:
ok ok -0.0261 -0.0260 -0.0259 -0.0779 -0.0779 -0.0779 -0.0779 -0.0779 -0.0779 -0.0779 -0.0779 -0.0779
Test #8:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
2 12
output:
0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 1.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000...
result:
ok ok 0.0000 0.0000
Test #9:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
4 12
output:
0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 1.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000...
result:
ok ok 1.0000 -1.0000 -1.0000 -1.0000
Test #10:
score: 0
Accepted
time: 0ms
memory: 4076kb
input:
12 4
output:
1.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 1.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 1.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 1.0000000000000...
result:
ok ok -0.2002 -0.1924 -0.1847 -0.1768 -0.3771 -0.3771 -0.3771 -0.3771 -0.3771 -0.3771 -0.3771 -0.3771
Test #11:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
3 12
output:
0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 1.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000...
result:
ok ok 1.0000 -1.0000 -1.0000
Test #12:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
4 5
output:
0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 1.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 1.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 1.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000...
result:
ok ok 1.0000 -1.0000 -1.0000 -1.0000
Test #13:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
4 9
output:
0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 1.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000...
result:
ok ok 1.0000 -1.0000 -1.0000 -1.0000
Test #14:
score: -100
Wrong Answer
time: 0ms
memory: 3940kb
input:
9 5
output:
1.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 1.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 1.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000...
result:
wrong answer 1's strategy is not optimal, current = -0.9232000000, better (2) = -0.9040000000