Skip to content

Commit

Permalink
ABC360B Vertical Reading
Browse files Browse the repository at this point in the history
  • Loading branch information
Vicfred committed Jul 15, 2024
1 parent e06cec1 commit a55e18a
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions atcoder/abc360b_vertical_reading.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Vicfred
// https://atcoder.jp/contests/abc360/tasks/abc360_b
// brute force, implementation
#include <iostream>
#include <string>
#include <vector>
#include <set>

using namespace std;

int main() {
string S, T;
cin >> S >> T;
for (int w = 1; w < S.size(); ++w) {
vector<string> cats(w);
for (int i = 0; i < S.size(); i += w) {
for (int j = i; j < i + w; ++j) {
if (j >= S.size()) {
break;
}
cats[j % w] += S[j];
}
}
set<string> nekos(begin(cats), end(cats));
if(nekos.count(T)) {
cout << "Yes" << endl;
return 0;
}
}
cout << "No" << endl;
return 0;
}

0 comments on commit a55e18a

Please sign in to comment.