結果
| 問題 |
No.110 しましまピラミッド
|
| コンテスト | |
| ユーザー |
dnish
|
| 提出日時 | 2018-06-18 13:53:33 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 1,447 bytes |
| コンパイル時間 | 2,060 ms |
| コンパイル使用メモリ | 173,180 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-31 11:42:52 |
| 合計ジャッジ時間 | 3,066 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
ソースコード
#include "bits/stdc++.h"
#define REP(i,n,N) for(int i=(n); i<(N); i++)
#define RREP(i,n,N) for(ll i=(N-1); i>=n; i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define p(s) cout<<(s)<<endl
#define p2(a,b) cout<<(a)<<" "<<(b)<<endl
typedef long long ll;
using namespace std;
const int inf=1e9;
int Nw,Nb;
int main(){
while(cin>>Nw) {
vector<int> vt[2];
REP(i, 0, Nw) {
int w;
cin >> w;
vt[0].push_back(w);
}
cin >> Nb;
REP(i, 0, Nb) {
int b;
cin >> b;
vt[1].push_back(b);
}
sort(ALL(vt[0]));
sort(ALL(vt[1]));
int ans=0;
REP(i,0,2){
int mx=0;
int len = inf;
int col = i;
int nw = Nw-1;
int nb = Nb-1;
while (!((col==0&&nw==-1)||(col&&nb==-1))){
if(col==0){
if(vt[0][nw]<len){
len = vt[0][nw];
col=1;
mx++;
}
nw--;
}else{
if(vt[1][nb]<len){
len = vt[1][nb];
col=0;
mx++;
}
nb--;
}
}
ans = max(ans,mx);
}
p(ans);
}
return 0;
}
dnish