QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#56305#2164. Landscape GeneratorUT_aka_Is#TL 0ms3864kbC++707b2022-10-18 17:03:522022-10-18 17:03:53

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-18 17:03:53]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:3864kb
  • [2022-10-18 17:03:52]
  • 提交

answer

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

typedef long long ll;

ll n,k;
ll a[200010],b[200010],c[200010];

int main(){
	scanf("%lld%lld",&n,&k);
	for(int i=0;i<k;i++){
		char C;
		ll x,y;
		scanf("\n%c %lld%lld",&C,&x,&y);
		if(C=='R'){
			b[x]++; b[y+1]--;
		}
		else if(C=='D'){
			b[x]--; b[y+1]++;
		}
		else {
			int t=1;
			if(C=='V')t=-1;
			ll m=(x+y)/2;
			if((y-x)%2==0){
				cerr<<x<<" "<<y<<" "<<m<<" "<<t<<endl;
				c[x]+=t; c[m+1]-=t; c[m+1]-=t; c[y+2]+=t;
			}
			else {
				c[x]+=t; c[m+1]-=t; c[m+2]-=t; c[y+2]+=t;
			}
		}
	}
	for(int i=1;i<=n;i++)c[i]+=c[i-1];
	for(int i=1;i<=n;i++)b[i]+=c[i];
	for(int i=1;i<=n;i++)a[i]=a[i-1]+b[i];
	for(int i=1;i<=n;i++)printf("%lld\n",a[i]);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: -100
Time Limit Exceeded

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:


result: