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