Submission #720949
Source Code Expand
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(){
int n, k;
unsigned int sum[2] = { 0, 0 };
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; i++){
cin >> a[i];
}
for (int i = 0; i < n - k + 1; i++){
for (int j = i; j < k+i; j++){
sum[0] += a[j];
if (sum[0] > 1000000000){
sum[1] += sum[0] / 1000000000;
sum[0] = sum[0] % 1000000000;
}
}
}
if (sum[1] != 0){
cout << sum[1] << sum[0] << endl;
}
else{
cout << sum[0] << endl;
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - 総和 |
| User | nigg |
| Language | C++14 (Clang 3.8.0) |
| Score | 50 |
| Code Size | 547 Byte |
| Status | TLE |
| Exec Time | 2105 ms |
| Memory | 640 KiB |
Judge Result
| Set Name | sample | subtask1 | subtask2 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 50 / 50 | 0 / 50 | ||||||||
| Status |
|
|
|
| Set Name | Test Cases |
|---|---|
| sample | sample01.txt, sample02.txt |
| subtask1 | 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, sample01.txt, sample02.txt |
| subtask2 | 00.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, sample01.txt, sample02.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00.txt | AC | 4 ms | 256 KiB |
| 01.txt | AC | 4 ms | 256 KiB |
| 02.txt | AC | 4 ms | 256 KiB |
| 03.txt | AC | 7 ms | 256 KiB |
| 04.txt | AC | 6 ms | 256 KiB |
| 05.txt | AC | 6 ms | 256 KiB |
| 06.txt | AC | 6 ms | 256 KiB |
| 07.txt | AC | 6 ms | 256 KiB |
| 08.txt | AC | 6 ms | 256 KiB |
| 09.txt | AC | 6 ms | 256 KiB |
| 10.txt | AC | 6 ms | 256 KiB |
| 11.txt | AC | 188 ms | 640 KiB |
| 12.txt | AC | 214 ms | 640 KiB |
| 13.txt | TLE | 2105 ms | 640 KiB |
| 14.txt | TLE | 2105 ms | 640 KiB |
| 15.txt | AC | 187 ms | 640 KiB |
| 16.txt | AC | 189 ms | 640 KiB |
| 17.txt | TLE | 2105 ms | 640 KiB |
| 18.txt | AC | 1350 ms | 640 KiB |
| 19.txt | TLE | 2105 ms | 640 KiB |
| sample01.txt | AC | 4 ms | 256 KiB |
| sample02.txt | AC | 4 ms | 256 KiB |