Submission #845979
Source Code Expand
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> #include <list> using namespace std; typedef long long ll; #define sz size() #define pb push_back #define mp make_pair #define fi first #define se second #define all(c) (c).begin(), (c).end() #define rep(i,a,b) for(ll i=(a);i<(b);++i) #define clr(a, b) memset((a), (b) ,sizeof(a)) #define ctos(d) string(1,d) #define print(x) cout<<#x<<" = "<<x<<endl; #define MOD 1000000007 int main() { ll n; cin>>n; ll ans = 0; vector<ll> v; rep(i,0,n){ ll a; cin>>a; v.pb(a); } rep(i,0,v.sz-1){ ans += v[i]/2; v[i] = v[i]%2; if(v[i]==1&&v[i+1]>0){ v[i]--; v[i+1]--; ans++; } } ans += v[v.sz-1]/2; cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Simplified mahjong |
User | nmnmnmnmnmnmnm |
Language | C++14 (GCC 5.4.1) |
Score | 400 |
Code Size | 1110 Byte |
Status | AC |
Exec Time | 82 ms |
Memory | 1400 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 | 77 ms | 1400 KB |
02.txt | AC | 77 ms | 1400 KB |
03.txt | AC | 81 ms | 1400 KB |
04.txt | AC | 59 ms | 1400 KB |
05.txt | AC | 57 ms | 1400 KB |
06.txt | AC | 57 ms | 1400 KB |
07.txt | AC | 69 ms | 1400 KB |
08.txt | AC | 77 ms | 1400 KB |
09.txt | AC | 78 ms | 1400 KB |
10.txt | AC | 77 ms | 1400 KB |
11.txt | AC | 35 ms | 1400 KB |
12.txt | AC | 82 ms | 1400 KB |
13.txt | AC | 77 ms | 1400 KB |
14.txt | AC | 81 ms | 1400 KB |
15.txt | AC | 36 ms | 1400 KB |
16.txt | AC | 78 ms | 1400 KB |
17.txt | AC | 77 ms | 1400 KB |
18.txt | AC | 4 ms | 256 KB |
19.txt | AC | 4 ms | 256 KB |
20.txt | AC | 4 ms | 256 KB |
21.txt | AC | 4 ms | 256 KB |
22.txt | AC | 4 ms | 256 KB |
s1.txt | AC | 4 ms | 256 KB |
s2.txt | AC | 4 ms | 256 KB |