Submission #844831
Source Code Expand
#include <bits/stdc++.h> #define each(i, c) for (auto& i : c) #define unless(cond) if (!(cond)) using namespace std; typedef long long int lli; typedef unsigned long long ull; typedef complex<double> point; template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; } int main(int argc, char *argv[]) { const int N = 100000 + 5; lli a[N]; int n; while (cin >> n) { fill(a, a + N, 0); for (int i = 0; i < n; ++i) { cin >> a[i]; } lli cnt = 0; for (int i = 0; i + 1 < N; ++i) { int j = i + 1; int mn = min(a[i], a[j]); a[i] -= mn; a[j] -= mn; cnt += mn; } for (int i = 0; i < N; ++i) { cnt += a[i] / 2; } cout << cnt << endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Simplified mahjong |
User | Johniel |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 866 Byte |
Status | WA |
Exec Time | 134 ms |
Memory | 1024 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 400 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, s1.txt, s2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | WA | 118 ms | 1024 KB |
02.txt | WA | 118 ms | 1024 KB |
03.txt | WA | 118 ms | 1024 KB |
04.txt | WA | 77 ms | 1024 KB |
05.txt | WA | 80 ms | 1024 KB |
06.txt | WA | 83 ms | 1024 KB |
07.txt | WA | 101 ms | 1024 KB |
08.txt | WA | 99 ms | 1024 KB |
09.txt | WA | 117 ms | 1024 KB |
10.txt | WA | 119 ms | 1024 KB |
11.txt | AC | 35 ms | 1024 KB |
12.txt | AC | 134 ms | 1024 KB |
13.txt | AC | 120 ms | 1024 KB |
14.txt | AC | 120 ms | 1024 KB |
15.txt | AC | 37 ms | 1024 KB |
16.txt | WA | 113 ms | 1024 KB |
17.txt | WA | 123 ms | 1024 KB |
18.txt | AC | 6 ms | 1024 KB |
19.txt | AC | 6 ms | 1024 KB |
20.txt | AC | 6 ms | 1024 KB |
21.txt | AC | 6 ms | 1024 KB |
22.txt | AC | 6 ms | 1024 KB |
s1.txt | AC | 6 ms | 1024 KB |
s2.txt | AC | 6 ms | 1024 KB |