QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#666622#8041. Life is Hard and Undecidable, but...rerebornzhouWA 133ms20168kbC++202.1kb2024-10-22 19:24:452024-10-22 19:24:51

Judging History

This is the latest submission verdict.

  • [2024-10-22 19:24:51]
  • Judged
  • Verdict: WA
  • Time: 133ms
  • Memory: 20168kb
  • [2024-10-22 19:24:45]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
#define IOS std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define int long long
#define ull unsigned long long
#define fi first
#define se second
#define pi pair<int,int>

const int N=1e6+10;
const int INF=1e18;

string s[160][310];

int dx[8]={0,0,-1,-1,-1,1,1,1};
int dy[8]={1,-1,0,1,-1,0,1,-1};

void solve(){

    int n=300;
    for(int i=1;i<=159;i++){
        for(int j=1;j<=n;j++){
            s[i][j]=string(n+1,'0');
        }
    } 
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(i==j) s[1][i][j]='1';
        }
    }
    int cnt=0;
    for(int i=2;i<=300;i++){
        cnt++;
        for(int j=1;j<=n;j++){
            for(int k=1;k<=n;k++){
                int cnt=0;
                for(int d=0;d<=7;d++){
                    int jj=j+dx[d];
                    int kk=k+dy[d];
                    if(jj>0&&jj<=n&&kk>0&&kk<=n && s[i-1][jj][kk]=='1'){
                        cnt++;
                    }
                }
                if(cnt==3){
                    s[i][j][k]='1';
                }
                else if(cnt==2&&s[i-1][j][k]=='1'){
                    s[i][j][k]='1';
                }
                else{
                    s[i][j][k]='0';
                }
            }
        }
        bool flag=0;
        for(int j=1;j<=n;j++){
            for(int k=1;k<=n;k++){
                if(s[i][j][k]=='1') flag=1;
            }
        }
        if(!flag) break;
    }
    cnt++;
    int k;
    cin>>k;
    int cc=0;
    // cerr<<cnt<<" "<<k<<"\n";
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(s[cnt-k+1][i][j]=='1'){
                cc++;
            }
        }
    }
    cout<<cc<<"\n";
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(s[cnt-k+1][i][j]=='1'){
                cout<<i<<" "<<j<<"\n";
            }
        }
    }
}

signed main(){
IOS
    srand(time(0));
    int _=1;
    // cin>>_;
    while(_--){
        solve();
    }
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 133ms
memory: 20168kb

input:

1

output:

0

result:

wrong answer no alive vertices