結果
| 問題 |
No.2702 Nand Nor Matrix
|
| コンテスト | |
| ユーザー |
Rubikun
|
| 提出日時 | 2024-03-29 21:47:59 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 3,074 bytes |
| コンパイル時間 | 2,406 ms |
| コンパイル使用メモリ | 205,596 KB |
| 最終ジャッジ日時 | 2025-02-20 14:55:49 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 3 WA * 12 TLE * 1 -- * 35 |
ソースコード
#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;
}
}
}
*/
}
Rubikun