QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#109639#2164. Landscape GeneratorlohitavaWA 2ms3236kbC++141.5kb2023-05-30 00:35:212023-05-30 00:35:22

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-30 00:35:22]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3236kb
  • [2023-05-30 00:35:21]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

signed main( )
{
    int n,k,i,j,x1,x2,x;
    char c;
    cin >> n >> k;
    int a[n],b[n];
    for (i=0;i<n;i++)
    {
        a[i] = 0;
        b[i] = 0;
    }
    for (i=1;i<=k;i++)
    {
        cin >> c >> x1 >> x2;
        x1--;
        x2--;
        if (c=='R')
        {
            a[x1] += 1;
            if (x2+1 < n)
            {
                a[x2+1] -= 1;
            }
        }
        else if (c=='D')
        {
            a[x1] -= 1;
            if (x2+1 < n)
            {
                a[x2+1] += 1;
            }
        }
        else if (c=='H')
        {
            x = (x2-x1)/2 + 1;
            a[x1] += (1-x1);
            b[x1] += 1;
            a[x1+x] -= (1-x1);
            b[x1+x] -= 1;
            a[x2-x+1] += x2+1;
            b[x2-x+1] += -1;
            if (x2+1 < n)
            {
                a[x2+1] -= x2+1;
                b[x2+1] -= -1;
            }
        }
        else
        {
            x = (x2-x1)/2 + 1;
            a[x1] -= (1-x1);
            b[x1] -= 1;
            a[x1+x] += (1-x1);
            b[x1+x] += 1;
            a[x2-x+1] -= x2+1;
            b[x2-x+1] -= -1;
            if (x2+1 < n)
            {
                a[x2+1] += x2+1;
                b[x2+1] += -1;
            }
        }
    }
    for (i=1;i<n;i++)
    {
        a[i] += a[i-1];
        b[i] += b[i-1];
    }
    for (i=0;i<n;i++)
    {
        a[i] += i*b[i];
        cout << a[i] << '\n';
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3236kb

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
13
27
48
55
54
91
101
110
89
60
62
53
2
-11
-36
5
-39
-44
-58
-100
-160
-46
-107
-101
-152
-71
-68
-108
-91
55
30
-116
-1
-21
-49
66
35
37
85
38
89
154
140
166
63
51
89
41
97
-10
73
-1
38
11
28
16
20
28
6
21
10
10
5
-6
-17
-1
6
-5
2

result:

wrong answer 3rd lines differ - expected: '12', found: '13'