QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#717066 | #6819. Largest Unique Wins | Jiangnan01 | WA | 0ms | 4000kb | C++20 | 3.7kb | 2024-11-06 16:46:21 | 2024-11-06 16:46:21 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define int long long
#define itn int
#define endl '\n'
#define Endl endl
#define ednl endl
#define al(a) (a).begin(),(a).end()
#define all(a) (a).begin()+1,(a).end()
#define debug(x) {cerr<<"ss:"<<x<<endl;}
#define qdebug(x) {cerr<<"ss:";for(auto i:x)cout<<i<<" ";cout<<endl;}
#define lowbit(x) (x&-x)
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define fs first
#define sc second
constexpr long long maxlonglong = 9223372036854775807; //9e18
constexpr int maxint = 2147483647; //2e9
constexpr int INF = 0x7f7f7f7f7f7f7f7f; //2139062143^2
// constexpr int mod = 1e9 + 7;
constexpr int mod = 998244353;
constexpr int hs = 0x1F351F35; // good hash number.
const double pi = acos(-1.0);
const double eps = 1e-15;
vector<int> input(int n){vector<int> a(n+1);for(int i=1;i<=n;i++)cin>>a[i];return a;}
mt19937_64 rnd(time(0));
constexpr int N=1231564;
struct tree_array{ //树状数组 0号位置始终为0;
int n;vector<int> array;
tree_array(int n):array(n+1),n(n){}
void add(int pos,int x){ //单点修改 //O(logn)
for(;pos<=n;pos+=lowbit(pos))
array[pos]+=x; //维护信息 要根据维护的信息特点
}
int ask(int pos){ //获取0……pos的信息
int ans=0; //O(logn)
for(;pos;pos-=lowbit(pos))
ans+=array[pos]; //要根据维护信息修改
return ans;
}
};
inline void solve(){
double n,m;cin>>n>>m;
if(n==2)
{
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
if(j==m)cout<<1<<"\n";
else cout<<0<<" ";
}
}
}
else if(n>=m*2-1 || n>=m && n<m*2-2)
{
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
if(i%(int)m==j%(int)m)cout<<1<<" ";
else cout<<0<<" ";
}
cout<<"\n";
}
}
else if(n==2*m-2)
{
for(int i=1;i<=n;i++)
{
if(i==m-1 || i==m)
{
for(int j=1;j<=m;j++)
{
if(j==m-1 || j==m)
{
cout<<0.5<<" ";
}
else cout<<0<<' ';
}
}
else
{
for(int j=1;j<=m;j++)
{
if(i%(int)m==j%(int)m)cout<<1<<' ';
else cout<<0<<" ";
}
}
cout<<"\n";
}
}
else
{
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
if(i==m+1-j)cout<<1<<" ";
else cout<<0<<" ";
}
cout<<"\n";
}
}
}
signed main()
{
//freopen("E:\\work_tool\\document\\data\\input.in", "r", stdin);
//freopen("E:\\work_tool\\document\\data\\output.out", "w", stdout);
ios::sync_with_stdio(false);
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0); //关闭同步 如果使用 则不要使用<cstdio>
cout << fixed << setprecision(10);
int T=1;
//cin>>T;
while(T--){
solve();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3964kb
input:
2 2
output:
0 1 0 1
result:
ok ok 0.0000 0.0000
Test #2:
score: 0
Accepted
time: 0ms
memory: 3964kb
input:
3 3
output:
1 0 0 0 1 0 0 0 1
result:
ok ok -1.0000 -1.0000 1.0000
Test #3:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
3 2
output:
1 0 0 1 1 0
result:
ok ok -1.0000 1.0000 -1.0000
Test #4:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
12 12
output:
1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1
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: 3780kb
input:
12 11
output:
1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0
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 #6:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
11 12
output:
0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
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: 3748kb
input:
12 3
output:
1 0 0 0 1 0 0 0 1 1 0 0 0 1 0 0 0 1 1 0 0 0 1 0 0 0 1 1 0 0 0 1 0 0 0 1
result:
ok ok 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
Test #8:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
2 12
output:
0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1
result:
ok ok 0.0000 0.0000
Test #9:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
4 12
output:
0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0
result:
ok ok 1.0000 -1.0000 -1.0000 -1.0000
Test #10:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
12 4
output:
1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
result:
ok ok 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
Test #11:
score: 0
Accepted
time: 0ms
memory: 3896kb
input:
3 12
output:
0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0
result:
ok ok 1.0000 -1.0000 -1.0000
Test #12:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
4 5
output:
0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0
result:
ok ok 1.0000 -1.0000 -1.0000 -1.0000
Test #13:
score: 0
Accepted
time: 0ms
memory: 4000kb
input:
4 9
output:
0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0
result:
ok ok 1.0000 -1.0000 -1.0000 -1.0000
Test #14:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
9 5
output:
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0
result:
ok ok -1.0000 -1.0000 -1.0000 -1.0000 1.0000 -1.0000 -1.0000 -1.0000 -1.0000
Test #15:
score: 0
Accepted
time: 0ms
memory: 3972kb
input:
10 5
output:
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1
result:
ok ok 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
Test #16:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
11 5
output:
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0
result:
ok ok 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
Test #17:
score: 0
Accepted
time: 0ms
memory: 3776kb
input:
11 6
output:
1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0
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 #18:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
12 6
output:
1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1
result:
ok ok 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
Test #19:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
12 5
output:
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0
result:
ok ok 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
Test #20:
score: -100
Wrong Answer
time: 0ms
memory: 3884kb
input:
12 7
output:
1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0.5000000000 0.5000000000 0 0 0 0 0 0.5000000000 0.5000000000 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0
result:
wrong answer 6's strategy is not optimal, current = 0.0000000000, better (7) = 0.5000000000