結果
問題 |
No.1225 I hate I hate Matrix Construction
|
ユーザー |
|
提出日時 | 2020-09-11 21:41:30 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 771 bytes |
コンパイル時間 | 1,869 ms |
コンパイル使用メモリ | 198,996 KB |
最終ジャッジ日時 | 2025-01-14 10:15:14 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 WA * 12 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i = 0; i < (int)n; i++) using ll = long long; int main(){ int n; cin >> n; int s[n], t[n]; rep(i,n) cin >> s[i]; rep(i,n) cin >> t[i]; vector<vector<int>> a(n,vector<int>(n,-1)); rep(i,n) { if(s[i] == 0) rep(j,n) a[i][j] = 0; if(s[i] == 2) rep(j,n) a[i][j] = 1; if(t[i] == 0) rep(j,n) a[j][i] = 0; if(t[i] == 2) rep(j,n) a[j][i] = 1; } rep(i,n) { rep(j,n) { if(a[i][j] == -1 and s[i] == 1 and t[j] == 1) { a[i][j] = 1; rep(k,n) if(a[i][k] == -1) a[i][k] = 0; rep(k,n) if(a[k][j] == -1) a[k][j] = 0; } } } int ans = 0; rep(i,n) rep(j,n) if(a[i][j] == -1 or a[i][j] == 1) ans++; cout << ans << endl; return 0; }