QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#883309#6309. AqreAMATSUKAZE#WA 0ms3712kbC++201.5kb2025-02-05 15:46:092025-02-05 15:46:10

Judging History

This is the latest submission verdict.

  • [2025-02-05 15:46:10]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3712kb
  • [2025-02-05 15:46:09]
  • Submitted

answer

#include<bits/stdc++.h>
#define rep(i,s,n) for (int i = (int)(s); i < (int)(n); i++)
#define all(v) begin(v),end(v)
using namespace std;
using ll = long long;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using vp=vector<pll>;
using vvp=vector<vp>;
using vs=vector<string>;
bool chmin(auto &a, auto b){ return a > b ? a = b, 1 : 0; }
bool chmax(auto &a, auto b){ return a < b ? a = b, 1 : 0; }
const ll INF=1LL<<60;

void output(vs a){
    for(auto s:a) cout<<s<<endl;
}

void solve(ll h,ll w){
    if(h<4&&w<4){
        output(vs(h,string(w,'1')));
        return;
    }
    bool is_swap=false;
    if(h>w){
        is_swap=true;
        swap(h,w);
    }
    vs rs(h,string(w,'1'));
    if(h==2){
        rep(j,0,w)if(j%4==3) rs[0][j]='0';
        rep(j,0,w)if(j%4==1) rs[1][j]='0';
    }
    else if(h%4==0||w%4==0){
        vs a={
            "1011",
            "1110",
            "0111",
            "1101"
        };
        rep(i,0,h)rep(j,0,w) rs[i][j]=a[i%4][j%4];
    }
    else{
        vs a={
            "1110",
            "1101",
            "0111",
            "1011"
        };
        rep(i,0,h)rep(j,0,w) rs[i][j]=a[i%4][j%4];
    }
    if(is_swap){
        vs rs_(w,string(h,'0'));
        rep(i,0,h)rep(j,0,w) rs_[j][i]=rs[i][j];
        rs=rs_;
    }
    output(rs);
}

int main(){
    cin.tie(0)->sync_with_stdio(0);

    ll q;
    cin>>q;
    while(q--){
        ll h,w;
        cin>>h>>w;
        solve(h,w);
    }
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3712kb

input:

3
2 2
3 4
3 8

output:

11
11
1011
1110
0111
10111011
11101110
01110111

result:

wrong answer Integer parameter [name=ans] equals to 11, violates the range [0, 4] (test case 1)