Submission #45047862
Source Code Expand
#include <iostream> #include <vector> using namespace std; int main(void) { int n = 0, k = 0; double ans = 0; cin >> n >> k; vector<double> s(n + 1); for (int i = 0; i < n; i++) { double p = 0; cin >> p; s[i + 1] = s[i] + (p + 1) / 2; } for (int i = k; i <= n; i++) { /* edit 1: 上と同じループで処理すると、n + 1を含む選び方が最も大きいときに探索しきれない */ double t = s[i] - s[i - k]; if (t > ans) ans = t; } cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Dice in Line |
User | coolwind0202 |
Language | C++ (GCC 9.2.1) |
Score | 0 |
Code Size | 584 Byte |
Status | WA |
Exec Time | 64 ms |
Memory | 4840 KiB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 400 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 01.txt, 02.txt, 03.txt |
All | 01.txt, 02.txt, 03.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 8 ms | 3668 KiB |
02.txt | AC | 6 ms | 3680 KiB |
03.txt | AC | 2 ms | 3692 KiB |
10.txt | WA | 60 ms | 4608 KiB |
11.txt | WA | 48 ms | 4684 KiB |
12.txt | AC | 57 ms | 4744 KiB |
13.txt | WA | 53 ms | 4796 KiB |
14.txt | AC | 57 ms | 4792 KiB |
15.txt | AC | 3 ms | 3684 KiB |
16.txt | AC | 2 ms | 3664 KiB |
17.txt | AC | 2 ms | 3696 KiB |
18.txt | AC | 56 ms | 4748 KiB |
19.txt | AC | 57 ms | 4608 KiB |
20.txt | AC | 64 ms | 4840 KiB |