QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#218511#6743. water235curtain_cppWA 0ms3620kbC++142.6kb2023-10-18 14:18:592023-10-18 14:19:00

Judging History

你现在查看的是最新测评结果

  • [2023-10-18 14:19:00]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3620kb
  • [2023-10-18 14:18:59]
  • 提交

answer

#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
using namespace std;
typedef long long  LL;
typedef unsigned long long uLL;
typedef pair<LL,LL> PII;
const int N = 2e5+10;
const int inf = 0x3f3f3f3f;
const double pi = acos(-1);
#define debug(x) cout<<"[debug]"#x<<"="<<x<<'\n';
template <int T>
struct ModInt {
    const static int MD = T;
    int x;
    ModInt(LL x = 0)
        : x(x % MD) {}
    int get() { return x; }
    ModInt operator+(const ModInt& that) const {
        int x0 = x + that.x;
        return ModInt(x0 < MD ? x0 : x0 - MD);
    }
    ModInt operator-(const ModInt& that) const {
        int x0 = x - that.x;
        return ModInt(x0 < MD ? x0 + MD : x0);
    }
    ModInt operator*(const ModInt& that) const {
        return ModInt((long long)x * that.x % MD);
    }
    ModInt operator/(const ModInt& that) const {
        return *this * that.inverse();
    }
    void operator+=(const ModInt& that) {
        x += that.x;
        if (x >= MD)
            x -= MD;
    }
    void operator-=(const ModInt& that) {
        x -= that.x;
        if (x < 0)
            x += MD;
    }
    void operator*=(const ModInt& that) { x = (long long)x * that.x % MD; }
    void operator/=(const ModInt& that) { *this = *this / that; }
    ModInt inverse() const {
        int a = x, b = MD, u = 1, v = 0;
        while (b) {
            int t = a / b;
            a -= t * b;
            std::swap(a, b);
            u -= t * v;
            std::swap(u, v);
        }
        if (u < 0)
            u += MD;
        return u;
    }
    friend ostream& operator<<(ostream& os, ModInt x) {
        os << x.get();
        return os;
    }
};//全局变量记得清零!
const int mod=998244353;
typedef ModInt<mod> mint;
LL gcd(LL a, LL b)
{
   return b ? gcd(b, a % b) : a;
}
void solve()
{
   int n,m;cin>>n>>m;
   int mp[n][m];
    for(int i=0;i<n;i++){
      for(int j=0;j<m;j++){
          mp[i][j]=0;
      }

   }
   for(int i=0;i<n;i++){
       for(int j=0;j<m;j++){
          if(i==j) mp[i][j]=1;
       }
   }
    if(n>m){
             for(int i=m;i<n;i++) mp[i][m-1]=1;
          }else if(n<m){
             for(int i=n;i<m;i++){
                   mp[n-1][i]=1;
             }
          }
          cout<<max(n,m)<<'\n';
   for(int i=0;i<n;i++){
      for(int j=0;j<m;j++){
          cout<<mp[i][j]<<" ";
      }
      cout<<'\n';
   }
}
int main()
{
   ios::sync_with_stdio(0); cin.tie(0),cout.tie(0);
   solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3548kb

input:

2 1

output:

2
1 
1 

result:

ok The answer is correct.

Test #2:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

3 3

output:

3
1 0 0 
0 1 0 
0 0 1 

result:

ok The answer is correct.

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3620kb

input:

1 4

output:

4
1 1 1 1 

result:

wrong answer The answer is wrong: expected = 3, found = 4