AtCoder Beginner Contest 032

Submission #6911706

Source codeソースコード

#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n, k; cin >> n >> k;
  V<> a(n); for (auto&& e : a) cin >> e;
  if (find(begin(a), end(a), 0) != end(a)) {
    return cout << n << '\n', 0;
  }
  int r = 0, res = 0;
  lint p = 1;
  for (int l = 0; l < n; ++l) {
    while (r < n and p * a[r] <= k) {
      p *= a[r++];
    }
    res = max(res, r - l);
    if (l < r) {
      p /= a[l];
    } else {
      r = l + 1;
    }
  }
  cout << res << '\n';
}

Submission

Task問題 C - 列
User nameユーザ名 risujiroh
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 100
Source lengthソースコード長 657 Byte
File nameファイル名
Exec time実行時間 13 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 1 ms 256 KB
subtask1_04.txt AC 1 ms 256 KB
subtask1_05.txt AC 1 ms 256 KB
subtask1_06.txt AC 1 ms 256 KB
subtask1_07.txt AC 1 ms 256 KB
subtask1_08.txt AC 1 ms 256 KB
subtask1_09.txt AC 1 ms 256 KB
subtask1_10.txt AC 1 ms 256 KB
subtask1_11.txt AC 1 ms 256 KB
subtask1_12.txt AC 1 ms 256 KB
subtask1_13.txt AC 1 ms 256 KB
subtask1_14.txt AC 1 ms 256 KB
subtask1_15.txt AC 1 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 7 ms 640 KB
subtask2_02.txt AC 8 ms 640 KB
subtask2_03.txt AC 13 ms 640 KB
subtask2_04.txt AC 8 ms 640 KB
subtask2_05.txt AC 11 ms 640 KB
subtask2_06.txt AC 11 ms 640 KB
subtask2_07.txt AC 9 ms 640 KB
subtask2_08.txt AC 9 ms 640 KB
subtask2_09.txt AC 9 ms 640 KB
subtask2_10.txt AC 9 ms 640 KB
subtask2_11.txt AC 9 ms 640 KB
subtask2_12.txt AC 10 ms 640 KB
subtask2_13.txt AC 10 ms 640 KB
subtask2_14.txt AC 10 ms 640 KB
subtask2_15.txt AC 13 ms 640 KB
subtask2_16.txt AC 8 ms 640 KB
subtask2_17.txt AC 8 ms 640 KB