Submission #606259


Source Code Expand

#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define gep(i,g,j) for(int i = g.head[j]; i != -1; i = g.e[i].next)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}

const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;

// Segment tree (RMQ type)
struct seg {
  vector<int> d; int x2;
  seg(){}
  seg(int mx) {
    x2 = 1; while(x2 < mx) x2 <<= 1;
    d.resize(x2<<1);
  }
  void mul(int& x, int y) {
    if ((ll)x*y > INF) x = INF;
    else x *= y;
  }
  void fil() {
    drep(i,x2) {
      d[i] = 1;
      mul(d[i],d[i<<1]);
      mul(d[i],d[i<<1|1]);
    }
  }
  int get(int a, int b, int i=1, int l=0, int r=-1){
    if (r == -1) r = x2;
    if(a <= l && r <= b) return d[i];
    int c = (l+r)>>1;
    int res = 1;
    if(a < c) mul(res,get(a,b,i<<1,l,c));
    if(c < b) mul(res,get(a,b,i<<1|1,c,r));
    return res;
  }
};
//

int main() {
  int n, m;
  scanf("%d%d",&n,&m);
  seg t(n+2);
  rep(i,n) {
    scanf("%d",&t.d[t.x2+i]);
    if (t.d[t.x2+i] == 0) {
      cout<<n<<endl;
      return 0;
    }
  }
  t.fil();
  // cout<<t.get(0,2)<<endl;
  int ans = 0;
  rep(i,n) {
    int l = i, r = n, c;
    while (l+1<r) {
      c = (l+r)>>1;
      if (t.get(i,c) <= m) l = c; else r = c;
    }
    maxs(ans, l-i);
  }
  cout<<ans<<endl;
  return 0;
}





Submission Info

Submission Time
Task C - 列
User snuke
Language C++11 (GCC 4.9.2)
Score 0
Code Size 2298 Byte
Status WA
Exec Time 494 ms
Memory 1952 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:79:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d",&n,&m);
                      ^
./Main.cpp:82:29: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&t.d[t.x2+i]);
                             ^

Judge Result

Set Name Sample Subtask1 Subtask2
Score / Max Score 0 / 0 0 / 20 0 / 80
Status
AC × 4
AC × 24
WA × 3
AC × 40
WA × 4
Set Name Test Cases
Sample subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt, subtask0_sample_04.txt
Subtask1 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 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
Case Name Status Exec Time Memory
subtask0_sample_01.txt AC 25 ms 920 KB
subtask0_sample_02.txt AC 26 ms 916 KB
subtask0_sample_03.txt AC 27 ms 720 KB
subtask0_sample_04.txt AC 26 ms 916 KB
subtask1_01.txt AC 28 ms 792 KB
subtask1_02.txt WA 28 ms 808 KB
subtask1_03.txt AC 28 ms 792 KB
subtask1_04.txt AC 28 ms 808 KB
subtask1_05.txt AC 30 ms 920 KB
subtask1_06.txt AC 29 ms 796 KB
subtask1_07.txt AC 29 ms 916 KB
subtask1_08.txt AC 28 ms 796 KB
subtask1_09.txt AC 29 ms 920 KB
subtask1_10.txt AC 29 ms 804 KB
subtask1_11.txt AC 27 ms 924 KB
subtask1_12.txt AC 27 ms 724 KB
subtask1_13.txt AC 27 ms 920 KB
subtask1_14.txt AC 28 ms 800 KB
subtask1_15.txt AC 27 ms 808 KB
subtask1_16.txt WA 28 ms 924 KB
subtask1_17.txt WA 27 ms 796 KB
subtask1_corner.txt AC 25 ms 920 KB
subtask1_killer1.txt AC 27 ms 924 KB
subtask1_killer2.txt AC 27 ms 920 KB
subtask1_killer3.txt AC 26 ms 924 KB
subtask1_killer4.txt AC 27 ms 796 KB
subtask1_killer5.txt AC 25 ms 800 KB
subtask2_01.txt AC 403 ms 1832 KB
subtask2_02.txt WA 494 ms 1824 KB
subtask2_03.txt AC 427 ms 1776 KB
subtask2_04.txt AC 442 ms 1832 KB
subtask2_05.txt AC 416 ms 1952 KB
subtask2_06.txt AC 417 ms 1824 KB
subtask2_07.txt AC 436 ms 1812 KB
subtask2_08.txt AC 437 ms 1868 KB
subtask2_09.txt AC 437 ms 1944 KB
subtask2_10.txt AC 437 ms 1948 KB
subtask2_11.txt AC 437 ms 1948 KB
subtask2_12.txt AC 424 ms 1820 KB
subtask2_13.txt AC 426 ms 1832 KB
subtask2_14.txt AC 428 ms 1820 KB
subtask2_15.txt AC 425 ms 1836 KB
subtask2_16.txt AC 488 ms 1828 KB
subtask2_17.txt AC 491 ms 1824 KB