QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#604858#6337. Mizuyokan 2Dimash#0 172ms10256kbC++231.2kb2024-10-02 14:16:162024-10-02 14:16:17

Judging History

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

  • [2024-10-02 14:16:17]
  • 评测
  • 测评结果:0
  • 用时:172ms
  • 内存:10256kb
  • [2024-10-02 14:16:16]
  • 提交

answer

#include <bits/stdc++.h>
    
using namespace std;
    
typedef long long ll;
const int  N = 1e6 + 12, MOD = (int)1e9 + 7;

#define int ll
int n, a[N], q, dp[N];
ll inf = 1e18;
int solve(int l, int r, int id = -1) {
    dp[l - 1] = 0;
    for(int i = l; i <= r; ++i) {
        ll T = 0;
        if(i == l) {
            dp[i] = 1;
        }
        for(int j = i - 1; j >= l; j--) {
            T += a[j];
            if(T > a[i] && (j == l || T > a[j - 1])) {
                dp[i] = max(dp[i], dp[j - 1] + 2);
            }
        }
    }
    int res = max(1ll, dp[r]);
    ll cur = a[r];
    for(int i = r - 1; i >= l; i--) {
        if(cur > a[i]) {
            res = max(res, 1 + dp[i]);
        }
    }
    return res;
}
void test() {
    cin >> n;
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    
    cin >> q;

    for(int i = 1; i <= q; i++) {
        int x, y, l, r;
        cin >> x >> y >> l >> r;
        l++;
        a[x] = y;
        cout << solve(l, r, i) << '\n';
    }
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); 

    int t = 1; 
    // cin >> t;
    
    while(t--) 
        test();
    return 0;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

170
581553716 290776853 145388421 581553716 168947671 936760822 849346471 126291564 133104657 125887494 136786623 123143788 137803872 129733949 849346471 880499329 202732710 611312524 152828126 305656257 611312524 121295297 6875889 74507235 419967909 333601507 281557968 740824934 370412466 185206229...

output:

59
112
60
61
64
101
101
106

result:

wrong answer 2nd numbers differ - expected: '56', found: '112'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Wrong Answer

Test #59:

score: 0
Wrong Answer
time: 172ms
memory: 10256kb

input:

185137
895278847 447639418 223819705 895278847 25847602 892542542 725274571 68345857 72124244 67050536 71135605 66549838 72378749 66083078 72261084 67667076 70423484 68942136 725274571 798132375 68764887 958288578 703862250 55104628 58120315 54690522 57110282 54279470 56516680 54581941 58474132 5445...

output:

59
26
80
54
43
41
79
37
57
79
69
29
31
25
26
76
32
25
27
36
34
39
67
40
67
71
45
40
49
52
64
61
29
40
39
34
41
19
28
51
31
43
62
23
31
26
73
39
63
36
53
27
46
56
30
67
60
37
71
22
42
91
67
141
16
27
20
38
16
64
20
19
41
34
55
53
15
51
89
29
71
60
49
9
75
18
86
29
73
61
77
46
21
62
20
20
67
71
83
82
...

result:

wrong answer 4th numbers differ - expected: '55', found: '54'

Subtask #5:

score: 0
Wrong Answer

Test #76:

score: 0
Wrong Answer
time: 164ms
memory: 9588kb

input:

235469
96936 48463 24226 96936 25951 73765 63933 7121 7884 7166 7731 7464 7559 7300 7767 7314 63933 88750 6093 115886 111307 16371 17529 15944 17376 16099 18186 15910 111307 116042 13997 111982 95565 10713 11748 10849 11375 11093 11406 10874 11810 11197 95565 98914 1302 65917 16473 32953 65917 15943...

output:

34
56
73
61
41
13
74
46
33
33
14
53
36
46
18
63
65
79
72
15
20
57
66
83
19
46
62
58
44
76
76
68
41
56
9
29
59
73
64
21
63
33
29
62
27
36
20
65
54
71
28
47
13
32
48
74
63
75
79
17
24
49
20
41
57
16
23
67
67
18
19
54
63
74
72
84
61
30
27
60
33
36
49
49
24
56
42
60
20
53
32
75
44
57
17
34
71
45
25
39
2...

result:

wrong answer 51st numbers differ - expected: '29', found: '28'

Subtask #6:

score: 0
Skipped

Dependency #1:

0%