結果

問題 No.1225 I hate I hate Matrix Construction
ユーザー 沙耶花沙耶花
提出日時 2020-09-11 21:31:49
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 626 bytes
コンパイル時間 1,931 ms
コンパイル使用メモリ 199,284 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-08-27 10:52:10
合計ジャッジ時間 3,229 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,384 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 WA -
testcase_32 AC 1 ms
4,380 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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 10000000000000


int 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]);
	if(ans!=0)ans += c1[0];
	else ans += max(c1[0],c1[1]);
	
	{
		int t = N*(c1[0]);
		if(t!=0)t += c1[1];
		else t += max(c1[0],c1[1]);
		ans = min(ans,t);
	}
	
	cout<<ans<<endl;
			
    return 0;
}
0