Task: | Even Grid |
Sender: | bubu2006 |
Submission time: | 2024-11-27 16:47:55 +0200 |
Language: | C++ (C++20) |
Status: | READY |
Result: | ACCEPTED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.00 s | details |
#2 | ACCEPTED | 0.00 s | details |
#3 | ACCEPTED | 0.00 s | details |
#4 | ACCEPTED | 0.00 s | details |
#5 | ACCEPTED | 0.00 s | details |
#6 | ACCEPTED | 0.00 s | details |
#7 | ACCEPTED | 0.00 s | details |
#8 | ACCEPTED | 0.00 s | details |
#9 | ACCEPTED | 0.00 s | details |
#10 | ACCEPTED | 0.00 s | details |
#11 | ACCEPTED | 0.00 s | details |
Code
#pragma GCC optimize("O3,unroll-loops")#include <bits/stdc++.h>using namespace std;#define int long long#define rep(i, a, b) for(int i = a; i < (b); ++i)#define all(x) begin(x), end(x)#define sz(x) (int)(x).size()typedef long long ll;typedef pair<int, int> pii;typedef vector<int> vi;typedef long double ld;string to_string(string s) {return '"' + s + '"';}string to_string(const char* s) {return to_string((string) s);}string to_string(bool b) {return (b ? "true" : "false");}template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}template <typename A>string to_string(A v) {bool first = true;string res = "{";for (const auto &x : v) {if (!first) {res += ", ";}first = false;res += to_string(x);}res += "}";return res;}void debug_out() {cerr << endl;}template <typename Head, typename... Tail>void debug_out(Head H, Tail... T) {cerr << " " << to_string(H);debug_out(T...);}#ifdef LOCAL#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)#else#define debug(...) 42#endifsigned main() {cin.tie(0)->sync_with_stdio(0);cin.exceptions(cin.failbit); // RTE if input wrong datatypeint n;cin >> n;vector<string> a(n);for (auto& x : a) cin >> x;vector<vi> b(n, vi(n));for (int i = 0; i < n; i++) {b[i][0] = a[i][0] == '1';b[0][i] = a[0][i] == '1';}for (int i = 1; i < n; i++) {for (int j = 1; j < n; j++) {b[i][j] = b[i][0] & b[0][j];}}for (int i = 0; i < n; i++) {for (int j = 0; j < n; j++) {cout << b[i][j];}cout << '\n';}}
Test details
Test 1
Verdict: ACCEPTED
input |
---|
2 11 1? |
correct output |
---|
11 11 |
user output |
---|
11 11 |
Test 2
Verdict: ACCEPTED
input |
---|
3 101 1?? 0?? |
correct output |
---|
101 101 000 |
user output |
---|
101 101 000 |
Test 3
Verdict: ACCEPTED
input |
---|
4 1010 0??? 1??? 0??? |
correct output |
---|
1010 0000 1010 0000 |
user output |
---|
1010 0000 1010 0000 |
Test 4
Verdict: ACCEPTED
input |
---|
5 11101 1???? 1???? 1???? ... |
correct output |
---|
11101 11101 11101 11101 00000 |
user output |
---|
11101 11101 11101 11101 00000 |
Test 5
Verdict: ACCEPTED
input |
---|
5 10111 1???? 1???? 0???? ... |
correct output |
---|
10111 10111 10111 00000 10111 |
user output |
---|
10111 10111 10111 00000 10111 |
Test 6
Verdict: ACCEPTED
input |
---|
5 11000 0???? 0???? 0???? ... |
correct output |
---|
11000 00000 00000 00000 11000 |
user output |
---|
11000 00000 00000 00000 11000 |
Test 7
Verdict: ACCEPTED
input |
---|
5 10100 1???? 0???? 1???? ... |
correct output |
---|
10100 10100 00000 10100 10100 |
user output |
---|
10100 10100 00000 10100 10100 |
Test 8
Verdict: ACCEPTED
input |
---|
5 10100 1???? 1???? 0???? ... |
correct output |
---|
10100 10100 10100 00000 10100 |
user output |
---|
10100 10100 10100 00000 10100 |
Test 9
Verdict: ACCEPTED
input |
---|
10 1010000000 1????????? 0????????? 0????????? ... |
correct output |
---|
1010000000 1010000000 0000000000 0000000000 0000000000 ... |
user output |
---|
1010000000 1010000000 0000000000 0000000000 0000000000 ... Truncated |
Test 10
Verdict: ACCEPTED
input |
---|
100 100010110100011000001111001110... |
correct output |
---|
100010110100011000001111001110... |
user output |
---|
100010110100011000001111001110... Truncated |
Test 11
Verdict: ACCEPTED
input |
---|
100 100100110000010110111101111101... |
correct output |
---|
100100110000010110111101111101... |
user output |
---|
100100110000010110111101111101... Truncated |