Please sign in first.
Submission #26690153
Source Code Expand
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std;
void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
∧_∧
∧_∧ (´<_` ) Welcome to My Coding Space!
( ´_ゝ`) / ⌒i @hamayanhamayan0
/ \ | |
/ / ̄ ̄ ̄ ̄/ |
__(__ニつ/ _/ .| .|____
\/____/ (u ⊃
---------------------------------------------------------------------------------------------------*/
int N; ll A[101010];
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
//---------------------------------------------------------------------------------------------------
void _main() {
cin >> N;
rep(i, 0, N) cin >> A[i];
min_priority_queue<ll> que;
int cnt = 0;
rep(i, 0, N) {
while (A[i] % 2 == 0) cnt++, A[i] /= 2;
que.push(A[i]);
}
rep(i, 0, cnt) {
ll top = que.top() * 3;
que.pop();
que.push(top);
}
ll ans = que.top();
cout << ans << endl;
}
Submission Info
| Submission Time | |
|---|---|
| Task | I - /2 and *3 |
| User | hamayanhamayan |
| Language | C++ (GCC 9.2.1) |
| Score | 6 |
| Code Size | 1822 Byte |
| Status | AC |
| Exec Time | 146 ms |
| Memory | 5040 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 6 / 6 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample_01.txt, sample_02.txt, sample_03.txt |
| All | sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| sample_01.txt | AC | 9 ms | 3504 KiB |
| sample_02.txt | AC | 2 ms | 3588 KiB |
| sample_03.txt | AC | 6 ms | 3616 KiB |
| test_01.txt | AC | 2 ms | 3568 KiB |
| test_02.txt | AC | 2 ms | 3640 KiB |
| test_03.txt | AC | 7 ms | 3484 KiB |
| test_04.txt | AC | 2 ms | 3520 KiB |
| test_05.txt | AC | 2 ms | 3572 KiB |
| test_06.txt | AC | 19 ms | 4060 KiB |
| test_07.txt | AC | 26 ms | 3908 KiB |
| test_08.txt | AC | 9 ms | 3768 KiB |
| test_09.txt | AC | 87 ms | 4828 KiB |
| test_10.txt | AC | 5 ms | 3816 KiB |
| test_11.txt | AC | 27 ms | 4172 KiB |
| test_12.txt | AC | 13 ms | 3960 KiB |
| test_13.txt | AC | 55 ms | 4200 KiB |
| test_14.txt | AC | 21 ms | 4296 KiB |
| test_15.txt | AC | 16 ms | 4292 KiB |
| test_16.txt | AC | 20 ms | 4328 KiB |
| test_17.txt | AC | 56 ms | 4244 KiB |
| test_18.txt | AC | 32 ms | 4828 KiB |
| test_19.txt | AC | 17 ms | 4000 KiB |
| test_20.txt | AC | 11 ms | 4080 KiB |
| test_21.txt | AC | 136 ms | 5024 KiB |
| test_22.txt | AC | 33 ms | 5040 KiB |
| test_23.txt | AC | 59 ms | 4960 KiB |
| test_24.txt | AC | 34 ms | 4888 KiB |
| test_25.txt | AC | 17 ms | 4928 KiB |
| test_26.txt | AC | 146 ms | 5028 KiB |