Submission #57048603
Source Code Expand
Copy
#include <bits/stdc++.h>#define CNO cout << "NO\n"#define CYES cout << "YES\n"#define endl '\n'#define ls id << 1#define rs id << 1 | 1#define llen (mid - l + 1)#define rlen (r - mid)using namespace std;typedef long long ll;typedef unsigned int uint;typedef unsigned long long ull;typedef long double ld;typedef __int128 i128;typedef pair<int, int> pii;typedef pair<ll, ll> pll;const ll mod = 998244353;const int N = 200010;int n, arr[N];ll ans = 0;string str;
#include <bits/stdc++.h> #define CNO cout << "NO\n" #define CYES cout << "YES\n" #define endl '\n' #define ls id << 1 #define rs id << 1 | 1 #define llen (mid - l + 1) #define rlen (r - mid) using namespace std; typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; typedef long double ld; typedef __int128 i128; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const ll mod = 998244353; const int N = 200010; int n, arr[N]; ll ans = 0; string str; int main() { ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); int T = 1; // cin >> T; while (T--) { cin >> n; for (int i = 0; i < n; ++i) { cin >> arr[i]; } ans = 0; for (int i = 0; i < n; ++i) { while (ans % 3 != 0) { if (ans % 3 == 2) arr[i] -= 3; else arr[i]--; ans++; if (arr[i] <= 0) break; } ll num = arr[i] / 5; ans += 3 * num; arr[i] = arr[i] % 5; while (arr[i] > 0) { if (ans % 3 == 2) arr[i] -= 3; else arr[i]--; ans++; } // cerr << i << ' ' << ans << endl; } cout << ans << endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Triple Attack |
User | Arch_Srginit |
Language | C++ 20 (gcc 12.2) |
Score | 300 |
Code Size | 1242 Byte |
Status | AC |
Exec Time | 14 ms |
Memory | 4376 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, sample_01.txt, sample_02.txt, sample_03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
random_01.txt | AC | 13 ms | 4172 KB |
random_02.txt | AC | 11 ms | 4160 KB |
random_03.txt | AC | 13 ms | 4304 KB |
random_04.txt | AC | 5 ms | 3748 KB |
random_05.txt | AC | 13 ms | 4204 KB |
random_06.txt | AC | 7 ms | 3988 KB |
random_07.txt | AC | 14 ms | 4244 KB |
random_08.txt | AC | 4 ms | 3624 KB |
random_09.txt | AC | 13 ms | 4196 KB |
random_10.txt | AC | 8 ms | 3964 KB |
random_11.txt | AC | 13 ms | 4244 KB |
random_12.txt | AC | 4 ms | 3676 KB |
random_13.txt | AC | 13 ms | 4256 KB |
random_14.txt | AC | 12 ms | 4308 KB |
random_15.txt | AC | 13 ms | 4376 KB |
random_16.txt | AC | 4 ms | 3664 KB |
random_17.txt | AC | 13 ms | 4252 KB |
random_18.txt | AC | 2 ms | 3568 KB |
random_19.txt | AC | 9 ms | 4236 KB |
random_20.txt | AC | 4 ms | 3824 KB |
random_21.txt | AC | 12 ms | 4108 KB |
random_22.txt | AC | 1 ms | 3412 KB |
sample_01.txt | AC | 1 ms | 3524 KB |
sample_02.txt | AC | 1 ms | 3412 KB |
sample_03.txt | AC | 1 ms | 3456 KB |