AtCoder Beginner Contest 032

Submission #1691552

Source codeソースコード

#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,0,-1,1,0,0};
const ld PI=abs(acos(-1));
int n,k,a[100010];

int main(){
	cin >> n >> k;
	REP(i,0,n){
		cin >> a[i];
		if(!a[i]){cout << n << endl; return 0;}
	}
	
	int l=0,ma=0; ll pos=1;
	REP(i,0,n){
		pos*=a[i];
		if(pos>k) while(l<i and pos>k) pos/=a[l],l++;
		else ma=max(ma,i-l+1);
	}
	
	cout << ma << endl;
	return 0;
}

Submission

Task問題 C - 列
User nameユーザ名 ecasdqina
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 100
Source lengthソースコード長 583 Byte
File nameファイル名
Exec time実行時間 59 ms
Memory usageメモリ使用量 640 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - subtask0_sample_01.txt,subtask0_sample_02.txt,subtask0_sample_03.txt,subtask0_sample_04.txt
Subtask1 20 / 20 subtask0_sample_01.txt,subtask0_sample_02.txt,subtask0_sample_03.txt,subtask0_sample_04.txt,subtask1_01.txt,subtask1_02.txt,subtask1_03.txt,subtask1_04.txt,subtask1_05.txt,subtask1_06.txt,subtask1_07.txt,subtask1_08.txt,subtask1_09.txt,subtask1_10.txt,subtask1_11.txt,subtask1_12.txt,subtask1_13.txt,subtask1_14.txt,subtask1_15.txt,subtask1_16.txt,subtask1_17.txt,subtask1_corner.txt,subtask1_killer1.txt,subtask1_killer2.txt,subtask1_killer3.txt,subtask1_killer4.txt,subtask1_killer5.txt
Subtask2 80 / 80 subtask0_sample_01.txt,subtask0_sample_02.txt,subtask0_sample_03.txt,subtask0_sample_04.txt,subtask1_01.txt,subtask1_02.txt,subtask1_03.txt,subtask1_04.txt,subtask1_05.txt,subtask1_06.txt,subtask1_07.txt,subtask1_08.txt,subtask1_09.txt,subtask1_10.txt,subtask1_11.txt,subtask1_12.txt,subtask1_13.txt,subtask1_14.txt,subtask1_15.txt,subtask1_16.txt,subtask1_17.txt,subtask1_corner.txt,subtask1_killer1.txt,subtask1_killer2.txt,subtask1_killer3.txt,subtask1_killer4.txt,subtask1_killer5.txt,subtask2_01.txt,subtask2_02.txt,subtask2_03.txt,subtask2_04.txt,subtask2_05.txt,subtask2_06.txt,subtask2_07.txt,subtask2_08.txt,subtask2_09.txt,subtask2_10.txt,subtask2_11.txt,subtask2_12.txt,subtask2_13.txt,subtask2_14.txt,subtask2_15.txt,subtask2_16.txt,subtask2_17.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
subtask0_sample_01.txt AC 1 ms 256 KB
subtask0_sample_02.txt AC 1 ms 256 KB
subtask0_sample_03.txt AC 1 ms 256 KB
subtask0_sample_04.txt AC 1 ms 256 KB
subtask1_01.txt AC 1 ms 256 KB
subtask1_02.txt AC 1 ms 256 KB
subtask1_03.txt AC 2 ms 256 KB
subtask1_04.txt AC 1 ms 256 KB
subtask1_05.txt AC 2 ms 256 KB
subtask1_06.txt AC 2 ms 256 KB
subtask1_07.txt AC 2 ms 256 KB
subtask1_08.txt AC 1 ms 256 KB
subtask1_09.txt AC 2 ms 256 KB
subtask1_10.txt AC 1 ms 256 KB
subtask1_11.txt AC 1 ms 256 KB
subtask1_12.txt AC 2 ms 256 KB
subtask1_13.txt AC 2 ms 256 KB
subtask1_14.txt AC 2 ms 256 KB
subtask1_15.txt AC 2 ms 256 KB
subtask1_16.txt AC 1 ms 256 KB
subtask1_17.txt AC 1 ms 256 KB
subtask1_corner.txt AC 1 ms 256 KB
subtask1_killer1.txt AC 1 ms 256 KB
subtask1_killer2.txt AC 1 ms 256 KB
subtask1_killer3.txt AC 1 ms 256 KB
subtask1_killer4.txt AC 1 ms 256 KB
subtask1_killer5.txt AC 1 ms 256 KB
subtask2_01.txt AC 20 ms 640 KB
subtask2_02.txt AC 19 ms 640 KB
subtask2_03.txt AC 55 ms 640 KB
subtask2_04.txt AC 21 ms 640 KB
subtask2_05.txt AC 59 ms 640 KB
subtask2_06.txt AC 54 ms 640 KB
subtask2_07.txt AC 21 ms 640 KB
subtask2_08.txt AC 22 ms 640 KB
subtask2_09.txt AC 21 ms 640 KB
subtask2_10.txt AC 21 ms 640 KB
subtask2_11.txt AC 21 ms 640 KB
subtask2_12.txt AC 27 ms 640 KB
subtask2_13.txt AC 29 ms 640 KB
subtask2_14.txt AC 29 ms 640 KB
subtask2_15.txt AC 59 ms 640 KB
subtask2_16.txt AC 20 ms 640 KB
subtask2_17.txt AC 20 ms 640 KB