提出 #70597014


ソースコード 拡げる

#include <bits/stdc++.h>
#ifdef LOCAL
#include "debug.h"
#else
#define dbg(...) 0
#endif
using namespace std;
using ll = long long;
using db = double;
const ll N = 1e6 + 5;
const ll md = 998244353;
const ll MOD = 1e9 + 7;
const ll INF = 0x3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db eps = 1e-6;
const db E = 2.718281828459045;
typedef pair<ll, ll> PLL;
#define fi first
#define se second
char a[100][100];
void solve()
{
    ll n, m;
    cin >> n >> m;
    set<string> s;
    for (ll i = 1; i <= n; i++)
    {
        for (ll j = 1; j <= n;j++)
            cin >> a[i][j];
    }
    for (ll i = 1; i <= n;i++)
    {
        for (ll j = 1; j <= n;j++)
        {
            if(i+m-1>n||j+m-1>n)
                continue;
            string res = "";
            for (ll z = i; z <= i + m - 1;z++)
            {
                for (ll g = j; g <= j + m - 1;g++)
                    res += a[z][g];
            }
            s.insert(res);
        }
    }
    cout << s.size() << '\n';
}
int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int T;
    T = 1;
    //cin>>T;
    while (T--)
    {
        solve();
    }
}

提出情報

提出日時
問題 B - Count Subgrid
ユーザ AChievedreaM
言語 C++23 (GCC 15.2.0)
得点 250
コード長 1197 Byte
結果 AC
実行時間 3 ms
メモリ 3632 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 3 ms 3484 KiB
1000000007_02.txt AC 1 ms 3616 KiB
998244353_01.txt AC 1 ms 3616 KiB
998244353_02.txt AC 1 ms 3560 KiB
random_01.txt AC 1 ms 3572 KiB
random_02.txt AC 1 ms 3600 KiB
random_03.txt AC 1 ms 3596 KiB
random_04.txt AC 1 ms 3484 KiB
random_05.txt AC 1 ms 3592 KiB
random_06.txt AC 1 ms 3632 KiB
random_07.txt AC 1 ms 3484 KiB
random_08.txt AC 1 ms 3516 KiB
random_09.txt AC 1 ms 3592 KiB
random_10.txt AC 1 ms 3620 KiB
random_11.txt AC 1 ms 3600 KiB
random_12.txt AC 1 ms 3504 KiB
random_13.txt AC 1 ms 3468 KiB
sample_01.txt AC 1 ms 3592 KiB
sample_02.txt AC 1 ms 3620 KiB