QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#177264#6882. 8-bit ZoomPPP#AC ✓1ms3892kbC++171.6kb2023-09-12 19:27:042023-09-12 19:27:04

Judging History

你现在查看的是最新测评结果

  • [2023-09-12 19:27:04]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3892kb
  • [2023-09-12 19:27:04]
  • 提交

answer

#ifdef DEBUG
//#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

const ll mod = 1000000007;
//const ll mod = 998244353;

#define X first
#define Y second

ll pew(ll a, ll b)
{
    ll res = 1;
    while (b>0)
    {
        if (b&1) res = res*a%mod;
        b >>= 1;
        a = a*a%mod;
    }
    return res;
}


void solve()
{
    int n, P;
    cin >> n >> P;
    int Q = 100;
    vector<string> s(n);
    for (int i=0;i<n;i++) cin >> s[i];
    ll G = __gcd(P,Q);
    P /= G;
    Q /= G;
    if (n%Q!=0)
    {
        cout << "error\n";
        return;
    }
    for (int i=0;i<n;i++)
    {
        for (int j=0;j<n;j++)
        {
            if (i+1<n and (i+1)%Q!=0)
            {
                if (s[i][j]!=s[i+1][j])
                {
                    cout << "error\n";
                    return;
                }
            }
            if (j+1<n and (j+1)%Q!=0)
            {
                if (s[i][j]!=s[i][j+1])
                {
                    cout << "error\n";
                    return;
                }
            }
        }
    }
    int N = n*P/Q;
    for (int i=0;i<N;i++)
    {
        for (int j=0;j<N;j++)
        {
            cout << s[i*Q/P][j*Q/P];
        }
        cout << "\n";
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//#ifdef DEBUG
    //freopen("input.txt", "r", stdin);
//#endif
    int T = 1;
    cin >> T;
    while (T--) solve();
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3892kb

input:

10
23 100
zmzemhuhooodxcxsaetjwyw
uppvsannoobdabjkabjhzqo
uqfcuxgelccyvvpfpoybspw
rnzgaaigwgmbqmghkfrmqmg
tmniwhcolzscuwyyclvnzep
pxlmsueaquqtaicjrxkmuow
xebkeryqxbmsgvfnrwphmuh
nnhzzzzciqqybkgwskgtrwt
mjnpodnnttvmnaavzjuuyza
dbfhimxsupkcetqrucbnkvd
ppjcgvtfpubxnvdjlehxebo
mlqfylqyiipenlebeporltz
ni...

output:

zmzemhuhooodxcxsaetjwyw
uppvsannoobdabjkabjhzqo
uqfcuxgelccyvvpfpoybspw
rnzgaaigwgmbqmghkfrmqmg
tmniwhcolzscuwyyclvnzep
pxlmsueaquqtaicjrxkmuow
xebkeryqxbmsgvfnrwphmuh
nnhzzzzciqqybkgwskgtrwt
mjnpodnnttvmnaavzjuuyza
dbfhimxsupkcetqrucbnkvd
ppjcgvtfpubxnvdjlehxebo
mlqfylqyiipenlebeporltz
nimgrloouctf...

result:

ok 297 lines