Submission #71809065


Source Code Expand

#include <bits/stdc++.h>
#include <cmath>
#include <algorithm>
#include <iostream>
using namespace std;
using namespace std::chrono;
using ll = long long;
using ull = unsigned long long;
#define COUT(num,len) cout << fixed << setprecision(len) << num;
#define ALL(x) (x).begin(), (x).end()
#define coutY cout << "Yes" << endl;
#define coutN cout << "No" << endl;
#define arrIn(arr, start, N) for (int i = (start); i < (N); ++i) cin >> arr[i];
#define arrOut(arr, start, N) for  (int i = (start); i < (N); ++i) { cout << arr[i] <<" "; } cout << endl;
#define arrCopy(arr1,arr2, start, N) for (int i = (start); i < (N); ++i) arr2[i]= arr1[i];
void yn(bool tf) { cout << (tf ? "Yes\n" : "No\n"); }
void YN(bool tf) { cout << (tf ? "YES\n" : "NO\n"); }
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string abc="abcdefghijklmnopqrstuvwxyz";

//cout << fixed << setprecision(20) <<

ll gcd(ll a, ll b){ //最大公約数
  if(a%b == 0){
    return b;
  }else{
    return gcd(b, a%b);
  }
}

ll lcm(ll a, ll b){ //最小公倍数
  return a*b / gcd(a, b);
}

auto start = high_resolution_clock::now();

bool CheckTime(auto limit,auto eps){
  auto end = high_resolution_clock::now();
  return  duration_cast<milliseconds>(end - start).count()<limit-eps;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  ll N,X;
  cin >> N >> X;
  vector<ll> L(N);
  ll stop=1;
  vector<vector<double>> a(N);
  for(ll i=0;i<N;i++){
    cin >> L[i];
    stop*=L[i];
    for(ll j=0;j<L[i];j++){
      ll input;
      cin >> input;
      a[i].push_back(input);
    }
  }
  ll count=0;
  
  ll k=0;
  double big=1000000000000000000;
  while(k<stop){
    double check=1;
    ll k2=k;
    for(ll i=N-1;i>-1;i--){
      check*=a[i][k2%L[i]];
      if(check>big||check<=0){
        break;
      }
      k2/=L[i];
    }
    if(check==X){
      count++;
    }

    k++;
  }
  cout << count << endl;

  return 0;
}

Submission Info

Submission Time
Task C - Product
User UT0911
Language C++23 (GCC 15.2.0)
Score 0
Code Size 1988 Byte
Status WA
Exec Time 6 ms
Memory 4076 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 21
WA × 1
Set Name Test Cases
Sample example0.txt, example1.txt, example2.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, example0.txt, example1.txt, example2.txt, killer001.txt
Case Name Status Exec Time Memory
000.txt AC 2 ms 3612 KiB
001.txt AC 2 ms 3584 KiB
002.txt AC 2 ms 3608 KiB
003.txt AC 4 ms 3536 KiB
004.txt AC 6 ms 3636 KiB
005.txt AC 4 ms 3476 KiB
006.txt AC 3 ms 3792 KiB
007.txt AC 4 ms 4076 KiB
008.txt AC 1 ms 3608 KiB
009.txt AC 1 ms 3476 KiB
010.txt AC 1 ms 3724 KiB
011.txt AC 2 ms 3476 KiB
012.txt AC 1 ms 3608 KiB
013.txt AC 3 ms 3624 KiB
014.txt AC 1 ms 3552 KiB
015.txt AC 3 ms 3476 KiB
016.txt AC 1 ms 3720 KiB
017.txt AC 2 ms 3604 KiB
example0.txt AC 1 ms 3720 KiB
example1.txt AC 1 ms 3608 KiB
example2.txt AC 1 ms 3720 KiB
killer001.txt WA 1 ms 3536 KiB