結果
| 問題 |
No.110 しましまピラミッド
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-12-09 07:08:36 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 838 bytes |
| コンパイル時間 | 1,735 ms |
| コンパイル使用メモリ | 173,124 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-31 11:49:38 |
| 合計ジャッジ時間 | 2,684 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int cnt(vector<int> x, vector<int> y) {
int s = x.size();
int t = y.size();
int ret = 0;
int i = 0, j = 0;
int cur = 1000000000;
while(true) {
while(i < s && x[i] >= cur) {
i++;
}
if(i >= s) {
return ret;
}
cur = x[i];
ret++;
i++;
while(j < t && y[j] >= cur) {
j++;
}
if(j >= t) {
return ret;
}
cur = y[j];
ret++;
j++;
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> w(n);
for(int i = 0; i < n; i++) {
cin >> w[i];
}
int m;
cin >> m;
vector<int> b(m);
for(int i = 0; i < m; i++) {
cin >> b[i];
}
sort(w.begin(), w.end(), greater<int>());
sort(b.begin(), b.end(), greater<int>());
cout << max(cnt(b, w), cnt(w, b)) << endl;
return 0;
}