結果

問題 No.1093 区間の和 / Sum of Range
ユーザー fgwiebfaoishfgwiebfaoish
提出日時 2020-06-26 16:28:25
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 168 ms / 2,000 ms
コード長 3,045 bytes
コンパイル時間 5,049 ms
コンパイル使用メモリ 105,736 KB
実行使用メモリ 38,692 KB
最終ジャッジ日時 2023-09-17 04:50:15
合計ジャッジ時間 9,125 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
20,780 KB
testcase_01 AC 114 ms
29,592 KB
testcase_02 AC 81 ms
23,896 KB
testcase_03 AC 103 ms
28,064 KB
testcase_04 AC 97 ms
28,380 KB
testcase_05 AC 123 ms
31,664 KB
testcase_06 AC 84 ms
26,560 KB
testcase_07 AC 105 ms
31,124 KB
testcase_08 AC 119 ms
36,300 KB
testcase_09 AC 109 ms
31,752 KB
testcase_10 AC 111 ms
34,368 KB
testcase_11 AC 118 ms
31,500 KB
testcase_12 AC 113 ms
31,792 KB
testcase_13 AC 64 ms
23,372 KB
testcase_14 AC 120 ms
33,296 KB
testcase_15 AC 91 ms
25,456 KB
testcase_16 AC 150 ms
34,696 KB
testcase_17 AC 114 ms
29,424 KB
testcase_18 AC 102 ms
28,452 KB
testcase_19 AC 68 ms
21,892 KB
testcase_20 AC 93 ms
24,892 KB
testcase_21 AC 130 ms
32,028 KB
testcase_22 AC 142 ms
34,720 KB
testcase_23 AC 108 ms
29,204 KB
testcase_24 AC 94 ms
30,084 KB
testcase_25 AC 115 ms
29,008 KB
testcase_26 AC 126 ms
34,540 KB
testcase_27 AC 121 ms
29,700 KB
testcase_28 AC 123 ms
32,796 KB
testcase_29 AC 168 ms
38,692 KB
testcase_30 AC 77 ms
20,028 KB
testcase_31 AC 89 ms
27,232 KB
testcase_32 AC 92 ms
25,772 KB
testcase_33 AC 139 ms
35,212 KB
testcase_34 AC 67 ms
23,444 KB
testcase_35 AC 118 ms
29,944 KB
testcase_36 AC 141 ms
36,980 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
//using nint=System.Int32;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Ia;
		var a=sc.La3(0);
		var b=new long[s[0]-s[1]+1];
		long d=0;
		for(int i = s[0]-1;i>=0;i--) {
			d+=a[i];
			if(i<=s[0]-s[1]){
				d-=a[i+s[1]];
				b[i]=d;
			}
		}
		Array.Sort(b);
		var q=sc.I;
		StringBuilder sb=new StringBuilder();
		for(int i = 0;i<q;i++) {
			var e=sc.I;
			sb.Append(b.Bs(e+1,true)+1+"\n");
		}
		Console.Write(sb);
	}
}
static class Ex1{
	public static int Bs(this long[] a,int x,bool b){return Bs2(a,x,b,a.Length);}
	public static int Bs(this long[] a,int x,bool b,int ub){return Bs2(a,x,b,ub+1);}
	private static int Bs2(long[] a,int x,bool b,int ub){
		int lb=-1,mid=0;
		while(ub-lb>1){
			mid=(ub+lb)/2;
			if(a[mid]>=x){ub=mid;}
			else{lb=mid;}
		}
		return b?lb:ub;
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),int.Parse);}
	public int[] Ia3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),long.Parse);}
	public long[] La3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}
0