QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#213519 | #3016. Flashing Fluorescents | rbjwnb | WA | 1ms | 3480kb | C++20 | 1.3kb | 2023-10-14 14:41:50 | 2023-10-14 14:41:52 |
Judging History
answer
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int N = 1e2+5, M = 1e6+5;
const int MOD = 998244353, INF = 0x3f3f3f3f;
string r, c;
bool ans[N][N];
deque<int> res;
deque<int> t;
void solve() {
cin >> r >> c;
for(int i = 0; i < r.size(); i ++) {
for(int j = 0; j < c.size(); j ++) ans[i][j] = true;
if((c.size() % 2) != (r[i] - '0')) res.push_back(i);
}
int j = 0;
for(int i = 0; i < c.size(); i ++) {
if((r.size() % 2) != (c[i] - '0')) {
t.push_back(i);
}
}
if(t.size() > res.size() && (t.size() - res.size()) % 2 == 1) {
cout << -1 << endl;
return ;
}
if(t.size() < res.size() && (res.size() - t.size()) % 2 == 1) {
cout << -1 << endl;
return ;
}
while(res.size() < t.size()) {
res.push_front(0);
}
while(t.size() < res.size()) {
t.push_front(0);
}
for(int i = 0; i < t.size(); i ++) {
ans[res[i]][t[i]] = false;
}
for(int i = t.size(); i < res.size(); i ++) ans[res[i]][0] = false;
for(int i = 0; i < r.size(); i ++) {
for(int j = 0; j < c.size(); j ++) cout << ans[i][j];
cout << endl;
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
int t = 1;
//cin >> t;
while(t --) solve();
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3480kb
input:
1101
output:
-1
result:
wrong answer 1st numbers differ - expected: '1', found: '-1'