QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#233057 | #6743. water235 | dkdk | WA | 1ms | 3404kb | C++20 | 3.3kb | 2023-10-31 12:36:37 | 2023-10-31 12:36:37 |
Judging History
answer
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <cmath>
#include <string>
#include <set>
#include <iomanip>
#define ft first
#define sd second
#define endl '\n'
#define lowbit(x) (x & (-x))
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using PUU = pair<ULL, ULL>;
using PLL = pair<LL, LL>;
using i128 = __int128;
const double eps = 1e-9;
const int N = 1010, mod = 80112002, INF = 2147483647;
int dx[4] = {-1, 1, 0, 0}, dy[4] = {0, 0, -1, 1};
int qmi(int a, int b)
{
int res = 1, t = a;
while(b)
{
if(b & 1)res = (LL)res * t;
t = (LL)t * t;
b >>= 1;
}
return res;
}
int n, m;
void solve()
{
int cnt = 0;
cin >> n >> m;
vector<int> w[n];
for(int i = 0; i < n ; i++)
for(int j = 0; j < m ; j++)
w[i].push_back(0);
if(n == 1)
{
cout << m / 2 << endl;
if(m % 2 == 0)
{
for(int i = 0; i < m ; i++)
{
if(i % 2 == 0)cout << 1;
else cout << 0;
if(i < m - 1)cout << ' ';
}
}
else
{
for(int i = 0; i < m ; i++)
{
if(i % 2)cout << 1;
else cout << 0;
if(i < m - 1)cout << ' ';
}
}
return;
}
if(m == 1)
{
cout << n / 2 << endl;
if(n % 2 == 0)
{
for(int i = 0; i < n ; i++)
{
if(i % 2 == 0)cout << 1;
else cout << 0;
if(i < n - 1)cout << endl;
}
}
else
{
for(int i = 0; i < n ; i++)
{
if(i % 2)cout << 1;
else cout << 0;
if(i < n - 1)cout << endl;
}
}
return;
}
if(n == m)
{
cout << n << endl;
for(int i = 1; i <= n ; i++)
{
for(int j = 1; j <= m ; j++)
if(i == j)cout << 1 << ' ';
else cout << 0 << ' ';
if(i < n)cout << endl;
}
}
else if(n < m)
{
for(int i = 0; i < n ; i++)
for(int j = 0; j < m ; j++)
if(j % n == i)
w[i][j] = 1, cnt++;
cout << cnt << endl;
for(int i = 0; i < n ; i++)
{
for(int j = 0; j < m ; j++)
cout << w[i][j] << ' ';
if(i < n - 1)cout << endl;
}
}
else
{
for(int i = 0; i < n ; i++)
for(int j = 0; j < m ; j++)
if(i % m == j)
w[i][j] = 1, cnt++;
cout << cnt << endl;
for(int i = 0; i < n ; i++)
{
for(int j = 0; j < m ; j++)
cout << w[i][j] << ' ';
if(i < n - 1)cout << endl;
}
}
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
//cout << setprecision(20);
//init();
int T = 1;
//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: 1ms
memory: 3404kb
input:
2 1
output:
1 1 0
result:
wrong answer The answer is wrong: expected = 2, found = 1