# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
105962 | 2019-04-16T02:53:49 Z | xiaowuc1 | Hacker (BOI15_hac) | C++14 | 737 ms | 16228 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(i >= 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 | Incorrect | 3 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Incorrect | 3 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Correct | 3 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 512 KB | Output is correct |
4 | Correct | 54 ms | 2936 KB | Output is correct |
5 | Correct | 194 ms | 6776 KB | Output is correct |
6 | Correct | 268 ms | 8312 KB | Output is correct |
7 | Correct | 303 ms | 9976 KB | Output is correct |
8 | Correct | 737 ms | 16228 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Incorrect | 3 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |