Submission #882386


Source Code Expand

/*
	Swamy Saranam

	Date	: 14/09/2016 22:45:26
	Author	: Krishna Mohan A M
	Problem	:
	Status	:
*/
#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

typedef long long ll;
typedef pair<int,int>	pii;
typedef pair<ld,ld>	pdd;
typedef vector<int> vi;
typedef vector<ld> vd;
typedef pair<ll,ll> pl;

#define FASTIO          ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define FOR(i,a,b)		for(int i=(a);i<(b);i++)
#define REP(i,n)		FOR(i,0,n)
#define SORT(v)			sort((v).begin(),(v).end())
#define UN(v)			SORT(v),(v).erase(unique((v).begin(),(v).end()),(v).end())
#define CL(a,b)			memset(a,b,sizeof a)
#define pb				push_back
#define x               first
#define y               second
#define endl            "\n"
#define sendl           " \n"

const int mod = 1000000007;
ll n, tmp;
ll ans;
vector<ll> dat;

int main()
{
    FASTIO
    cin>>n;
    dat.resize(n+3, 0);
    REP(i, n){
      cin>>dat[i+1];
      //ans += tmp/2;
    }
    REP(i, dat.size()-1){
      ans += dat[i]/2;
      dat[i]%=2;
      if(dat[i]&&dat[i+1]){
        ans++;
        --dat[i];
        --dat[i+1];
      }
    }
    cout<<ans<<endl;
    return 0;
}

Submission Info

Submission Time
Task B - Simplified mahjong
User krishnaanaril
Language C++14 (GCC 5.4.1)
Score 400
Code Size 1227 Byte
Status AC
Exec Time 24 ms
Memory 1024 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 2
AC × 24
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 24 ms 1024 KiB
02.txt AC 24 ms 1024 KiB
03.txt AC 24 ms 1024 KiB
04.txt AC 20 ms 1024 KiB
05.txt AC 20 ms 1024 KiB
06.txt AC 20 ms 1024 KiB
07.txt AC 22 ms 1024 KiB
08.txt AC 22 ms 1024 KiB
09.txt AC 24 ms 1024 KiB
10.txt AC 24 ms 1024 KiB
11.txt AC 15 ms 1024 KiB
12.txt AC 24 ms 1024 KiB
13.txt AC 23 ms 1024 KiB
14.txt AC 23 ms 1024 KiB
15.txt AC 16 ms 1024 KiB
16.txt AC 24 ms 1024 KiB
17.txt AC 24 ms 1024 KiB
18.txt AC 4 ms 256 KiB
19.txt AC 4 ms 256 KiB
20.txt AC 4 ms 256 KiB
21.txt AC 4 ms 256 KiB
22.txt AC 4 ms 256 KiB
s1.txt AC 4 ms 256 KiB
s2.txt AC 4 ms 256 KiB