QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#574274#5564. Lots of LandV-ioleTWA 0ms3580kbC++201.4kb2024-09-18 21:21:132024-09-18 21:21:14

Judging History

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

  • [2024-09-18 21:21:14]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3580kb
  • [2024-09-18 21:21:13]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define endl '\n'
#define int long long
#define ull unsigned long long
typedef long long ll;
#define lowbit(x) ((x) & -(x))

const ll INF = 0x3f3f3f3f3f3f3f3f;
const ll mod = 1e9 + 7;
const int N = 1e5 + 5, M = 1e5 + 10;
typedef pair<int, int> PII;
double T = 1 >> 30;
// double PI = acos(-1);

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}

int lcm(int a, int b)
{
    return a / gcd(a, b) * b;
}

void solve()
{
    int i, j;

    int n, m, k;
    cin >> n >> m >> k;

    if ((n * m) % k != 0)
    {
        cout << "IMPOSSIBLE";
        return;
    }

    int s = n * m / k;

    for (int x = 1; x <= s; x++)
    {
        if (s % x != 0)
            continue;
        int y = s / x;
        if (n % x || m % y)
            continue;
        int t = m / y;
        for (i = 0; i < n;i++)
        {
            for (j = 0; j < m;j++)
            {
                cout << (char)('A' + (i / x) * t + (j / y));
            }
            cout << endl;
        }
        return;
    }

    cout << "IMPOSSIBLE";
}

signed main()
{
    // ios_base::sync_with_stdio(false);
    // cin.tie(nullptr);
    // cout.tie(nullptr);
    int t = 1;

    //  cin >> t;

    while (t--)
    {
        //  Case++;
        solve();
    }

 
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3528kb

input:

4 4 4

output:

AAAA
BBBB
CCCC
DDDD

result:

ok correct

Test #2:

score: 0
Accepted
time: 0ms
memory: 3572kb

input:

6 15 9

output:

AAAAABBBBBCCCCC
AAAAABBBBBCCCCC
DDDDDEEEEEFFFFF
DDDDDEEEEEFFFFF
GGGGGHHHHHIIIII
GGGGGHHHHHIIIII

result:

ok correct

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3580kb

input:

100 100 26

output:

IMPOSSIBLE

result:

wrong answer Token "IMPOSSIBLE" doesn't correspond to pattern "impossible"