結果
問題 | No.1225 I hate I hate Matrix Construction |
ユーザー |
![]() |
提出日時 | 2020-09-11 21:33:56 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 98 ms / 2,000 ms |
コード長 | 565 bytes |
コンパイル時間 | 2,148 ms |
コンパイル使用メモリ | 195,004 KB |
最終ジャッジ日時 | 2025-01-14 10:08:16 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 35 |
ソースコード
#include <stdio.h>#include <bits/stdc++.h>using namespace std;#define rep(i,n) for (int i = 0; i < (n); ++i)#define modulo 1000000007#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)#define Inf 10000000000000int main(){int N;cin>>N;vector<int> c1(2,0),c2(2,0);int n = N;rep(i,2){rep(j,N){int a;cin>>a;if(a==1)c1[i]++;else if(a==2)c2[i]++;else n--;}}int ans = N*(c2[0]+c2[1]) - (c2[0]*c2[1]);if(c2[0]!=0)c1[1]=0;if(c2[1]!=0)c1[0]=0;ans += max(c1[0],c1[1]);cout<<ans<<endl;return 0;}