Submission #74671682


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using vvvl = vector<vector<vector<long long>>>;
using vpl = vector<pair<long long, long long>>;
#define rep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); i++)
#define repr(i, n) for (long long i = (long long)(n-1); i >= 0LL; i--)
#define all(v) v.begin(), v.end()



ll n, m;
vl a, b;
vector<string> s;
vvvl memo;

int main(){
  cin >> n;
  a.resize(n);
  b.resize(n);
  rep(i, 0, n){
    cin >> a.at(i);
    cin >> b.at(i);
  }
  cin >> m;
  s.resize(m);
  rep(i, 0, m) cin >> s.at(i);
  
  memo.resize(11, vvl(11, vl(26, 0)));
  rep(i, 0, m){
    rep(j, 0, s.at(i).size()){
      memo.at(s.at(i).size()).at(j+1).at((int)s.at(i).at(j)-(int)'a')++;
    }
  }

  
  rep(i, 0, m){
    bool flag = true;
    if (s.at(i).size() != n){
      flag = false;
      cout << "No" << endl;
      continue;
    }
    rep(j, 0, n){
      // bool flag2 = false;
      // rep(k, 0, m){
      //   if (s.at(k).size() == a.at(j) &&
      //   s.at(k).at(b.at(j)-1) == s.at(i).at(j)){
      //     flag2 = true;
      //   }
      // }
      // if (!flag2) flag = false;
      if (memo.at(a.at(j)).at(b.at(j)).at((int)s.at(i).at(j)-(int)'a') == 0) flag = false;
    }
    
    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
  }



}

Submission Info

Submission Time
Task C - Fishbones
User dh1728
Language C++23 (GCC 15.2.0)
Score 300
Code Size 1449 Byte
Status AC
Exec Time 108 ms
Memory 9660 KiB

Compile Error

./Main.cpp: In function 'int main()':
./Main.cpp:41:24: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   41 |     if (s.at(i).size() != n){
      |         ~~~~~~~~~~~~~~~^~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 25
Set Name Test Cases
Sample 00-sample-01.txt, 00-sample-02.txt
All 00-sample-01.txt, 00-sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt
Case Name Status Exec Time Memory
00-sample-01.txt AC 1 ms 3632 KiB
00-sample-02.txt AC 1 ms 3632 KiB
01-01.txt AC 14 ms 4160 KiB
01-02.txt AC 53 ms 6748 KiB
01-03.txt AC 93 ms 9428 KiB
01-04.txt AC 53 ms 6876 KiB
01-05.txt AC 71 ms 8024 KiB
01-06.txt AC 61 ms 7204 KiB
01-07.txt AC 102 ms 9508 KiB
01-08.txt AC 107 ms 9584 KiB
01-09.txt AC 13 ms 4184 KiB
01-10.txt AC 53 ms 6748 KiB
01-11.txt AC 13 ms 4156 KiB
01-12.txt AC 85 ms 8868 KiB
01-13.txt AC 61 ms 7232 KiB
01-14.txt AC 51 ms 6720 KiB
01-15.txt AC 103 ms 9564 KiB
01-16.txt AC 108 ms 9564 KiB
01-17.txt AC 107 ms 9420 KiB
01-18.txt AC 107 ms 9508 KiB
01-19.txt AC 107 ms 9564 KiB
01-20.txt AC 107 ms 9488 KiB
01-21.txt AC 106 ms 9660 KiB
01-22.txt AC 107 ms 9564 KiB
01-23.txt AC 108 ms 9556 KiB