QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#133113 | #6630. Triangle Collection | penguinman# | 0 | 26ms | 3840kb | C++17 | 1.1kb | 2023-08-01 15:43:45 | 2024-07-04 01:06:12 |
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
constexpr ll inf = (1ll<<60);
int main(){
ll N,Q; cin >> N >> Q;
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 A(N), B(N);
rep(i,0,N){
A[i] = C[i]/3;
B[i] = C[i]%3;
ans += A[i];
}
ll left = 0;
rep(i,0,N){
if(B[i] == 2){
for(; left<=std::min(N,i*2); left++){
if(B[left] == 1){
ans++;
B[left] = 0;
break;
}
}
}
}
cout << ans << ln;
}
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 5
Accepted
time: 0ms
memory: 3732kb
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 474 476 484 486 496 501 489 482 467 479 495 498 505 502 505 490 474 487 499 487 504
result:
ok 23 numbers
Test #2:
score: -5
Wrong Answer
time: 0ms
memory: 3508kb
input:
12 1 13 79 59 21 32 13 85 40 74 15 49 56 3 31
output:
188
result:
wrong answer 1st numbers differ - expected: '189', found: '188'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Wrong Answer
Test #28:
score: 0
Wrong Answer
time: 26ms
memory: 3840kb
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 1664th numbers differ - expected: '666', found: '664'
Subtask #4:
score: 0
Wrong Answer
Test #35:
score: 0
Wrong Answer
time: 10ms
memory: 3636kb
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:
575 575 575 575 575 575 575 576 576 577 577 577 577 578 578 578 577 577 577 578 578 578 577 577 576 576 575 575 575 575 576 576 576 576 576 576 576 576 576 576 575 575 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 575 575 576 576 576 576 576 576 576 576 576 576 ...
result:
wrong answer 1st numbers differ - expected: '666', found: '575'
Subtask #5:
score: 0
Skipped
Dependency #1:
0%