Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
133600 | 吴晨曦 | 田忌赛马 | C++ | 解答错误 | 0 | 0 MS | 268 KB | 879 | 2024-03-02 08:26:43 |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 005; int x[N], y[N]; int a[N]; int main() { int n; while (cin >> n) { if (!n) break; int tmp1 = 0; for (int i = 1; i <= n; i++) cin >> x[i]; for (int i = 1; i <= n; i++) cin >> y[i]; for (int i = 1; i <= n; i++) { int tmp = upper_bound(x + 1, x + n + 1, y[i]) - x; if (tmp == n + 1) { for (int i = 1; i <= n; i++) if (!a[i]) { a[i] = !a[i]; tmp -= 200; break; } } else { int tmp12 = false; for (int i = tmp; i <= n; i++) if (!a[i]) { a[i] = !a[i]; tmp1 += 200; tmp12 = true; break; } if (tmp12 == false) for (int i = 1; i <= n; i++) if (!a[i]) { a[i] = !a[i]; tmp1 -= 200; break; } } } cout << tmp1 << endl; } }