提出 #70603631


ソースコード 拡げる

#include <iostream>
#include <string>
#include <unordered_map>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <climits>
#include <map>

using namespace std;

using ull = unsigned long long;

void solve() {
    int N, M;
    cin >> N >> M;
    vector<vector<char>> a(N, vector<char>(N));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cin >> a[i][j];
        }
    }
    set<string> st;
    for (int i = 0; i <= N - M; i++) {
        for (int j = 0; j <= N-M; j++) {
            string s;
            for (int k = i; k < i + M; k++) {
                for (int z = j; z < j + M; z++) {
                    s += a[k][z];
                }
            }
            st.insert(s);
        }
    }
    cout << st.size();
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    solve();
    return 0;
}

提出情報

提出日時
問題 B - Count Subgrid
ユーザ alexxy
言語 C++23 (GCC 15.2.0)
得点 250
コード長 939 Byte
結果 AC
実行時間 2 ms
メモリ 3624 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 250 / 250
結果
AC × 2
AC × 19
セット名 テストケース
Sample sample_01.txt, sample_02.txt
All 1000000007_01.txt, 1000000007_02.txt, 998244353_01.txt, 998244353_02.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, sample_01.txt, sample_02.txt
ケース名 結果 実行時間 メモリ
1000000007_01.txt AC 2 ms 3600 KiB
1000000007_02.txt AC 1 ms 3624 KiB
998244353_01.txt AC 1 ms 3384 KiB
998244353_02.txt AC 1 ms 3412 KiB
random_01.txt AC 1 ms 3556 KiB
random_02.txt AC 1 ms 3420 KiB
random_03.txt AC 1 ms 3560 KiB
random_04.txt AC 1 ms 3488 KiB
random_05.txt AC 1 ms 3624 KiB
random_06.txt AC 1 ms 3556 KiB
random_07.txt AC 1 ms 3504 KiB
random_08.txt AC 1 ms 3600 KiB
random_09.txt AC 1 ms 3412 KiB
random_10.txt AC 1 ms 3572 KiB
random_11.txt AC 1 ms 3412 KiB
random_12.txt AC 1 ms 3624 KiB
random_13.txt AC 1 ms 3556 KiB
sample_01.txt AC 1 ms 3604 KiB
sample_02.txt AC 1 ms 3604 KiB