結果

問題 No.2702 Nand Nor Matrix
ユーザー RubikunRubikun
提出日時 2024-03-29 21:47:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 3,074 bytes
コンパイル時間 3,207 ms
コンパイル使用メモリ 214,320 KB
実行使用メモリ 279,316 KB
最終ジャッジ日時 2024-03-29 21:48:11
合計ジャッジ時間 10,543 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 WA -
testcase_02 AC 59 ms
6,548 KB
testcase_03 AC 63 ms
6,548 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 63 ms
6,548 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=300005,INF=1<<30;

map<pair<int,int>,int> MA[8];

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;cin>>N;
    for(int j=0;j<N;j++){
        int x;cin>>x;
        MA[0][mp(0,j)]=x;
    }
    for(int i=1;i<N;i++){
        int x;cin>>x;
        MA[0][mp(i,0)]=x;
    }
    
    for(int a=1;a<N;a++){
        for(int b=1;b<N;b++){
            if(a>=5&&b>=5) break;
            MA[0][mp(a,b)]=0;
        }
    }
    
    for(int t=1;t<=5;t++){
        for(int a=0;a<N;a++){
            for(int b=0;b<N;b++){
                if(a>=5&&b>=5) break;
                if(a==0||b==0) MA[t][mp(a,b)]=MA[t-1][mp(a,b)];
                else{
                    int z=MA[t-1][mp(a,b)];
                    if(z==0){
                        MA[t][mp(a,b)]=!(MA[t-1][mp(a-1,b)]&MA[t-1][mp(a,b-1)]);
                    }else{
                        MA[t][mp(a,b)]=!(MA[t-1][mp(a-1,b)]|MA[t-1][mp(a,b-1)]);
                    }
                }
            }
        }
    }
    int Q;cin>>Q;
    while(Q--){
        ll t,a,b;cin>>t>>a>>b;a--;b--;
        if(t>=6){
            if(t&1) t=5;
            else t=4;
        }
        if(a>=5&&b>=5){
            a=4;
            b=4;
        }
        cout<<MA[t][mp(a,b)]<<"\n";
    }
    
    /*
    int N=8;
    for(int bit=0;bit<(1<<(N+N-1));bit++){
        vector<vector<int>> S(N,vector<int>(N));
        for(int i=0;i<N+N-1;i++){
            if(bit&(1<<i)){
                if(i<N){
                    S[0][i]=1;
                }else{
                    S[i-N+1][0]=1;
                }
            }
        }
        
        vector<vector<string>> T(N,vector<string>(N));
        cout<<bit<<endl;
        for(int t=0;t<60;t++){
            for(int i=0;i<N;i++){
                for(int j=0;j<N;j++){
                    if(t<=1) cout<<S[i][j];
                }
                if(t<=1) cout<<endl;
            }
            if(t<=1) cout<<endl;
            for(int i=0;i<N;i++){
                for(int j=0;j<N;j++){
                    T[i][j]+=char('0'+S[i][j]);
                }
            }
            auto nex=S;
            for(int i=1;i<N;i++){
                for(int j=1;j<N;j++){
                    if(S[i][j]==0){
                        nex[i][j]=!(S[i-1][j]&S[i][j-1]);
                    }else{
                        nex[i][j]=!(S[i-1][j]|S[i][j-1]);
                    }
                }
            }
            S=nex;
        }
        
        for(int i=0;i<N;i++){
            for(int j=0;j<N;j++){
                cout<<i<<" "<<j<<" "<<T[i][j]<<endl;
            }
        }
    }
     */
}

0