提出 #72399735


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;
#define int long long

const int N = 2e5 + 5;

signed main()
{
	int t;
	cin >> t;
	while(t--)
	{
		int n,w;
		cin >> n >> w;
		vector <int> c(2 * w);
		for(int i = 1;i <= n;i++) 
		{
			int x;
			cin >> x;
			c[i % (2 * w)] += x;
		}
		int sum = 0;
		for(int i = 0;i < w;i++) sum += c[i];
		int minn = sum;
		for(int i = 0;i < 2 * w;i++) 
		{
			sum -= c[i];
			sum += c[(i + w) % (2 * w)];
			minn = min(minn,sum);
		}
		cout << minn << endl;
	}
	return 0;
}

提出情報

提出日時
問題 C - Striped Horse
ユーザ rgr2025
言語 C++23 (GCC 15.2.0)
得点 300
コード長 538 Byte
結果 AC
実行時間 52 ms
メモリ 6620 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 1
AC × 27
セット名 テストケース
Sample sample_01.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, sample_01.txt
ケース名 結果 実行時間 メモリ
random_01.txt AC 27 ms 3548 KiB
random_02.txt AC 27 ms 3528 KiB
random_03.txt AC 29 ms 3552 KiB
random_04.txt AC 29 ms 3660 KiB
random_05.txt AC 47 ms 3668 KiB
random_06.txt AC 47 ms 4052 KiB
random_07.txt AC 48 ms 3824 KiB
random_08.txt AC 48 ms 4288 KiB
random_09.txt AC 47 ms 3668 KiB
random_10.txt AC 47 ms 3788 KiB
random_11.txt AC 48 ms 3676 KiB
random_12.txt AC 49 ms 4920 KiB
random_13.txt AC 49 ms 3732 KiB
random_14.txt AC 49 ms 4280 KiB
random_15.txt AC 47 ms 3732 KiB
random_16.txt AC 47 ms 4180 KiB
random_17.txt AC 47 ms 3644 KiB
random_18.txt AC 47 ms 3528 KiB
random_19.txt AC 47 ms 3524 KiB
random_20.txt AC 47 ms 3668 KiB
random_21.txt AC 4 ms 3512 KiB
random_22.txt AC 3 ms 5792 KiB
random_23.txt AC 50 ms 6620 KiB
random_24.txt AC 49 ms 4928 KiB
random_25.txt AC 48 ms 3780 KiB
random_26.txt AC 52 ms 4928 KiB
sample_01.txt AC 1 ms 3528 KiB