QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#133235#6630. Triangle Collectionpenguinman0 17ms3544kbC++171.0kb2023-08-01 19:12:272023-08-01 19:12:28

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-01 19:12:28]
  • 评测
  • 测评结果:0
  • 用时:17ms
  • 内存:3544kb
  • [2023-08-01 19:12:27]
  • 提交

answer

#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::string;
using ll = long long;
using vi = vector<ll>;
using vii = vector<vi>;
using pii = std::pair<ll,ll>;

#define ln "\n"
#define rep(i,j,k) for(ll i=ll(j); i<ll(k); i++)
#define REP(i,j,k) for(ll i=ll(j); i<=ll(k); i++)
#define per(i,j,k) for(ll i=ll(j); i>=ll(k); i--)
#define all(a) a.begin(), a.end()
#define pb emplace_back
#define mp std::make_pair

constexpr ll inf = (1ll<<60);

int main(){
    ll N,Q; cin >> N >> Q;
    assert(N*Q <= 1e7);
    vi C(N);
    rep(i,0,N) cin >> C[i];
    while(Q--){
        ll l,d; cin >> l >> d;
        C[l-1] += d;
        ll ans = 0;
        vi sum1(N+1), sum2(N+1);
        rep(i,0,N){
            sum1[i+1] = sum1[i]+C[i]/2;
            sum2[i+1] = sum2[i]+C[i];
        }
        REP(i,1,N){
            ans = std::min(ans, (sum2[std::min(i*2-1, N)]+2)/3-sum1[i]);
        }
        ans += sum1[N];
        cout << ans << ln;
    }
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3472kb

input:

1 23
1485
1 -12
1 -30
1 -20
1 6
1 24
1 5
1 31
1 14
1 -34
1 -22
1 -45
1 37
1 46
1 9
1 22
1 -9
1 9
1 -46
1 -47
1 39
1 36
1 -36
1 50

output:

491
481
475
477
485
486
497
501
490
483
468
480
495
498
506
503
506
490
475
488
500
488
504

result:

wrong answer 3rd numbers differ - expected: '474', found: '475'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Wrong Answer

Test #28:

score: 0
Wrong Answer
time: 17ms
memory: 3544kb

input:

1999 2000
1 1 1 1 0 2 0 2 1 0 2 1 2 2 2 1 2 0 0 1 2 2 0 1 0 1 0 2 0 0 2 1 1 1 1 0 1 2 1 2 1 1 1 1 1 0 2 2 0 2 1 1 2 0 0 2 0 0 2 1 2 0 0 1 1 2 0 2 2 2 1 2 0 2 1 2 0 1 2 2 2 1 1 2 1 1 1 1 0 0 1 1 0 1 2 1 0 0 2 0 2 2 2 0 1 1 2 0 0 1 0 0 2 1 2 1 2 0 1 1 2 2 0 0 1 2 2 1 2 1 2 2 2 0 0 1 1 2 1 1 2 2 2 2 2 ...

output:

660
660
660
661
661
661
661
660
660
660
660
661
662
662
663
663
662
661
662
662
661
660
661
660
660
660
661
661
661
661
662
661
661
660
661
660
659
658
658
659
659
658
659
660
660
660
660
660
660
659
659
659
659
659
659
659
659
660
659
658
658
658
658
657
657
657
658
657
656
657
657
657
656
656
655
...

result:

wrong answer 615th numbers differ - expected: '660', found: '661'

Subtask #4:

score: 0
Wrong Answer

Test #35:

score: 0
Wrong Answer
time: 13ms
memory: 3544kb

input:

2000 1999
0 1 0 3 0 1 0 0 0 0 0 0 0 2 0 0 0 0 3 1 1 0 2 0 0 3 0 0 0 0 0 4 0 0 1 0 1 0 0 0 0 1 2 1 0 0 0 0 7 0 1 3 1 0 1 1 0 3 2 1 0 1 1 3 3 1 0 2 0 0 0 0 0 0 0 0 1 0 0 0 2 0 0 0 0 0 1 2 3 0 1 0 3 3 0 0 0 0 1 0 1 2 0 0 2 2 0 1 2 1 2 0 0 0 1 1 0 1 2 0 0 0 0 2 0 5 0 0 0 0 0 1 0 0 2 0 1 2 0 1 0 0 0 2 0 ...

output:

667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
666
667
667
667
667
667
667
667
666
667
667
667
667
666
666
665
665
665
665
665
665
665
665
665
665
665
665
665
665
665
665
665
666
666
667
667
667
667
666
667
667
667
667
667
666
666
...

result:

wrong answer 1st numbers differ - expected: '666', found: '667'

Subtask #5:

score: 0
Skipped

Dependency #1:

0%