QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#201889#6397. Master of Both IIIucup-team870#WA 0ms3692kbC++142.7kb2023-10-05 17:24:232023-10-05 17:24:24

Judging History

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

  • [2023-10-05 17:24:24]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3692kb
  • [2023-10-05 17:24:23]
  • 提交

answer

#include <bits/stdc++.h>
#define rep(i,l,r) for(int i=l; i<=r; i++)
#define per(i,r,l) for(int i=r; i>=l; i--)
#define IOS {cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);}
using namespace std;
typedef pair<int,int> P;
const int N=200;
int v[N][N],bad[N][N];
char s[N][N];
int f2(int x){return 2*x-1;}
P q[N*N]; int ok[N*N]; P q1[N*10];
int main() {
    IOS
    int n,m; cin>>n>>m;
    rep(i,1,n*2-1)cin>>s[i]+1;
    rep(j,1,m)v[1][f2(j)]=v[n][f2(j)]=5;
    rep(i,1,n)v[f2(i)][1]=v[f2(i)][m]=5;
    v[1][1]=3; v[1][f2(m)]=3;
    v[f2(n)][1]=3; v[f2(n)][f2(m)]=3;
    rep(i,1,n){
        rep(j,1,m){
            int x=f2(i),y=f2(j);
            // cout<<x<<' '<<y<<'\n';
            if(v[x][y]){
                if(v[x][y]!=s[x][y]-'0')bad[x][y]=1;
                continue;
            }
            if(s[x][y]!='8'){
                cout<<"NO\n"; return 0;
            }
        }
    }
    rep(i,1,2*n-1){
        rep(j,1,2*m-1){
            if(s[i][j]=='.')s[i][j]='#';
        }
    }
    int cnt=0;
    rep(i,1,n-1){
        q[++cnt]={f2(i),1}; ok[cnt]=bad[f2(i)][1];
    }
    rep(j,1,m-1){
        q[++cnt]={n,f2(j)}; ok[cnt]=bad[n][f2(j)];
    }
    per(i,n,2){
        q[++cnt]={f2(i),m}; ok[cnt]=bad[f2(i)][m];
    }
    per(j,m,2){
        q[++cnt]={1,f2(j)}; ok[cnt]=bad[1][f2(j)];
    }
    assert(cnt%2==0);
    rep(i,1,cnt){
        cout<<q[i].first<<' '<<q[i].second<<'\n';
    }
    return 0;
    if(*min_element(ok+1,ok+cnt+1)==1){
        for(int i=1;i<cnt;i+=2){
            int x=q[i].first+q[i+1].first, y=q[i].second+q[i+1].second; x/=2; y/=2;
            s[x][y]='.';
        }
    }
    else{
        vector<P>vec;
        int l=1;
        while(l<=cnt){
            if(!ok[l]){
                ++l; continue;
            }
            int r=l;
            while(r<=cnt && ok[r])++r;
            vec.push_back({l,r});
        }
        if(ok[1] && ok[cnt]){
            auto [v1,_]=vec.back(); auto [__,v2]=*vec.begin();
            vec.pop_back();
            vec.erase(vec.begin());
            vec.push_back({v1,v2});
        }
        for(auto [l,r]:vec){
            int top=0;
            while(l!=r){
                q1[++top]=q[l];
                ++l; if(l>cnt)l-=cnt;
            }
            if(top&1){
                cout<<"NO\n"; return 0;
            }
            for(int i=1;i<top;i+=2){
                int x=q1[i].first+q1[i+1].first, y=q1[i].second+q1[i+1].second; x/=2; y/=2;
                s[x][y]='.';
            }
        }
    }
    cout<<"YES\n";
    rep(i,1,n){
        rep(j,1,m)cout<<s[i][j]; cout<<'\n';
    }
}
/*
1 1
3 1
3 1
3 3
5 3
3 3
1 5
1 3
*/

詳細信息

Test #1:

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

input:

3
2 1 2

output:

1 1
3 1
3 1
5 2
3 2
1 3

result:

wrong answer 1st numbers differ - expected: '45', found: '1'