# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
581005 |
2022-06-22T08:10:05 Z |
ktkerem |
Hacker (BOI15_hac) |
C++17 |
|
1 ms |
212 KB |
/*#pragma GCC target ("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include<bits/stdc++.h>
/*#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
template<class T>
using oset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
/**/
//typedef int ll;
typedef long long ll;
typedef unsigned long long ull;
typedef __int128 vll;
typedef unsigned __int128 uvll;
ll _i=0;
#define ffn(x) _i=x
#define llll std::pair<ll , ll>
#define stitr set<ll>::iterator
#define fora(y,x) for(ll y=_i;x>y;y++)
#define pb push_back
#define pf push_front
#define halo cout << "hello\n"
#define fi first
#define sec second
#define all(a) a.begin() , a.end()
const ll limit = 1e18 + 7;
const ll ous = 3e5;
const ll dx[4] = {1 , 0 , 0 , -1} , dy[4] = {0,1,-1,0};
void solve(){
ll n;std::cin >> n;
ll ar[n];
fora(i, n){
std::cin >> ar[i];
}
ll p = 0;
std::vector<ll> ns;
for(ll i = 0;n/2 + (n & 1) > i;i++){
p+=ar[i];
}
ns.pb(p);
for(ll i = n/2 + (n & 1);n + n/2 + (n & 1) - 1 > i;i++){
p-= ar[(i-(n/2 + (n & 1))) % n];
p+= ar[i % n];
ns.pb(p);
}
sort(all(ns));
std::cout << ns[n/2 + (n % 2 != 0)] << "\n";
return;/**/
}
signed main(){
std::ios_base::sync_with_stdio(false);std::cin.tie(NULL);
ll t=1;
//std::cin >> t;
ll o = 1;
while(t--){
//cout << "Case " << o++ << ":\n";
solve();
}
return 0;
}
Compilation message
hac.cpp:12:1: warning: "/*" within comment [-Wcomment]
12 | /**/
|
hac.cpp: In function 'int main()':
hac.cpp:57:8: warning: unused variable 'o' [-Wunused-variable]
57 | ll o = 1;
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |