QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#282988#6564. Frequent Flierwarner1129#WA 15ms6284kbC++201.8kb2023-12-13 16:57:322023-12-13 16:57:33

Judging History

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

  • [2023-12-13 16:57:33]
  • 评测
  • 测评结果:WA
  • 用时:15ms
  • 内存:6284kb
  • [2023-12-13 16:57:32]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
template <class... T> void dbg(T... x) { char e{}; ((cerr << e << x, e = ' '), ...); }
template <class T> void org(T l, T r) { while (l != r) cerr << ' ' << *l++; cerr << '\n'; }
#define debug(x...) dbg(#x, '=', x, '\n')
#define olist(x...) dbg(#x, '='), org(x)
#else
#define debug(...) ((void)0)
#define olist(...) ((void)0)
#endif
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define ff first
#define ss second

using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
using i128 = __int128;
using u128 = unsigned __int128;
using Pt = pair<int, int>;

template <class T> inline constexpr T inf = numeric_limits<T>::max() / 2;
constexpr int mod = 998244353;

template<class T> bool chmin(T &a, T b) { return (b < a and (a = b, true)); }
template<class T> bool chmax(T &a, T b) { return (a < b and (a = b, true)); }
template<class... T> int add(T... x) { int t{}; return (((t += x) %= mod), ...), t; }
template<class... T> int mul(T... x) { i64 t{1}; return (((t *= x) %= mod), ...), t; }

void solve() {
    int n, m, k;
    cin >> n >> m >> k;

    vector<i64> A(n + 4);
    vector<i64> B(n + 4);
    for (int i = 2; i < n + 2; i++) {
        cin >> A[i];
    }

    i64 ans = 0;
    for (int i = 0; i + 2 < n + 4; i++) {
        i64 t = B[i] + B[i + 1] + B[i + 2];
        for (int j = i + 2; j >= i; j--) {
            if (t < k and A[j]) {
                i64 s = min(k - t, A[j]);
                A[j] -= s;
                B[j] += s;
                t += s;
            }
        }
    }

    cout << reduce(all(B)) << '\n';
}

signed main() {
    cin.tie(0)->sync_with_stdio(false);
    cin.exceptions(cin.failbit);
    int T = 1;
    // cin >> T;
    while (T--) {
        solve();
    }
    return 0;
}
 


詳細信息

Test #1:

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

input:

8 3 2
3
1
4
1
5
9
2
6

output:

8

result:

ok single line: '8'

Test #2:

score: -100
Wrong Answer
time: 15ms
memory: 6284kb

input:

200000 2467 999931035
182548858
69876218
33328350
919486767
739850600
948199964
392292320
39077742
366752074
917496841
246661698
37219034
56677740
188278971
965701828
28059790
13200243
825730775
542597589
320715170
939054378
470563899
914247467
990100491
290827128
903662394
611104879
18631185
412134...

output:

67624602556106

result:

wrong answer 1st lines differ - expected: '82994275905', found: '67624602556106'