QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#619117 | #3020. Rainbow Graph | ucup-team4153# | WA | 1ms | 3820kb | C++20 | 1.7kb | 2024-10-07 13:06:39 | 2024-10-07 13:06:40 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;using ld=long double;using ll=long long;
using pll=pair<ll,ll>;
const int M=998244353,inv2=(M+1)/2,P=20;const ld eps=1e-8,pi=acos(-1);
ll poww(ll bs,ll x){ll res=1;for(;x;x>>=1,(bs*=bs)%=M)if(x&1)(res*=bs)%=M;return res;}
ll invv(ll bs){return poww(bs,M-2);}
struct S
{
int n,k,B;vector<int>a,res;
vector<int>Cl,Cc;int l,c;
void ini(string&A,string&B)
{
l=A.length();c=B.length();int l2=0,c2=0;vector<int>vl,vc;
Cl.resize(l,c&1),Cc.resize(c,l&1);
for(int i=0;i<l;i++)
{
Cl[i]^=(A[i]=='1');
if(Cl[i])l2++,vl.push_back(i);
}
for(int i=0;i<c;i++)
{
Cc[i]^=(B[i]=='1');
if(Cc[i])c2++,vc.push_back(i);
}
if(abs(l2-c2)&1){cout<<"-1\n";return;}
vector<vector<int>>res(l,vector<int>(c,1));
if(l2||c2)
{
if(!l2&&c2)
{
l2++;vl.push_back(0);
}
else if(!c2&&l2)
{
c2++;vc.push_back(0);
}
for(int i=0;i<max(l2,c2);i++)
{
int a=vl[min(i,l2-1)],b=vc[min(i,c2-1)];
res[a][b]=0;
}
}
for(int i=0;i<l;i++,cout<<'\n')for(int j=0;j<c;j++)cout<<res[i][j];
}
void solve()
{
}
};
signed main()
{
cout<<fixed<<setprecision(12);
ios::sync_with_stdio(0);
cin.tie(0);
int t=1;//cin>>t;
string A,B;
while(cin>>A>>B)
{S SS;SS.ini(A,B);SS.solve();}
}
/*
1274368 996265816
1807139^
1274369 996265816
1165429^
1274369 996269373
inf^
*/
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3820kb
input:
5 8 1 5 1 R 2 1 2 R 5 4 5 R 4 5 3 G 1 3 3 G 4 3 5 G 5 4 1 B 1 2 2 B
output:
0 -1 -1 -1 0 0 0 0 0 -1 0 0 0 0 -1 -1 0
result:
wrong answer 1st numbers differ - expected: '-1', found: '0'