QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#739611#9423. Gold MedalzzisjtuWA 0ms3624kbC++231.2kb2024-11-12 22:24:222024-11-12 22:24:25

Judging History

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

  • [2024-11-12 22:24:25]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3624kb
  • [2024-11-12 22:24:22]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define all(x) x.begin(), x.end()
#define lowbit(i) ((i)&(-i))
#define pii pair<int,int>
#define endl '\n'
#define mk(x,y) make_pair(x,y)
#define popcount(x) __builtin_popcount(x)
#define LF(x) fixed<<setprecision(x)
const double pi = 3.14159265358979323846;
const double eps = 1e-9;
const int inf = 1e9;
const long long INF = 4e18;
const int mod = 1e9+7;
using namespace std;
const int N = 1e5+10;

void solve() {
    int n, k; cin >> n >> k;
    vector<int>a(n +10);
    for (auto& i : a)cin >> i;
    auto cmp = [&](int x, int y) -> bool {
        int tx = x % k, ty = y % k;
        if (!tx)tx = k;
        if (!ty)ty = k;
        return tx >= ty;
        };
    sort(all(a), cmp);
    int ret = 0;
    int m; cin >> m;
    for (int i = 0; i < n; i++) {
        int t = a[i] % k;
        if (t && m > k - t) {
            a[i] += k - t;
            m -= k - t;
        }
        ret += 0 + a[i] / k;
    }
    ret += 0 + m / k;
    cout << ret << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int T = 1;
    cin >> T;
    while (T--) {
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3624kb

input:

2
3 10
239 141 526
6
2 1
300 100
1000

output:

0
0

result:

wrong answer 1st lines differ - expected: '91', found: '0'