結果
問題 |
No.110 しましまピラミッド
|
ユーザー |
|
提出日時 | 2017-04-11 02:10:12 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,167 bytes |
コンパイル時間 | 626 ms |
コンパイル使用メモリ | 87,936 KB |
実行使用メモリ | 10,272 KB |
最終ジャッジ日時 | 2024-07-18 05:47:36 |
合計ジャッジ時間 | 7,302 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 TLE * 1 -- * 1 |
other | AC * 2 -- * 24 |
ソースコード
#define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<string> #include<iostream> #include<cctype> #include<cstdio> #include<vector> #include<stack> #include<queue> #include <algorithm> #include<math.h> #include<set> #include<map> #include<iomanip> //#include<bits/stdc++.h> using namespace std; int main() { int a, b; vector<int>A, B; cin >> a; for (int i = 0; i < a; i++) { int x; cin >> x; A.push_back(x); } cin >> b; for (int i = 0; i < b; i++) { int x; cin >> x; B.push_back(x); } sort(A.begin(), A.end()); sort(B.begin(), B.end()); int t = 0, m = 0; int a1 = 0, a2 = 0; int r = 0; while (1) { for (; t < a; t++) { if (A[t] > r) { r = A[t]; a1++; break; } } for (; m < b; m++) { if (B[m] > r) { r = B[m]; a1++; break; } } if (t == a-1 || m == b-1)break; } r = 0; t = 0, m = 0; while (1) { for (; m < b; m++) { if (B[m] > r) { r = B[m]; a2++; break; } } for (; t < a; t++) { if (A[t] > r) { r = A[t]; a2++; break; } } if (t == a-1 || m == b-1)break; } cout << max(a1, a2) << endl; return 0; }