QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#873130#9675. 电池检测fishPJ#0 1ms11808kbC++141.3kb2025-01-26 09:43:122025-01-26 09:43:13

Judging History

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

  • [2025-01-26 09:43:13]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:11808kb
  • [2025-01-26 09:43:12]
  • 提交

answer

#include<bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i <= b; i++)
#define per(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define RD read()
#define PN putchar('\n')
using namespace std;
bool MemoryBegin;
inline int read() {
    int x = 0, f = 1;
    char ch = getchar();
    while(ch < '0' || ch > '9') { if(ch == '-') f = -1; ch = getchar(); }
    while('0' <= ch && ch <= '9') { x = (x << 1) + (x << 3) + (ch ^ 48); ch = getchar(); }
    return x * f;
}

int const N = 1e3 + 5;

int f[N][N];

signed main() {
    //cerr << fabs(&MemoryBegin - &MemoryEnd) / 1048576.0 << " MB\n";
    memset(f, 0x3f, sizeof f);
    rep(i, 2, N - 1) f[i][0] = 1, f[i][1] = 2;
    rep(i, 1, N - 1) {
        rep(j, 2, N - 1) {
            f[i][j] = f[i][j - 2] + 2 * (i + j - 2) + 1;
            // if(j > 1) f[i][j] = min(f[i][j - 2] + 1, min(f[i - 1][j - 1] + 1, f[i][j - 2] + 2 * (i + j - 2) + 1));
            // else f[i][j] = min(f[i - 1][j - 1] + 1, f[i][j - 1] + i);
        }
    }
    int T = RD;
    while(T --) {
        printf("%lld\n", f[RD][RD]);
    }
    // rep(i, 1, 10) {
    //     PN;
    //     rep(j, 1, 10) {
    //         printf("f[%lld][%lld] = %lld\n", i, j, f[i][j]);
    //     }
    // }
    // cerr << "\n" << clock() * 1.0 / CLOCKS_PER_SEC * 1000 << " ms\n";
    return 0;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 11700kb

input:

3
2 1
3 1
2 2

output:

2
2
6

result:

wrong answer 1st numbers differ - expected: '3', found: '2'

Subtask #2:

score: 0
Wrong Answer

Test #3:

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

input:

1000
2 1
2 2
2 3
2 4
2 5
2 6
2 7
2 8
2 9
2 10
2 11
2 12
2 13
2 14
2 15
2 16
2 17
2 18
2 19
2 20
2 21
2 22
2 23
2 24
2 25
2 26
2 27
2 28
2 29
2 30
2 31
2 32
2 33
2 34
2 35
2 36
2 37
2 38
2 39
2 40
2 41
2 42
2 43
2 44
2 45
2 46
2 47
2 48
2 49
2 50
2 51
2 52
2 53
2 54
2 55
2 56
2 57
2 58
2 59
2 60
2 61...

output:

2
6
9
15
20
28
35
45
54
66
77
91
104
120
135
153
170
190
209
231
252
276
299
325
350
378
405
435
464
496
527
561
594
630
665
703
740
780
819
861
902
946
989
1035
1080
1128
1175
1225
1274
1326
1377
1431
1484
1540
1595
1653
1710
1770
1829
1891
1952
2016
2079
2145
2210
2278
2345
2415
2484
2556
2627
270...

result:

wrong answer 1st numbers differ - expected: '3', found: '2'

Subtask #3:

score: 0
Wrong Answer

Test #4:

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

input:

1000
3 1
3 2
3 3
3 4
3 5
3 6
3 7
3 8
3 9
3 10
3 11
3 12
3 13
3 14
3 15
3 16
3 17
3 18
3 19
3 20
3 21
3 22
3 23
3 24
3 25
3 26
3 27
3 28
3 29
3 30
3 31
3 32
3 33
3 34
3 35
3 36
3 37
3 38
3 39
3 40
3 41
3 42
3 43
3 44
3 45
3 46
3 47
3 48
3 49
3 50
3 51
3 52
3 53
3 54
3 55
3 56
3 57
3 58
3 59
3 60
3 61...

output:

2
8
11
19
24
34
41
53
62
76
87
103
116
134
149
169
186
208
227
251
272
298
321
349
374
404
431
463
492
526
557
593
626
664
699
739
776
818
857
901
942
988
1031
1079
1124
1174
1221
1273
1322
1376
1427
1483
1536
1594
1649
1709
1766
1828
1887
1951
2012
2078
2141
2209
2274
2344
2411
2483
2552
2626
2697
...

result:

wrong answer 2nd numbers differ - expected: '4', found: '8'

Subtask #4:

score: 0
Wrong Answer

Test #5:

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

input:

1000
907 241
495 435
227 139
616 1
433 35
588 407
533 322
995 961
748 310
212 36
968 500
294 187
375 371
307 14
648 180
122 28
304 253
818 812
41 5
286 62
573 340
547 224
347 35
279 56
151 85
626 410
456 248
578 470
11 6
952 771
404 302
77 27
168 40
524 517
171 147
407 294
268 106
100 27
549 196
973...

output:

246602
309227
40919
2
15319
321351
223308
1416482
279776
8263
608751
72077
207387
4390
132751
3795
108488
993483
176
19624
252451
147505
12395
17165
16256
340506
143717
381876
82
1029877
167460
2355
7501
403772
35699
162730
33974
2953
126715
431336
5900
180265
120629
27947
777862
1133367
563993
3160...

result:

wrong answer 1st numbers differ - expected: '242', found: '246602'

Subtask #5:

score: 0
Skipped

Dependency #1:

0%

Subtask #6:

score: 0
Skipped

Dependency #5:

0%

Subtask #7:

score: 0
Skipped

Dependency #1:

0%