Submission #1595522
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;
#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const ll INF = 1<<30;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;
//#define int long long
int md = 100000;
#define addm(X, Y) ((X) = ((X) + (Y) % md) % md)
int n;
int a[100000 + 5];
ll ans = 0;
signed main(){
cin.tie(0);
ios::sync_with_stdio(false);
cin >> n;
rep(i, n) cin >> a[i];
rep(i, n) {
if (a[i] % 2 == 0) {
ans += a[i] / 2;
}
else {
ans += a[i] / 2;
if (a[i + 1] == 0) continue;
a[i + 1]++;
}
}
cout << ans << endl;
}
Submission Info
Submission Time |
|
Task |
B - Simplified mahjong |
User |
roto_37 |
Language |
C++14 (GCC 5.4.1) |
Score |
400 |
Code Size |
1623 Byte |
Status |
AC |
Exec Time |
12 ms |
Memory |
640 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
400 / 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 |
AC |
12 ms |
640 KB |
02.txt |
AC |
12 ms |
640 KB |
03.txt |
AC |
12 ms |
640 KB |
04.txt |
AC |
10 ms |
640 KB |
05.txt |
AC |
10 ms |
640 KB |
06.txt |
AC |
10 ms |
640 KB |
07.txt |
AC |
11 ms |
640 KB |
08.txt |
AC |
11 ms |
640 KB |
09.txt |
AC |
12 ms |
640 KB |
10.txt |
AC |
12 ms |
640 KB |
11.txt |
AC |
7 ms |
640 KB |
12.txt |
AC |
12 ms |
640 KB |
13.txt |
AC |
11 ms |
640 KB |
14.txt |
AC |
11 ms |
640 KB |
15.txt |
AC |
7 ms |
640 KB |
16.txt |
AC |
12 ms |
640 KB |
17.txt |
AC |
12 ms |
640 KB |
18.txt |
AC |
1 ms |
256 KB |
19.txt |
AC |
1 ms |
256 KB |
20.txt |
AC |
1 ms |
256 KB |
21.txt |
AC |
1 ms |
256 KB |
22.txt |
AC |
1 ms |
256 KB |
s1.txt |
AC |
1 ms |
256 KB |
s2.txt |
AC |
1 ms |
256 KB |