QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#99446 | #6309. Aqre | rgnerdplayer# | WA | 0ms | 3412kb | C++20 | 3.7kb | 2023-04-22 15:58:08 | 2023-04-22 15:58:12 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/priority_queue.hpp>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define ordered_multiset tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>
/* ordered_set notes:
.order_of_key(k): Number of items strictly smaller than k
.find_by_order(k): k-th element in a set
*/
#define X first
#define Y second
template <typename A, typename B> istream& operator >> (istream& o, pair<A, B> &a) {
return o >> a.X >> a.Y;
}
template <typename A, typename B> ostream& operator << (ostream& o, pair<A, B> a) {
return o << '(' << a.X << ", " << a.Y << ')';
}
#ifdef cychien
#define DE(...) do {\
fprintf(stderr, "%s - %d : (%s) = ", __PRETTY_FUNCTION__, __LINE__, #__VA_ARGS__);\
_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x) {cerr << x << '\n';}
template<typename I, typename ...T> void _DO(I&&x,T&&...tail) {cerr << x << ", "; _DO(tail...);}
#define IOS
#define debug(v) {cerr << #v << " = ["; for(auto it = (v).begin(); it != (v).end(); it++){cerr << *it; if (next(it) != (v).end()) cerr << ", "; } cerr << "]\n";}
#else
#define DE(...)
#define debug(v)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
#endif
#define W(v) {for(auto it = (v).begin(); it != (v).end(); it++)cout << *it << " \n"[next(it) == (v).end()];}
#define pb emplace_back
#define mp make_pair
#define rsz resize
#define SZ(x) (ll)x.size()
#define AI(x) (x).begin(),(x).end()
#define SORT(x) sort(AI(x))
template<class T> bool chmin(T &a, T b) { return b < a && (a = b, true); }
template<class T> bool chmax(T &a, T b) { return a < b && (a = b, true); }
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
const int NF = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1e9 + 7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int Rand(){
return uniform_int_distribution<int>(INT_MIN, INT_MAX)(rng);
}
/*
#include <atcoder/all>
using namespace atcoder;
*/
/* LazySegtree
// Example for range linear transfromation & range sum
// Monoid Property: op(F(a), F(b)) == F(op(a, b))
// Declaration: lazy_segtree<S, op, e, F, mapping, composition, id> seg(n);
struct S { // Node
mint sum;
int len;
};
S op(S x, S y){ // pull
return S{x.sum + y.sum, x.len + y.len};
}
S e(){ // e s.t. op(x, e) == x
return S{0, 1};
}
struct F {
mint a, b;
};
S mapping(F t, S x){ // push
return S{t.a * x.sum + t.b * x.len, x.len};
}
F composition(F f, F g){ // f o g
return F{f.a * g.a, f.a * g.b + f.b};
}
F id() { // id s.t. composition(F, id) == F
return F{1, 0};
}
*/
void solve(){
int n, m; cin >> n >> m;
string ans;
if (m <= 3){
for (int i = 0; i < n; i++){
for (int j = 0; j < m; j++){
ans += "10"[i % 4 == 3];
}
ans += '\n';
}
}
else if (n <= 3){
for (int i = 0; i < n; i++){
for (int j = 0; j < m; j++){
ans += "10"[j % 4 == 3];
}
ans += '\n';
}
}
else {
for (int i = 0; i < n; i++){
for (int j = 0; j < m; j++){
ans += "10"[(i + j) % 4 == 3];
}
ans += '\n';
}
}
cout << count(AI(ans), '1') << '\n' << ans;
}
int main() {
IOS;
int T; cin >> T;
while (T--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3412kb
input:
3 2 2 3 4 3 8
output:
4 11 11 9 1110 1110 1110 18 11101110 11101110 11101110
result:
wrong answer 1s are not connected. (test case 3)