結果
| 問題 |
No.1225 I hate I hate Matrix Construction
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-09-12 18:39:35 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 576 bytes |
| コンパイル時間 | 1,722 ms |
| コンパイル使用メモリ | 193,640 KB |
| 最終ジャッジ日時 | 2025-01-14 13:40:52 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 35 |
コンパイルメッセージ
main.cpp:11:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
11 | main() {
| ^~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
int f(int H,int W,int s0,int s1,int s2,int t0,int t1,int t2) {
if (s2>0) return f(H-s2,W,s0,s1,0,t0,0,t2)+W*s2;
if (t2>0) return f(W,H,t0,t1,t2,s0,s1,s2);
if (s0>0||t0>0) return f(H-t0,W-s0,0,s1,s2,0,t1,t2);
return max(s1,t1);
}
main() {
int N;
cin>>N;
int S[3]={};
int T[3]={};
for (int i=0;i<N;++i) {
int s;cin>>s;
++S[s];
}
for (int i=0;i<N;++i) {
int t;cin>>t;
++T[t];
}
int ans=f(N,N,S[0],S[1],S[2],T[0],T[1],T[2]);
cout<<ans<<endl;
}