QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#133235 | #6630. Triangle Collection | penguinman | 0 | 17ms | 3544kb | C++17 | 1.0kb | 2023-08-01 19:12:27 | 2023-08-01 19:12:28 |
Judging History
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;
}
}
Details
Tip: Click on the bar to expand more detailed information
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%