Submission #1840295
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
const long long INF = 123456789;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i, r, n) for (ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i, r, n) for (ll i = (ll)(n - 1); i >= r; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define RALL(x) x.rbegin(), x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<pair<ll, ll>> vp;
typedef vector<string> vs;
//typedef vector<char> vc;
typedef list<ll> lst;
ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;
#define Endl endl
/*--------------------template--------------------*/
vi v(n);
vi vc;
ll calc()
{
ll a = 0;
REP(i, vc.size())
{
if (i % 2 == 0)
{
a += vc[i];
}
}
return a;
}
int main()
{
cin >> n;
REP(i, n)
{
cin >> v[i];
}
REP(i, n)
{
FOR(j, i, n)
{
vc.push_back(v[j]);
ll re = calc();
ans = max(ans, re);
}
vc.clear();
}
cout << ans << endl;
}
Submission Info
Submission Time |
|
Task |
C - 数列ゲーム |
User |
tettchan |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1193 Byte |
Status |
RE |
Exec Time |
97 ms |
Memory |
256 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 100 |
Status |
|
|
Set Name |
Test Cases |
Sample |
sample-01.txt, sample-02.txt, sample-03.txt |
All |
sample-01.txt, sample-02.txt, sample-03.txt, test-01.txt, test-02.txt, test-03.txt, test-04.txt, test-05.txt, test-06.txt, test-07.txt, test-08.txt, test-09.txt, test-10.txt, test-11.txt, test-12.txt, test-13.txt, test-14.txt, test-15.txt, test-16.txt, test-17.txt, test-18.txt, test-19.txt, test-20.txt |
Case Name |
Status |
Exec Time |
Memory |
sample-01.txt |
RE |
96 ms |
256 KB |
sample-02.txt |
RE |
95 ms |
256 KB |
sample-03.txt |
RE |
96 ms |
256 KB |
test-01.txt |
RE |
95 ms |
256 KB |
test-02.txt |
RE |
96 ms |
256 KB |
test-03.txt |
RE |
97 ms |
256 KB |
test-04.txt |
RE |
96 ms |
256 KB |
test-05.txt |
RE |
96 ms |
256 KB |
test-06.txt |
RE |
96 ms |
256 KB |
test-07.txt |
RE |
96 ms |
256 KB |
test-08.txt |
RE |
96 ms |
256 KB |
test-09.txt |
RE |
96 ms |
256 KB |
test-10.txt |
RE |
96 ms |
256 KB |
test-11.txt |
RE |
96 ms |
256 KB |
test-12.txt |
RE |
95 ms |
256 KB |
test-13.txt |
RE |
97 ms |
256 KB |
test-14.txt |
RE |
96 ms |
256 KB |
test-15.txt |
RE |
97 ms |
256 KB |
test-16.txt |
RE |
96 ms |
256 KB |
test-17.txt |
RE |
96 ms |
256 KB |
test-18.txt |
RE |
96 ms |
256 KB |
test-19.txt |
RE |
96 ms |
256 KB |
test-20.txt |
RE |
96 ms |
256 KB |