結果
| 問題 |
No.1225 I hate I hate Matrix Construction
|
| コンテスト | |
| ユーザー |
Haa
|
| 提出日時 | 2020-09-11 21:40:06 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 799 bytes |
| コンパイル時間 | 1,958 ms |
| コンパイル使用メモリ | 171,592 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-27 08:01:30 |
| 合計ジャッジ時間 | 3,565 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 35 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 1e18;
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(v) v.begin(),v.end()
int main(){
int n; cin >> n;
VI s(n), t(n);
REP(i,n) cin >> s[i];
REP(i,n) cin >> t[i];
VVI a(n,VI(n,0));
REP(i,n){
if(s[i]==2){
REP(j,n)
a[i][j]=1;
}
}
REP(i,n){
if(t[i]==2){
REP(j,n)
a[j][i]=1;
}
}
int x=0, y=0;
REP(i,n){
if(s[i]==1){
bool no=1;
REP(j,n){
if(a[i][j])
no=0;
}
x+=no;
}
}
REP(i,n){
if(t[i]==1){
bool no=1;
REP(j,n){
if(a[j][i])
no=0;
}
y+=no;
}
}
int ans=max(x,y);
REP(i,n)REP(j,n)
ans+=a[i][j];
cout << ans << endl;
return 0;
}
Haa