QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#44023 | #4541. Black Magic | Cfer# | AC ✓ | 4ms | 3576kb | C++ | 1018b | 2022-08-12 09:58:52 | 2022-08-12 09:58:55 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, n) for (int i = (a); i <= (n); i++)
#define per(i, a, n) for (int i = (n); i >= (a); i--)
#define pb push_back
#define chmx(a, b) a = max(a, b)
#define chmn(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define x first
#define y second
#define lowbit(x) ((x) & (-x))
#define SZ(x) ((int)(x).size())
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;
typedef long double LD;
typedef pair<LD, LD> PDD;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int N = 1e5 + 5;
void solve() {
int a, b, c, d;
cin >> c >> a >> b >> d;
int maxv = (d >= c + 1 ? 1 : 0) + a + b + c + min(d, c);
if (d) {
if (a) --a;
if (b) --b;
}
int minv = c + (d ? 1 : 0) + max(a, b);
cout << minv << " " << maxv << "\n";
}
int main() {
std::ios_base::sync_with_stdio(false);
cout.tie(0);
cin.tie(0);
int _ = 1;
cin >> _;
while (_--) solve();
}
详细
Test #1:
score: 100
Accepted
time: 4ms
memory: 3576kb
input:
4000 0 0 0 1 0 0 0 100000 0 0 0 11 0 0 0 12 0 0 0 13 0 0 0 2 0 0 0 25 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 12 0 0 1 14 0 0 1 17 0 0 1 2 0 0 1 21 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 100000 0 0 0 11 6 0 0 12 3 0 0 12 4 0 0 13 0 0 0 13 12...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 100000 100000 11 12 12 13 12 13 13 13 13 14 13 14 14 15 16 16 16 17 16 17 2 2 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 26 27 3 3 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 4 4 4 5 ...
result:
ok 4000 lines