Submission #793689

# Submission time Handle Problem Language Result Execution time Memory
793689 2023-07-26T05:33:59 Z 이동현(#10060) Triangle Collection (CCO23_day2problem3) C++17
5 / 25
4000 ms 8340 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#define int long long
using namespace std;

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n, q;
    cin >> n >> q;
    vector<int> a(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }

    while(q--){
        int x, y;
        cin >> x >> y;
        --x;

        a[x] += y;

        int ans = 0, h = 0;
        vector<int> b(2 * n), c(2 * n);
        for(int i = 0; i < n; ++i){
            if(a[i] % 2){
                c[i] = 1;
            }
            b[i * 2] = a[i] / 2;
        }
        for(int i = 0; i < 2 * n; ++i){
            ans += b[i];
            h += c[i];
            h -= b[i];
            while(h < 0){
                --ans;
                h += 3;
            }
        }

        cout << ans << '\n';
    }
    
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 14 ms 404 KB Output is correct
7 Correct 17 ms 464 KB Output is correct
8 Correct 8 ms 340 KB Output is correct
9 Correct 15 ms 404 KB Output is correct
10 Correct 15 ms 404 KB Output is correct
11 Correct 14 ms 340 KB Output is correct
12 Correct 15 ms 396 KB Output is correct
13 Correct 15 ms 400 KB Output is correct
14 Correct 11 ms 368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 14 ms 404 KB Output is correct
7 Correct 17 ms 464 KB Output is correct
8 Correct 8 ms 340 KB Output is correct
9 Correct 15 ms 404 KB Output is correct
10 Correct 15 ms 404 KB Output is correct
11 Correct 14 ms 340 KB Output is correct
12 Correct 15 ms 396 KB Output is correct
13 Correct 15 ms 400 KB Output is correct
14 Correct 11 ms 368 KB Output is correct
15 Correct 19 ms 316 KB Output is correct
16 Correct 57 ms 292 KB Output is correct
17 Execution timed out 4024 ms 340 KB Time limit exceeded
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 20 ms 468 KB Output is correct
2 Correct 17 ms 408 KB Output is correct
3 Correct 56 ms 680 KB Output is correct
4 Execution timed out 4069 ms 8340 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 15 ms 340 KB Output is correct
2 Execution timed out 4062 ms 340 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 14 ms 404 KB Output is correct
7 Correct 17 ms 464 KB Output is correct
8 Correct 8 ms 340 KB Output is correct
9 Correct 15 ms 404 KB Output is correct
10 Correct 15 ms 404 KB Output is correct
11 Correct 14 ms 340 KB Output is correct
12 Correct 15 ms 396 KB Output is correct
13 Correct 15 ms 400 KB Output is correct
14 Correct 11 ms 368 KB Output is correct
15 Correct 19 ms 316 KB Output is correct
16 Correct 57 ms 292 KB Output is correct
17 Execution timed out 4024 ms 340 KB Time limit exceeded
18 Halted 0 ms 0 KB -