QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#758707#9750. 拼图fstqwq#WA 7ms3680kbC++201.2kb2024-11-17 19:25:402024-11-17 19:25:40

Judging History

This is the latest submission verdict.

  • [2024-11-17 19:25:40]
  • Judged
  • Verdict: WA
  • Time: 7ms
  • Memory: 3680kb
  • [2024-11-17 19:25:40]
  • Submitted

answer

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

void work() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    if (A < 4) cout << "0\n";
    else {
        int ans = 4;
        for (int i = 3; i <= 9; i += 2) {
            for (int j = 3; ; j += 2) {
                int a = 4;
                int b = (i - 3 + j - 3) + 2;
                int c = (i - 3 + j - 3) + 2;
                int d = (i - 2) * (j - 2);
                assert (a + b + c + d == i * j);
                if (a <= A && b <= B && c <= C && d <= D) {
                    ans = max(ans, i * j);
                } else break;
            }
        }
        for (int i = 2; i <= 10; i += 2) {
            for (int j = 2; ; j += 2) {
                int a = 4;
                int b = (i - 2 + j - 2);
                int c = (i - 2 + j - 2);
                int d = (i - 2) * (j - 2);
                assert (a + b + c + d == i * j);
                if (a <= A && b <= B && c <= C && d <= D) {
                    ans = max(ans, i * j);
                } else break;
            }
        }
        cout << ans << '\n';
    }
}

int main() {
    int T; cin >> T;
    while (T--) work();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
4 0 0 0
4 4 4 4

output:

4
16

result:

ok 2 lines

Test #2:

score: -100
Wrong Answer
time: 7ms
memory: 3544kb

input:

10000
0 0 0 0
0 0 0 1
0 0 0 2
0 0 0 3
0 0 0 4
0 0 0 5
0 0 0 6
0 0 0 7
0 0 0 8
0 0 0 9
0 0 1 0
0 0 1 1
0 0 1 2
0 0 1 3
0 0 1 4
0 0 1 5
0 0 1 6
0 0 1 7
0 0 1 8
0 0 1 9
0 0 2 0
0 0 2 1
0 0 2 2
0 0 2 3
0 0 2 4
0 0 2 5
0 0 2 6
0 0 2 7
0 0 2 8
0 0 2 9
0 0 3 0
0 0 3 1
0 0 3 2
0 0 3 3
0 0 3 4
0 0 3 5
0 0 3 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 4111th lines differ - expected: '6', found: '4'