QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#746264#9750. 拼图wsyear#WA 26ms3664kbC++201.3kb2024-11-14 14:02:462024-11-14 14:02:47

Judging History

This is the latest submission verdict.

  • [2024-11-14 14:02:47]
  • Judged
  • Verdict: WA
  • Time: 26ms
  • Memory: 3664kb
  • [2024-11-14 14:02:46]
  • Submitted

answer

#include <bits/stdc++.h>

#define rep(i, j, k) for (int i = (j); i <= (k); ++i)
#define per(i, j, k) for (int i = (j); i >= (k); --i)
#define SZ(v) int((v).size())
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
using ll = long long;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;

template<class T>inline void chkmn(T &x, T y) { if (y < x) x = y; }
template<class T>inline void chkmx(T &x, T y) { if (y > x) x = y; }

using namespace std;

int a, b, c, d;

void work() {
  cin >> a >> b >> c >> d;
  int mx = 0;
  rep (x, 0, 2000) {
    if (a < 4) continue;
    int rb = b - 2 * (x / 2), rc = c - 2 * ((x + 1) / 2);
    if (rb < 0 || rc < 0) continue;
    rb /= 2, rc /= 2;
    int mxy = min(2 * rb, 2 * rc + 1);
    if (x) chkmn(mxy, d / x);
    chkmx(mx, (mxy + 2) * (x + 2));
  }
  swap(b, c);
  rep (x, 0, 2000) {
    if (a < 4) continue;
    int rb = b - 2 * (x / 2), rc = c - 2 * ((x + 1) / 2);
    if (rb < 0 || rc < 0) continue;
    rb /= 2, rc /= 2;
    int mxy = min(2 * rb, 2 * rc + 1);
    if (x) chkmn(mxy, d / x);
    chkmx(mx, (mxy + 2) * (x + 2));
  }
  cout << mx << '\n';
}

int main() {
  cin.tie(nullptr) -> ios::sync_with_stdio(false);
  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: 3664kb

input:

2
4 0 0 0
4 4 4 4

output:

4
16

result:

ok 2 lines

Test #2:

score: -100
Wrong Answer
time: 26ms
memory: 3592kb

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 4021st lines differ - expected: '4', found: '6'