結果

問題 No.1225 I hate I hate Matrix Construction
ユーザー mmn15277198
提出日時 2020-09-11 22:23:36
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,017 bytes
コンパイル時間 1,042 ms
コンパイル使用メモリ 98,180 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-27 15:26:46
合計ジャッジ時間 2,207 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

long long gcd(long long a,long long b){
	long long x=max(a,b),y=min(a,b);
	if(x%y==0)return y;
	else return gcd(y,x%y);
}

long long lcm(long long a,long long b){
	return (a/gcd(a,b))*b;
}

int main(){

	cin.tie(0);
	ios::sync_with_stdio(false);
	
	//cout << fixed << setprecision(1) << endl;
	
	int n;
	cin >> n;
	vector<int> s(n);
	vector<int> t(n);
	for(int i = 0; i < n; i++)cin >> s[i];
	for(int i = 0; i < n; i++)cin >> t[i];
	
	vector<vector<int>> ans(n,vector<int>(n,0));
	
	for(int i = 0; i < n; i++){
		if(s[i] == 0){
			continue;
		}else if(s[i] == 2){
			for(int j = 0; j < n;j++){
				ans[i][j] = 1;
			}
		}else if(s[i] == 1){
			ans[i][0] = 1;
		}
	}		
		
	int cnt = 0;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			if(ans[i][j] == 1)cnt++;
		}
	}	
	cout << cnt << endl;
	return 0;
}
 
0