QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#94658 | #2164. Landscape Generator | 8BQube# | WA | 0ms | 3444kb | C++20 | 1.1kb | 2023-04-07 14:21:36 | 2023-04-07 14:21:37 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define X first
#define Y second
#define SZ(a) ((int)a.size())
#define pb push_back
#define ALL(v) v.begin(), v.end()
const int N = 2e5 + 5;
ll a1[N];
ll a2[N];
void m1(int l, int r, int tp) {
a1[l] += tp;
a1[r + 1] -= tp;
}
void m2(int l, int r, int tp) {
int k1 = (l + r) / 2;
int k2 = (l + r + 1) / 2;
a2[l] += tp;
a2[k1 + 1] -= tp;
a2[k2 + 1] -= tp;
a2[r + 2] += tp;
}
int main() {
ios::sync_with_stdio(0), cin.tie(0);
int n, q;
cin >> n >> q;
while (q--) {
char c;
int l, r;
cin >> c >> l >> r;
if (c == 'R') m1(l, r, 1);
else if (c == 'D') m1(l, r, -1);
else if (c == 'H') m2(l, r, 1);
else if (c == 'V') m2(l, r, -1);
else assert(0);
}
for (int i = 1; i <= n; i++)
a1[i] += a1[i - 1];
ll cur = 0, slp = 0;
for (int i = 1; i <= n; i++) {
slp += a2[i];
cur += slp;
a1[i] += cur;
}
for (int i = 1; i <= n; i++)
cout << a1[i] << " \n"[i == n];
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3444kb
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:
wrong answer 1st lines differ - expected: '-2', found: '-2 4 12 30 48 60 68 85 99 89 7... 8 6 9 13 10 1 -8 -12 -3 4 -5 2'