Submission #19580902


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;

int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
  vector<string> T(N);
  for(int i=0;i<N;i++){
    cin >> T.at(i);
  }
  const int64_t mod=1e9+7;
  queue<int> que;
  que.emplace(0);
  int64_t ans=0;
  vector<vector<int> > v(S.size());
  vector<bool> flag(S.size(),false);
  while(!que.empty()){
    int x=que.front();
    que.pop();
    if(x>=S.size()){
      ans++;
      ans%=mod;
      continue;
    }
    if(flag.at(x)){
      for(auto &y:v.at(x)){
        que.emplace(y);
      }
    }else{
      flag.at(x)=true;
      for(int i=0;i<N;i++){
        if(T.at(i).at(0)==S.at(x)&&T.at(i)==S.substr(x,T.at(i).size())){
          v.at(x).emplace_back(x+T.at(i).size());
          que.emplace(x+T.at(i).size());
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Submission Info

Submission Time
Task B - エターナルスタティックファイナル
User Fshinya
Language C++ (GCC 9.2.1)
Score 0
Code Size 875 Byte
Status TLE
Exec Time 2285 ms
Memory 3046484 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:22:9: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   22 |     if(x>=S.size()){
      |        ~^~~~~~~~~~

Judge Result

Set Name All
Score / Max Score 0 / 60
Status
AC × 95
TLE × 13
Set Name Test Cases
All 00_sample00.txt, 00_sample01.txt, 00_sample02.txt, 00_sample03.txt, 00_sample04.txt, 01_random00.txt, 01_random01.txt, 01_random02.txt, 01_random03.txt, 01_random04.txt, 01_random05.txt, 01_random06.txt, 01_random07.txt, 01_random08.txt, 01_random09.txt, 01_random10.txt, 01_random11.txt, 01_random12.txt, 01_random13.txt, 01_random14.txt, 01_random15.txt, 01_random16.txt, 01_random17.txt, 01_random18.txt, 01_random19.txt, 01_random20.txt, 01_random21.txt, 01_random22.txt, 01_random23.txt, 01_random24.txt, 01_random25.txt, 01_random26.txt, 01_random27.txt, 01_random28.txt, 01_random29.txt, 01_random30.txt, 01_random31.txt, 01_random32.txt, 01_random33.txt, 01_random34.txt, 01_random35.txt, 01_random36.txt, 01_random37.txt, 01_random38.txt, 01_random39.txt, 01_random40.txt, 01_random41.txt, 01_random42.txt, 01_random43.txt, 01_random44.txt, 01_random45.txt, 01_random46.txt, 01_random47.txt, 01_random48.txt, 01_random49.txt, 01_random50.txt, 01_random51.txt, 01_random52.txt, 01_random53.txt, 01_random54.txt, 01_random55.txt, 01_random56.txt, 01_random57.txt, 01_random58.txt, 01_random59.txt, 01_random61.txt, 01_random62.txt, 01_random63.txt, 01_random64.txt, 01_random65.txt, 01_random66.txt, 01_random67.txt, 01_random68.txt, 01_random69.txt, 01_random70.txt, 01_random71.txt, 01_random72.txt, 01_random73.txt, 01_random74.txt, 01_random75.txt, 01_random76.txt, 01_random77.txt, 01_random78.txt, 01_random79.txt, 01_random80.txt, 01_random81.txt, 01_random82.txt, 01_random83.txt, 01_random84.txt, 01_random85.txt, 01_random86.txt, 01_random87.txt, 01_random88.txt, 01_random89.txt, 01_random90.txt, 01_random91.txt, 01_random92.txt, 01_random93.txt, 01_random94.txt, 01_random95.txt, 01_random96.txt, 01_random97.txt, 01_random98.txt, 01_random99.txt, 02_manual00.txt, 02_manual01.txt, 02_manual02.txt, 02_manual03.txt
Case Name Status Exec Time Memory
00_sample00.txt AC 5 ms 3544 KB
00_sample01.txt AC 3 ms 3524 KB
00_sample02.txt AC 2 ms 3388 KB
00_sample03.txt AC 2 ms 3612 KB
00_sample04.txt TLE 2265 ms 2412528 KB
01_random00.txt AC 9 ms 3464 KB
01_random01.txt AC 3 ms 3620 KB
01_random02.txt AC 1 ms 3604 KB
01_random03.txt AC 3 ms 3428 KB
01_random04.txt AC 2 ms 3576 KB
01_random05.txt AC 2 ms 3636 KB
01_random06.txt AC 2 ms 3608 KB
01_random07.txt AC 2 ms 3520 KB
01_random08.txt AC 2 ms 3428 KB
01_random09.txt AC 2 ms 3620 KB
01_random10.txt AC 2 ms 3544 KB
01_random11.txt AC 2 ms 3584 KB
01_random12.txt AC 2 ms 3444 KB
01_random13.txt AC 2 ms 3464 KB
01_random14.txt AC 2 ms 3580 KB
01_random15.txt AC 1 ms 3488 KB
01_random16.txt AC 1 ms 3548 KB
01_random17.txt AC 2 ms 3552 KB
01_random18.txt AC 2 ms 3456 KB
01_random19.txt AC 4 ms 3496 KB
01_random20.txt AC 2 ms 3612 KB
01_random21.txt AC 2 ms 3496 KB
01_random22.txt AC 2 ms 3428 KB
01_random23.txt AC 2 ms 3608 KB
01_random24.txt AC 2 ms 3492 KB
01_random25.txt AC 2 ms 3528 KB
01_random26.txt AC 2 ms 3484 KB
01_random27.txt AC 2 ms 3492 KB
01_random28.txt AC 2 ms 3588 KB
01_random29.txt AC 2 ms 3584 KB
01_random30.txt AC 2 ms 3464 KB
01_random31.txt AC 2 ms 3536 KB
01_random32.txt AC 2 ms 3540 KB
01_random33.txt AC 2 ms 3576 KB
01_random34.txt AC 2 ms 3520 KB
01_random35.txt AC 2 ms 3612 KB
01_random36.txt AC 2 ms 3612 KB
01_random37.txt AC 2 ms 3600 KB
01_random38.txt AC 2 ms 3632 KB
01_random39.txt AC 2 ms 3660 KB
01_random40.txt AC 2 ms 3552 KB
01_random41.txt AC 2 ms 3572 KB
01_random42.txt AC 2 ms 3516 KB
01_random43.txt AC 2 ms 3528 KB
01_random44.txt AC 2 ms 3496 KB
01_random45.txt AC 1 ms 3504 KB
01_random46.txt AC 2 ms 3520 KB
01_random47.txt AC 2 ms 3620 KB
01_random48.txt AC 2 ms 3608 KB
01_random49.txt AC 2 ms 3568 KB
01_random50.txt AC 2 ms 3572 KB
01_random51.txt AC 2 ms 3564 KB
01_random52.txt AC 2 ms 3584 KB
01_random53.txt AC 2 ms 3428 KB
01_random54.txt AC 2 ms 3520 KB
01_random55.txt AC 2 ms 3516 KB
01_random56.txt AC 2 ms 3456 KB
01_random57.txt AC 2 ms 3540 KB
01_random58.txt AC 2 ms 3576 KB
01_random59.txt AC 2 ms 3468 KB
01_random61.txt TLE 2215 ms 312460 KB
01_random62.txt AC 12 ms 3604 KB
01_random63.txt TLE 2215 ms 311412 KB
01_random64.txt TLE 2210 ms 160348 KB
01_random65.txt AC 9 ms 3560 KB
01_random66.txt AC 3 ms 3592 KB
01_random67.txt AC 10 ms 3796 KB
01_random68.txt AC 2 ms 3644 KB
01_random69.txt AC 4 ms 3600 KB
01_random70.txt AC 2 ms 3604 KB
01_random71.txt AC 2 ms 3620 KB
01_random72.txt TLE 2215 ms 299564 KB
01_random73.txt TLE 2217 ms 406320 KB
01_random74.txt TLE 2214 ms 276644 KB
01_random75.txt AC 11 ms 3528 KB
01_random76.txt AC 3 ms 3544 KB
01_random77.txt AC 2 ms 3584 KB
01_random78.txt AC 9 ms 3852 KB
01_random79.txt TLE 2211 ms 183028 KB
01_random80.txt AC 76 ms 7456 KB
01_random81.txt AC 9 ms 3616 KB
01_random82.txt AC 31 ms 4860 KB
01_random83.txt AC 5 ms 3616 KB
01_random84.txt AC 3 ms 3552 KB
01_random85.txt AC 1 ms 3592 KB
01_random86.txt TLE 2219 ms 467800 KB
01_random87.txt AC 4 ms 3512 KB
01_random88.txt TLE 2218 ms 435928 KB
01_random89.txt AC 9 ms 3496 KB
01_random90.txt AC 2 ms 3464 KB
01_random91.txt AC 2 ms 3612 KB
01_random92.txt AC 2 ms 3616 KB
01_random93.txt AC 1 ms 3476 KB
01_random94.txt AC 2 ms 3576 KB
01_random95.txt AC 2 ms 3544 KB
01_random96.txt AC 2 ms 3488 KB
01_random97.txt TLE 2214 ms 287548 KB
01_random98.txt AC 9 ms 3568 KB
01_random99.txt AC 3 ms 3544 KB
02_manual00.txt TLE 2285 ms 3046484 KB
02_manual01.txt AC 12 ms 3364 KB
02_manual02.txt AC 6 ms 3388 KB
02_manual03.txt TLE 2227 ms 644628 KB