QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#612099#2164. Landscape GeneratorAndycipationWA 28ms4692kbC++201.1kb2024-10-05 06:08:052024-10-05 06:08:05

Judging History

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

  • [2024-10-05 06:08:05]
  • 评测
  • 测评结果:WA
  • 用时:28ms
  • 内存:4692kb
  • [2024-10-05 06:08:05]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#ifdef _DEBUG
#include "debug.h"
#else
#define debug(...) 42
#endif

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> c0(n + 1), c1(n + 1);
  
  auto Add = [&](int start, int len, int c, int d) {
    assert(start >= 0 && len >= 0);
    // a[start + i] += c(i - start) + d for 0 <= i < len
    c1[start] += c;
    c1[start + len] -= c;
    int add = -c * start + d;
    c0[start] += add;
    c0[start + len] -= add;
  };
  
  while (k--) {
    char op;
    int L, R;
    cin >> op >> L >> R;
    --L; --R;
    if (op == 'R') {
      Add(L, R - L + 1, 0, 1);
    } else if (op == 'D') {
      Add(L, R - L + 1, 0, -1);
    } else {
      int coef = (op == 'H' ? +1 : -1);
      int m1 = (L + R) / 2;
      int m2 = m1 + 1;
      Add(L, m1 - L + 1, coef * 1, coef * 1);
      Add(m2, R - m2 + 1, coef * -1, coef * (R - m2 + 1));
    }
  }
  for (int i = 0; i < n; i++) {
    c0[i + 1] += c0[i];
    c1[i + 1] += c1[i];
    cout << (long long) c1[i] * i + c0[i] << '\n';
  }
  return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3580kb

input:

71 1487
H 20 68
D 22 52
H 39 55
V 8 58
V 56 61
V 1 30
V 3 11
V 40 49
H 4 24
H 27 68
H 28 36
R 7 30
V 4 42
V 9 24
D 7 15
R 2 31
V 29 51
R 9 11
V 69 69
R 65 70
H 2 56
V 21 22
D 23 35
H 23 47
D 59 60
D 16 50
V 3 26
V 64 70
H 28 31
R 24 25
H 4 70
D 1 42
D 39 39
D 11 33
V 16 68
H 53 71
V 2 71
H 26 47
H 5...

output:

-2
4
12
30
48
60
68
85
99
89
79
64
49
33
9
-12
-27
-20
-39
-54
-71
-85
-89
-85
-88
-97
-102
-100
-84
-64
-48
-25
-19
-20
-19
-12
6
23
36
48
61
77
96
105
106
106
99
79
65
59
56
49
45
35
28
22
16
19
14
8
6
9
13
10
1
-8
-12
-3
4
-5
2

result:

ok 71 lines

Test #2:

score: 0
Accepted
time: 21ms
memory: 4328kb

input:

165231 181869
V 97560 131310
R 4568 154037
R 84344 137004
H 46615 141921
D 93109 94547
R 32071 94168
R 89189 111905
D 1300 93577
V 105118 165223
D 110827 147567
V 3993 32756
D 143493 154640
V 42532 83628
R 48218 132610
R 9781 68504
R 70797 110884
H 131654 143886
D 92398 131461
H 82803 154957
H 22377...

output:

-1
-2
-2
1
1
6
11
15
19
23
28
34
43
48
53
60
69
78
86
93
101
106
115
122
130
137
144
155
164
175
186
199
213
224
233
243
252
261
273
285
299
310
321
333
345
356
365
378
393
406
419
432
443
454
468
483
499
513
527
539
551
564
581
597
617
637
655
672
688
705
720
737
753
768
783
799
817
832
847
862
878...

result:

ok 165231 lines

Test #3:

score: 0
Accepted
time: 28ms
memory: 4612kb

input:

200000 200000
D 1 200000
D 2 200000
D 3 200000
D 4 200000
D 5 200000
D 6 200000
D 7 200000
D 8 200000
D 9 200000
D 10 200000
D 11 200000
D 12 200000
D 13 200000
D 14 200000
D 15 200000
D 16 200000
D 17 200000
D 18 200000
D 19 200000
D 20 200000
D 21 200000
D 22 200000
D 23 200000
D 24 200000
D 25 20...

output:

-1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58
-59
-60
-61
-62
-63
-64
-65
-66
-67
-68
-69
-70
-71
-72
-73
-74
-75
-76
-77
-...

result:

ok 200000 lines

Test #4:

score: -100
Wrong Answer
time: 26ms
memory: 4692kb

input:

200000 200000
H 1 200000
H 2 200000
H 3 200000
H 4 200000
H 5 200000
H 6 200000
H 7 200000
H 8 200000
H 9 200000
H 10 200000
H 11 200000
H 12 200000
H 13 200000
H 14 200000
H 15 200000
H 16 200000
H 17 200000
H 18 200000
H 19 200000
H 20 200000
H 21 200000
H 22 200000
H 23 200000
H 24 200000
H 25 20...

output:

1
3
6
10
15
21
28
36
45
55
66
78
91
105
120
136
153
171
190
210
231
253
276
300
325
351
378
406
435
465
496
528
561
595
630
666
703
741
780
820
861
903
946
990
1035
1081
1128
1176
1225
1275
1326
1378
1431
1485
1540
1596
1653
1711
1770
1830
1891
1953
2016
2080
2145
2211
2278
2346
2415
2485
2556
2628
...

result:

wrong answer 65538th lines differ - expected: '2147647491', found: '6442614787'