# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
105961 | 2019-04-16T02:53:12 Z | xiaowuc1 | Hacker (BOI15_hac) | C++14 | 637 ms | 18508 KB |
#include <algorithm> #include <cassert> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<int, pii> pipii; typedef vector<vector<ll>> matrix; int l[1000000]; int maxV[1000000]; void solve() { int n; cin >> n; for(int i = 0; i < n; i++) { cin >> l[i]; } int sz = (n+1)/2; int curr = 0; for(int i = 0; true; i++) { curr += l[i%n]; if(i >= sz) { curr -= l[i-sz]; } if(maxV[i%n]) break; if(i >= sz-1) { maxV[i%n] = curr; } } int ret = 0; multiset<int> all; for(int i = 0; true; i++) { if(i > sz-1 && i%n == sz-1) break; all.insert(maxV[i%n]); if(all.size() > sz) { all.erase(maxV[(i-sz)]); } if(all.size() == sz) { ret = max(ret, *all.begin()); } } cout << ret << endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); /* int t; cin >> t; for(int i = 1; i <= t; i++) { cout << "Case #" << i << ": "; solve(); } */ solve(); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Incorrect | 2 ms | 384 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Incorrect | 2 ms | 384 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 512 KB | Output is correct |
4 | Correct | 66 ms | 3292 KB | Output is correct |
5 | Correct | 199 ms | 7988 KB | Output is correct |
6 | Correct | 272 ms | 9976 KB | Output is correct |
7 | Correct | 272 ms | 11256 KB | Output is correct |
8 | Correct | 637 ms | 18508 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Incorrect | 2 ms | 384 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |