QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#375212#4688. Window ManagerInfinityNS#AC ✓16ms4124kbC++145.3kb2024-04-02 23:46:192024-04-02 23:46:19

Judging History

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

  • [2024-04-02 23:46:19]
  • 评测
  • 测评结果:AC
  • 用时:16ms
  • 内存:4124kb
  • [2024-04-02 23:46:19]
  • 提交

answer

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

int W,H;
char cmd[10];
struct Window{
	int x,y,w,h;

	Window(int a,int b,int c,int d):x(a),y(b),w(c),h(d){}
	bool Inside(int a,int b){
		return x<=a && x+w>a && y<=b && y+h>b;
	}
	bool OverlapX(Window other){
		return max(x,other.x)<min(x+w,other.x+other.w);
	}
	bool OverlapY(Window other){
		return max(y,other.y)<min(y+h,other.y+other.h);
	}
	bool Overlap(Window other){
		return max(x,other.x)<min(x+w,other.x+other.w) &&
			max(y,other.y)<min(y+h,other.y+other.h);
	}
	bool CheckX(Window other,int sgn){
		if(sgn==-1)return other.CheckX(*this,1);
		return x+w==other.x && max(y,other.y)<min(y+h,other.y+other.h);
	}
	bool CheckY(Window other,int sgn){
		if(sgn==-1)return other.CheckY(*this,1);
		return y+h==other.y && max(x,other.x)<min(x+w,other.x+other.w);
	}
};
vector<Window> windows;
int Find(int x,int y){
	for(int i=0;i<windows.size();i++){
		if(windows[i].Inside(x,y)){
			return i;
		}
	}
	return -1;
}
void Add(Window w,int idx){
	for(int i=0;i<windows.size();i++){
		if(w.Overlap(windows[i])){
			printf("Command %i: OPEN - window does not fit\n",idx);
			return;
		}
	}
	if(w.x+w.w>W || w.y+w.h>H){
		printf("Command %i: OPEN - window does not fit\n",idx);
		return;
	}
	windows.pb(w);
}
void Resize(int x,int y,int w,int h,int idx){
	int j=Find(x,y);
	if(j==-1){
		printf("Command %i: RESIZE - no window at given position\n",idx);
		return;
	}
	Window win=Window(windows[j].x,windows[j].y,w,h);
	for(int i=0;i<windows.size();i++){
		if(i==j)continue;
		if(win.Overlap(windows[i])){
			printf("Command %i: RESIZE - window does not fit\n",idx);
			return;
		}
	}
	if(win.x+win.w>W || win.y+win.h>H){
		printf("Command %i: RESIZE - window does not fit\n",idx);
		return;
	}
	windows[j]=win;
}
void Close(int x,int y,int idx){
	int j=Find(x,y);
	if(j==-1){
		printf("Command %i: CLOSE - no window at given position\n",idx);
		return;
	}
	for(int i=j;i+1<windows.size();i++){
		windows[i]=windows[i+1];
	}
	windows.pop_back();
}
void Move(int x,int y,int dx,int dy,int idx){
	int j=Find(x,y);
	if(j==-1){
		printf("Command %i: MOVE - no window at given position\n",idx);
		return;
	}
	int mx=0,my=0;
	int sgn=dx<0?-1:1;
	while(mx!=dx){
		queue<int> q;
		vector<bool> was(windows.size(),false);
		was[j]=true;
		q.push(j);
		while(q.size()){
			int u=q.front();
			q.pop();
			for(int v=0;v<windows.size();v++){
				if(!was[v] && windows[u].CheckX(windows[v],sgn)){
					was[v]=true;
					q.push(v);
				}
			}
		}
		int mxmv=W;
		for(int i=0;i<windows.size();i++){
			if(was[i]){
				if(sgn==1)mxmv=min(mxmv,W-windows[i].x-windows[i].w);
				if(sgn==-1)mxmv=min(mxmv,windows[i].x);
			}
		}
		if(mxmv==0)break;

		for(int i=0;i<windows.size();i++){
			if(was[i]){
				for(int j=0;j<windows.size();j++){
					if(!was[j]){
						if(windows[i].OverlapY(windows[j])){
							if(sgn==1){
								if(windows[j].x>windows[i].x){
									mxmv=min(mxmv,windows[j].x-windows[i].x-windows[i].w);
								}
							}else{
								if(windows[j].x<windows[i].x){
									mxmv=min(mxmv,windows[i].x-windows[j].x-windows[j].w);
								}
							}
						}
					}
				}
			}
		}

		mxmv=min(mxmv,abs(dx)-abs(mx));

		for(int i=0;i<windows.size();i++){
			if(was[i])windows[i].x+=sgn*mxmv;
		}
		mx+=sgn*mxmv;
	}
	sgn=dy<0?-1:1;
	while(my!=dy){
		queue<int> q;
		vector<bool> was(windows.size(),false);
		was[j]=true;
		q.push(j);
		while(q.size()){
			int u=q.front();
			q.pop();
			for(int v=0;v<windows.size();v++){
				if(!was[v] && windows[u].CheckY(windows[v],sgn)){
					was[v]=true;
					q.push(v);
				}
			}
		}
		int mxmv=H;
		for(int i=0;i<windows.size();i++){
			if(was[i]){
				if(sgn==1)mxmv=min(mxmv,H-windows[i].y-windows[i].h);
				if(sgn==-1)mxmv=min(mxmv,windows[i].y);
			}
		}
		if(mxmv==0)break;

		for(int i=0;i<windows.size();i++){
			if(was[i]){
				for(int j=0;j<windows.size();j++){
					if(!was[j]){
						if(windows[i].OverlapX(windows[j])){
							if(sgn==1){
								if(windows[j].y>windows[i].y){
									mxmv=min(mxmv,windows[j].y-windows[i].y-windows[i].h);
								}
							}else{
								if(windows[j].y<windows[i].y){
									mxmv=min(mxmv,windows[i].y-windows[j].y-windows[j].h);
								}
							}
						}
					}
				}
			}
		}

		mxmv=min(mxmv,abs(dy)-abs(my));

		for(int i=0;i<windows.size();i++){
			if(was[i])windows[i].y+=sgn*mxmv;
		}
		my+=sgn*mxmv;
	}
	if(mx!=dx)printf("Command %i: MOVE - moved %i instead of %i\n",idx,abs(mx),abs(dx));
	if(my!=dy)printf("Command %i: MOVE - moved %i instead of %i\n",idx,abs(my),abs(dy));
}
int main(){
	scanf("%i %i",&W,&H);
	int idx=0;
	while(scanf("%s",cmd)==1){
		idx++;
		if(cmd[0]=='O'){
			int x,y,w,h;
			scanf("%i %i %i %i",&x,&y,&w,&h);
			Add(Window(x,y,w,h),idx);
		}else if(cmd[0]=='R'){
			int x,y,w,h;
			scanf("%i %i %i %i",&x,&y,&w,&h);
			Resize(x,y,w,h,idx);
		}else if(cmd[0]=='C'){
			int x,y;
			scanf("%i %i",&x,&y);
			Close(x,y,idx);
		}else if(cmd[0]=='M'){
			int x,y,dx,dy;
			scanf("%i %i %i %i",&x,&y,&dx,&dy);
			Move(x,y,dx,dy,idx);
		}
	}
	printf("%i window(s):\n",windows.size());
	for(int i=0;i<windows.size();i++){
		printf("%i %i %i %i\n",windows[i].x,windows[i].y,windows[i].w,windows[i].h);
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

320 200
OPEN 50 50 10 10
OPEN 70 55 10 10
OPEN 90 50 10 10
RESIZE 55 55 40 40
RESIZE 55 55 15 15
MOVE 55 55 40 0
CLOSE 55 55
CLOSE 110 60
MOVE 95 55 0 -100

output:

Command 4: RESIZE - window does not fit
Command 7: CLOSE - no window at given position
Command 9: MOVE - moved 50 instead of 100
2 window(s):
90 0 15 15
115 50 10 10

result:

ok 6 lines

Test #2:

score: 0
Accepted
time: 1ms
memory: 3792kb

input:

10 10
OPEN 0 0 8 8
MOVE 0 0 5 0

output:

Command 2: MOVE - moved 2 instead of 5
1 window(s):
2 0 8 8

result:

ok 3 lines

Test #3:

score: 0
Accepted
time: 0ms
memory: 3852kb

input:

10 10
OPEN 2 2 8 8
MOVE 3 3 -5 0

output:

Command 2: MOVE - moved 2 instead of 5
1 window(s):
0 2 8 8

result:

ok 3 lines

Test #4:

score: 0
Accepted
time: 0ms
memory: 3848kb

input:

10 10
OPEN 2 2 8 8
MOVE 3 3 0 -5

output:

Command 2: MOVE - moved 2 instead of 5
1 window(s):
2 0 8 8

result:

ok 3 lines

Test #5:

score: 0
Accepted
time: 0ms
memory: 4108kb

input:

10 10
OPEN 0 0 8 8
MOVE 0 0 0 5

output:

Command 2: MOVE - moved 2 instead of 5
1 window(s):
0 2 8 8

result:

ok 3 lines

Test #6:

score: 0
Accepted
time: 12ms
memory: 3812kb

input:

6000 6000
OPEN 5000 5000 5 5
OPEN 5000 4990 5 5
OPEN 5000 4980 5 5
OPEN 5000 4970 5 5
OPEN 5000 4960 5 5
OPEN 5000 4950 5 5
OPEN 5000 4940 5 5
OPEN 5000 4930 5 5
OPEN 5000 4920 5 5
OPEN 5000 4910 5 5
OPEN 5000 4900 5 5
OPEN 5000 4890 5 5
OPEN 5000 4880 5 5
OPEN 5000 4870 5 5
OPEN 5000 4860 5 5
OPEN ...

output:

200 window(s):
5000 1000 5 5
5000 995 5 5
5000 990 5 5
5000 985 5 5
5000 980 5 5
5000 975 5 5
5000 970 5 5
5000 965 5 5
5000 960 5 5
5000 955 5 5
5000 950 5 5
5000 945 5 5
5000 940 5 5
5000 935 5 5
5000 930 5 5
5000 925 5 5
5000 920 5 5
5000 915 5 5
5000 910 5 5
5000 905 5 5
5000 900 5 5
5000 895 5 ...

result:

ok 201 lines

Test #7:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

1000 1000
OPEN 0 0 10 10
OPEN 10 0 10 10
OPEN 20 0 10 10
OPEN 0 10 10 10
OPEN 10 10 10 10
OPEN 20 10 10 10
OPEN 0 20 10 10
OPEN 10 20 10 10
OPEN 20 20 10 10
CLOSE 19 19
CLOSE 20 20
CLOSE 0 10

output:

6 window(s):
0 0 10 10
10 0 10 10
20 0 10 10
20 10 10 10
0 20 10 10
10 20 10 10

result:

ok 7 lines

Test #8:

score: 0
Accepted
time: 0ms
memory: 4108kb

input:

1000 1000
OPEN 500 500 10 10
CLOSE 499 499
CLOSE 499 500
CLOSE 500 499
CLOSE 510 509
CLOSE 509 510
CLOSE 510 510
CLOSE 499 510
CLOSE 500 510
CLOSE 499 509
CLOSE 510 499
CLOSE 510 500
CLOSE 509 499

output:

Command 2: CLOSE - no window at given position
Command 3: CLOSE - no window at given position
Command 4: CLOSE - no window at given position
Command 5: CLOSE - no window at given position
Command 6: CLOSE - no window at given position
Command 7: CLOSE - no window at given position
Command 8: CLOSE -...

result:

ok 14 lines

Test #9:

score: 0
Accepted
time: 0ms
memory: 3848kb

input:

320 200

output:

0 window(s):

result:

ok single line: '0 window(s):'

Test #10:

score: 0
Accepted
time: 1ms
memory: 3820kb

input:

1048576 1048576
OPEN 0 0 100 1048576
OPEN 1000 0 100 524288
OPEN 1000 524288 100 524288
OPEN 2000 0 100 262144
OPEN 2000 262144 100 262144
OPEN 2000 524288 100 262144
OPEN 2000 786432 100 262144
OPEN 3000 0 100 131072
OPEN 3000 131072 100 131072
OPEN 3000 262144 100 131072
OPEN 3000 393216 100 13107...

output:

Command 128: MOVE - moved 1047876 instead of 1048576
127 window(s):
1047876 0 100 1048576
1047976 0 100 524288
1047976 524288 100 524288
1048076 0 100 262144
1048076 262144 100 262144
1048076 524288 100 262144
1048076 786432 100 262144
1048176 0 100 131072
1048176 131072 100 131072
1048176 262144 10...

result:

ok 129 lines

Test #11:

score: 0
Accepted
time: 0ms
memory: 4104kb

input:

1000 1000
OPEN 0 0 1 1
MOVE 0 0 100000 0
MOVE 999 0 0 100000
MOVE 999 999 -100000 0
MOVE 0 999 0 -100000

output:

Command 2: MOVE - moved 999 instead of 100000
Command 3: MOVE - moved 999 instead of 100000
Command 4: MOVE - moved 999 instead of 100000
Command 5: MOVE - moved 999 instead of 100000
1 window(s):
0 0 1 1

result:

ok 6 lines

Test #12:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

1000000000 1000000000
OPEN 843863694 500000001 20 20
OPEN 766187149 500000004 20 20
OPEN 13035129 500000000 20 20
OPEN 798317341 499999996 20 20
OPEN 483704743 500000004 20 20
OPEN 922731855 500000003 20 20
OPEN 931133659 500000001 20 20
OPEN 160148701 499999995 20 20
OPEN 343043291 499999995 20 20
...

output:

Command 101: MOVE - moved 998944099 instead of 1000000000
100 window(s):
999999640 500000001 20 20
999999560 500000004 20 20
999998100 500000000 20 20
999999580 499999996 20 20
999999060 500000004 20 20
999999840 500000003 20 20
999999860 500000001 20 20
999998500 499999995 20 20
999998860 499999995...

result:

ok 102 lines

Test #13:

score: 0
Accepted
time: 2ms
memory: 3816kb

input:

1000000000 1000000000
OPEN 8095 50000030 1000 1000
OPEN 56873 355000042 1000 1000
OPEN 14421 90000036 1000 1000
OPEN 16813 105000063 1000 1000
OPEN 1625 10000002 1000 1000
OPEN 19287 120000007 1000 1000
OPEN 64021 400000022 1000 1000
OPEN 79236 495000076 1000 1000
OPEN 73600 460000092 1000 1000
OPEN...

output:

Command 101: MOVE - moved 999899990 instead of 1000000000
100 window(s):
8095 899971001 1000 1000
56873 999971000 1000 1000
14421 899979001 1000 1000
16813 899982001 1000 1000
1625 899963001 1000 1000
19287 899985001 1000 1000
64021 999980000 1000 1000
29236 899999001 1000 1000
73600 999992000 1000 ...

result:

ok 102 lines

Test #14:

score: 0
Accepted
time: 0ms
memory: 3784kb

input:

1000 1000
OPEN 0 0 10 10
OPEN 0 999 10 10
OPEN 0 991 10 10
OPEN 0 990 10 10
OPEN 999 0 10 10
OPEN 991 0 10 10
OPEN 990 0 10 10
OPEN 999 999 10 10
OPEN 991 991 10 10
OPEN 990 990 10 10
OPEN 990 500 20 20
OPEN 500 990 20 20
OPEN 10 10 980 980

output:

Command 2: OPEN - window does not fit
Command 3: OPEN - window does not fit
Command 5: OPEN - window does not fit
Command 6: OPEN - window does not fit
Command 8: OPEN - window does not fit
Command 9: OPEN - window does not fit
Command 11: OPEN - window does not fit
Command 12: OPEN - window does no...

result:

ok 14 lines

Test #15:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

1000 500
OPEN 0 0 500 1000
OPEN 0 0 1000 500
OPEN 10 10 10 10

output:

Command 1: OPEN - window does not fit
Command 3: OPEN - window does not fit
1 window(s):
0 0 1000 500

result:

ok 4 lines

Test #16:

score: 0
Accepted
time: 0ms
memory: 3792kb

input:

57 15
OPEN 28 2 26 3
OPEN 31 6 9 3
OPEN 24 10 7 3
OPEN 41 9 9 5
OPEN 6 2 12 11
MOVE 6 2 100 0

output:

Command 6: MOVE - moved 13 instead of 100
5 window(s):
31 2 26 3
31 6 9 3
31 10 7 3
41 9 9 5
19 2 12 11

result:

ok 7 lines

Test #17:

score: 0
Accepted
time: 0ms
memory: 4108kb

input:

1000 1000
OPEN 0 0 10 10
OPEN 10 10 10 10
RESIZE 5 5 11 11
RESIZE 5 5 20 10
RESIZE 5 5 10 20
OPEN 10 0 10 10
RESIZE 5 5 10 30
OPEN 30 30 20 20
RESIZE 10 10 25 25
RESIZE 10 10 20 20
RESIZE 10 10 99 20
RESIZE 10 10 20 99

output:

Command 3: RESIZE - window does not fit
Command 9: RESIZE - window does not fit
4 window(s):
0 0 10 30
10 10 20 99
10 0 10 10
30 30 20 20

result:

ok 7 lines

Test #18:

score: 0
Accepted
time: 0ms
memory: 4112kb

input:

1000 1000
OPEN 1 1 9 9
RESIZE 10 10 4 5
RESIZE 9 10 4 5
RESIZE 10 9 4 5
RESIZE 0 0 4 5
RESIZE 9 9 10000 10000
RESIZE 9 9 1 1
RESIZE 9 9 10 10
RESIZE 1 1 999 999
MOVE 999 999 -100 0
MOVE 999 999 0 -100
MOVE 998 999 0 -100
RESIZE 0 0 1000 1000
RESIZE 0 0 1000 1000

output:

Command 2: RESIZE - no window at given position
Command 3: RESIZE - no window at given position
Command 4: RESIZE - no window at given position
Command 5: RESIZE - no window at given position
Command 6: RESIZE - window does not fit
Command 8: RESIZE - no window at given position
Command 10: MOVE - m...

result:

ok 11 lines

Test #19:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

1000 1000
OPEN 35 73 10 10
RESIZE 40 80 2 3

output:

1 window(s):
35 73 2 3

result:

ok 2 lines

Test #20:

score: 0
Accepted
time: 2ms
memory: 3824kb

input:

1000000000 1000000000
OPEN 381124069 717531090 148580 449700
OPEN 108986324 452510833 52683 565268
OPEN 284819270 489545047 773319 285498
OPEN 935851845 556303966 325424 370385
OPEN 640435993 698077893 322101 82692
OPEN 589838034 532505723 365403 170336
OPEN 293117250 41354928 233320 684643
OPEN 873...

output:

Command 102: MOVE - moved 998322302 instead of 1000000000
101 window(s):
381124069 998322303 148580 449700
108986324 998322303 52683 565268
284819270 998322303 773319 285498
935851845 998322303 325424 370385
640435993 998322303 322101 82692
589838034 998322303 365403 170336
293117250 998322303 23332...

result:

ok 103 lines

Test #21:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

50 75
OPEN 20 10 20 5
OPEN 10 25 12 10
OPEN 30 20 10 25
OPEN 20 55 15 10
MOVE 20 10 0 50

output:

Command 5: MOVE - moved 25 instead of 50
4 window(s):
20 35 20 5
10 40 12 10
30 40 10 25
20 65 15 10

result:

ok 6 lines

Test #22:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

1024 1024
OPEN 258 112 512 4
OPEN 130 104 256 4
OPEN 642 104 256 4
OPEN 66 96 128 4
OPEN 322 96 128 4
OPEN 578 96 128 4
OPEN 834 96 128 4
OPEN 34 88 64 4
OPEN 162 88 64 4
OPEN 290 88 64 4
OPEN 418 88 64 4
OPEN 546 88 64 4
OPEN 674 88 64 4
OPEN 802 88 64 4
OPEN 930 88 64 4
OPEN 18 80 32 4
OPEN 82 80 ...

output:

Command 256: MOVE - moved 84 instead of 1000
255 window(s):
258 28 512 4
130 24 256 4
642 24 256 4
66 20 128 4
322 20 128 4
578 20 128 4
834 20 128 4
34 16 64 4
162 16 64 4
290 16 64 4
418 16 64 4
546 16 64 4
674 16 64 4
802 16 64 4
930 16 64 4
18 12 32 4
82 12 32 4
146 12 32 4
210 12 32 4
274 12 32...

result:

ok 257 lines

Test #23:

score: 0
Accepted
time: 1ms
memory: 4116kb

input:

999893418 783298482
OPEN 924766677 743041465 2974461 218151
OPEN 591964127 331920701 1766772 340221
OPEN 191976694 348233805 736719 1188089
OPEN 24764327 67186711 2366442 1099877
OPEN 512579286 575104856 1196527 150275
OPEN 783018891 461459529 2192809 1621405
OPEN 970631764 284174829 2532353 962632
...

output:

256 window(s):
924766677 743041465 2974461 218151
591964127 331920701 1766772 340221
191976694 348233805 736719 1188089
24764327 67186711 2366442 1099877
512579286 575104856 1196527 150275
783018891 461459529 2192809 1621405
970631764 284174829 2532353 962632
571985811 517393798 1047859 223857
47401...

result:

ok 257 lines

Test #24:

score: 0
Accepted
time: 0ms
memory: 3892kb

input:

999893418 783298482
CLOSE 293424659 282708926
CLOSE 161680107 226982613
CLOSE 132845898 500823419
CLOSE 20524984 190102284
CLOSE 807862546 667346938
CLOSE 339642117 575481581
CLOSE 809881907 509265520
CLOSE 621024935 590461927
CLOSE 319542856 259271671
CLOSE 256312889 180878739
CLOSE 513246561 42243...

output:

Command 1: CLOSE - no window at given position
Command 2: CLOSE - no window at given position
Command 3: CLOSE - no window at given position
Command 4: CLOSE - no window at given position
Command 5: CLOSE - no window at given position
Command 6: CLOSE - no window at given position
Command 7: CLOSE -...

result:

ok 257 lines

Test #25:

score: 0
Accepted
time: 0ms
memory: 3844kb

input:

999893418 783298482
RESIZE 462394324 162006560 1365073 2586212
RESIZE 887269382 283523794 1135729 474985
RESIZE 882138525 725365748 153796 1168456
RESIZE 399952346 187311323 2215674 2159171
RESIZE 368130932 768885579 2029397 632131
RESIZE 684080488 104416496 1376034 1512240
RESIZE 184542352 83561003...

output:

Command 1: RESIZE - no window at given position
Command 2: RESIZE - no window at given position
Command 3: RESIZE - no window at given position
Command 4: RESIZE - no window at given position
Command 5: RESIZE - no window at given position
Command 6: RESIZE - no window at given position
Command 7: R...

result:

ok 257 lines

Test #26:

score: 0
Accepted
time: 0ms
memory: 4108kb

input:

999893418 783298482
MOVE 256369210 755765088 452342770 0
MOVE 519941351 318189721 556562130 0
MOVE 834434438 50314769 0 746266310
MOVE 912448693 540617848 417186154 0
MOVE 974184964 67113924 715952459 0
MOVE 9101426 37972237 0 78958534
MOVE 868944101 482088183 0 242691446
MOVE 161327541 741240188 96...

output:

Command 1: MOVE - no window at given position
Command 2: MOVE - no window at given position
Command 3: MOVE - no window at given position
Command 4: MOVE - no window at given position
Command 5: MOVE - no window at given position
Command 6: MOVE - no window at given position
Command 7: MOVE - no win...

result:

ok 257 lines

Test #27:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

999893418 783298482
OPEN 868307650 123976895 95021050 232215237
OPEN 918720409 429876285 302665445 67744121
OPEN 378750213 578878113 42023803 226301833
RESIZE 262466633 304322661 25671833 377999643
MOVE 886253936 172522212 0 401907404
CLOSE 443972650 502330205
MOVE 151297544 527696822 0 401907404
RE...

output:

Command 2: OPEN - window does not fit
Command 3: OPEN - window does not fit
Command 4: RESIZE - no window at given position
Command 6: CLOSE - no window at given position
Command 7: MOVE - no window at given position
Command 8: RESIZE - no window at given position
Command 9: CLOSE - no window at giv...

result:

ok 239 lines

Test #28:

score: 0
Accepted
time: 0ms
memory: 4072kb

input:

999893418 783298482
OPEN 650007071 153900041 154852315 190248514
OPEN 390406485 485619851 222798457 86090489
OPEN 199270841 291887538 294862475 122172064
RESIZE 811644172 284044736 82239146 172177095
MOVE 79872506 169769748 0 401907404
MOVE 459858016 538221010 0 401907404
CLOSE 446946407 232301099
M...

output:

Command 4: RESIZE - no window at given position
Command 5: MOVE - no window at given position
Command 6: MOVE - moved 211588142 instead of 401907404
Command 7: CLOSE - no window at given position
Command 8: MOVE - no window at given position
Command 9: CLOSE - no window at given position
Command 10:...

result:

ok 235 lines

Test #29:

score: 0
Accepted
time: 0ms
memory: 3896kb

input:

999893418 783298482
OPEN 210284819 702790707 91737354 324578199
OPEN 535478371 616730717 234167274 231426019
OPEN 332597022 682911937 469601880 163911842
MOVE 40372286 674640263 0 401907404
MOVE 604858510 570435056 0 401907404
MOVE 552602133 46562601 0 401907404
RESIZE 412086385 662205334 36694248 2...

output:

Command 1: OPEN - window does not fit
Command 2: OPEN - window does not fit
Command 3: OPEN - window does not fit
Command 4: MOVE - no window at given position
Command 5: MOVE - no window at given position
Command 6: MOVE - no window at given position
Command 7: RESIZE - no window at given position
...

result:

ok 253 lines

Test #30:

score: 0
Accepted
time: 0ms
memory: 4104kb

input:

999893418 783298482
OPEN 622470890 301511926 313085465 239920613
OPEN 462843839 38287673 114376170 344293981
OPEN 306254634 516354980 430106429 345807657
MOVE 14765784 419283598 0 401907404
RESIZE 196988578 303048878 332229849 218074951
MOVE 468371413 237412782 0 401907404
MOVE 381732296 707786453 0...

output:

Command 3: OPEN - window does not fit
Command 4: MOVE - no window at given position
Command 5: RESIZE - no window at given position
Command 6: MOVE - moved 400716828 instead of 401907404
Command 7: MOVE - no window at given position
Command 8: RESIZE - no window at given position
Command 9: CLOSE - ...

result:

ok 239 lines

Test #31:

score: 0
Accepted
time: 1ms
memory: 4108kb

input:

999893418 783298482
OPEN 936582930 422274691 6605484 16026672
OPEN 157438873 653671478 27359607 28618925
OPEN 90927918 226737629 51186431 95452416
OPEN 421378832 542071713 91353583 81799726
OPEN 429715012 398551069 23108212 53115627
OPEN 579077829 198642477 8543785 42666504
OPEN 819217682 417351722 ...

output:

Command 256: MOVE - moved 366869370 instead of 999893418
255 window(s):
936582930 422274691 6605484 16026672
137875572 653671478 27359607 28618925
90927918 226737629 51186431 95452416
421378832 542071713 91353583 81799726
429715012 398551069 23108212 53115627
579077829 198642477 8543785 42666504
819...

result:

ok 257 lines

Test #32:

score: 0
Accepted
time: 1ms
memory: 4112kb

input:

999893418 783298482
OPEN 424731513 619140548 93822339 26407438
OPEN 25343151 22300447 94757636 72036513
OPEN 436132598 303888175 46139754 16160541
OPEN 845450366 613365142 42846498 855503
OPEN 761918584 154729771 74973150 79686464
OPEN 917740390 585277598 42866039 16917323
OPEN 611469632 456613137 6...

output:

Command 256: MOVE - moved 200448361 instead of 999893418
255 window(s):
400583120 619140548 93822339 26407438
25343151 22300447 94757636 72036513
436132598 303888175 46139754 16160541
845450366 613365142 42846498 855503
761918584 154729771 74973150 79686464
917740390 585277598 42866039 16917323
6114...

result:

ok 257 lines

Test #33:

score: 0
Accepted
time: 2ms
memory: 4124kb

input:

999893418 783298482
OPEN 561138886 544725858 25194933 56095503
OPEN 137844110 110344771 1843214 60729840
OPEN 257749469 280192034 64824359 61635190
OPEN 764858575 639784341 58310941 67709892
OPEN 37249270 3214446 69761106 28603988
OPEN 640775628 91637624 47435375 71935937
OPEN 224917130 583674105 57...

output:

Command 256: MOVE - moved 232893346 instead of 783298482
255 window(s):
561138886 544725858 25194933 56095503
137844110 110344771 1843214 60729840
257749469 280192034 64824359 61635190
764858575 639784341 58310941 67709892
37249270 3214446 69761106 28603988
640775628 91637624 47435375 71935937
22491...

result:

ok 257 lines

Test #34:

score: 0
Accepted
time: 2ms
memory: 3820kb

input:

999893418 783298482
OPEN 232496351 684632652 80501801 27594206
OPEN 64664516 360597595 48760311 99874682
OPEN 659312390 17480734 75717209 4141801
OPEN 80245377 540061900 59491170 75809858
OPEN 406720790 196388094 1960719 42822322
OPEN 282254034 275323262 61545128 78482943
OPEN 527387642 274105510 29...

output:

Command 256: MOVE - moved 249252102 instead of 783298482
255 window(s):
232496351 684632652 80501801 27594206
64664516 360597595 48760311 99874682
659312390 17480734 75717209 4141801
80245377 540061900 59491170 75809858
406720790 161540038 1960719 42822322
282254034 194240490 61545128 78482943
52738...

result:

ok 257 lines

Test #35:

score: 0
Accepted
time: 2ms
memory: 3816kb

input:

698734875 991757821
OPEN 406819633 846930886 4729089 28648621
OPEN 560278043 424238335 21150516 62947980
OPEN 596516649 197883600 46973544 61204861
OPEN 84633815 110762238 18566640 83174068
OPEN 666445665 548625605 24595224 14170570
OPEN 35005211 521595368 15208619 40968135
OPEN 336465782 861021530 ...

output:

Command 134: MOVE - moved 146825008 instead of 243847001
Command 139: MOVE - moved 18961174 instead of 675896412
Command 142: MOVE - moved 143662995 instead of 265528873
Command 144: MOVE - moved 151399695 instead of 642538809
Command 145: MOVE - moved 278196884 instead of 512976554
Command 148: MOV...

result:

ok 175 lines

Test #36:

score: 0
Accepted
time: 2ms
memory: 3760kb

input:

698734875 991757821
OPEN 165000152 48087713 69195898 45363400
OPEN 295555709 206317281 46347688 67130709
OPEN 104605094 339011283 49633818 75412011
OPEN 619951598 50513059 53225108 12995236
OPEN 151420792 987301502 54623524 4138793
OPEN 251923705 139489880 56052462 56104905
OPEN 181839156 871008507 ...

output:

Command 133: MOVE - moved 252123141 instead of 662334434
Command 136: MOVE - moved 10142502 instead of 629296019
Command 138: MOVE - moved 235990097 instead of 512927505
Command 139: MOVE - moved 11832526 instead of 519910412
Command 142: MOVE - moved 69437545 instead of 352204760
Command 144: MOVE ...

result:

ok 184 lines

Test #37:

score: 0
Accepted
time: 2ms
memory: 4108kb

input:

698734875 991757821
OPEN 71876166 708592740 15785654 14701203
OPEN 442951012 537146758 39402768 69450864
OPEN 647800535 53523743 15207517 56830631
OPEN 175389892 191411627 24731419 9348747
OPEN 12109242 469976352 67452478 22867431
OPEN 533580852 200591758 27324455 61211338
OPEN 312202391 261762355 3...

output:

Command 132: MOVE - moved 335982195 instead of 634155367
Command 134: MOVE - moved 256184352 instead of 492838416
Command 135: MOVE - moved 96708108 instead of 486113129
Command 136: MOVE - moved 28915993 instead of 835441589
Command 137: MOVE - moved 65910812 instead of 88239787
Command 138: MOVE -...

result:

ok 173 lines

Test #38:

score: 0
Accepted
time: 2ms
memory: 3900kb

input:

698734875 991757821
OPEN 65713999 588626886 48654208 6227366
OPEN 335808950 863720183 12643042 29744348
OPEN 129244470 847886214 61902272 66848433
OPEN 198012771 132645883 41123484 29329605
OPEN 5853806 378236554 26492432 81149020
OPEN 563981229 857806142 25075746 38080502
OPEN 52431433 329239339 34...

output:

Command 132: MOVE - moved 123968727 instead of 776617968
Command 135: MOVE - moved 128933048 instead of 342681162
Command 138: MOVE - moved 24440074 instead of 225103480
Command 139: MOVE - moved 90668995 instead of 118495956
Command 141: MOVE - moved 361979734 instead of 783114585
Command 143: MOVE...

result:

ok 192 lines

Test #39:

score: 0
Accepted
time: 5ms
memory: 3896kb

input:

999893418 783298482
OPEN 0 391649261 10 20
OPEN 10 391649251 10 20
OPEN 10 391649271 10 20
OPEN 20 391649241 10 20
OPEN 20 391649261 10 20
OPEN 20 391649281 10 20
OPEN 30 391649231 10 20
OPEN 30 391649251 10 20
OPEN 30 391649271 10 20
OPEN 30 391649291 10 20
OPEN 40 391649221 10 20
OPEN 40 391649241...

output:

128 window(s):
305076339 391649261 10 20
305076349 391649251 10 20
305076349 391649271 10 20
305076359 391649241 10 20
305076359 391649261 10 20
305076359 391649281 10 20
305076369 391649231 10 20
305076369 391649251 10 20
305076369 391649271 10 20
305076369 391649291 10 20
305076379 391649221 10 20...

result:

ok 129 lines

Test #40:

score: 0
Accepted
time: 2ms
memory: 4104kb

input:

999893418 783298482
OPEN 999893408 391649261 10 20
OPEN 999893398 391649251 10 20
OPEN 999893398 391649271 10 20
OPEN 999893388 391649241 10 20
OPEN 999893388 391649261 10 20
OPEN 999893388 391649281 10 20
OPEN 999893378 391649231 10 20
OPEN 999893378 391649251 10 20
OPEN 999893378 391649271 10 20
O...

output:

128 window(s):
674696198 391649261 10 20
674696188 391649251 10 20
674696188 391649271 10 20
674696178 391649241 10 20
674696178 391649261 10 20
674696178 391649281 10 20
674696168 391649231 10 20
674696168 391649251 10 20
674696168 391649271 10 20
674696168 391649291 10 20
674696158 391649221 10 20...

result:

ok 129 lines

Test #41:

score: 0
Accepted
time: 5ms
memory: 4116kb

input:

999893418 783298482
OPEN 391649261 0 20 10
OPEN 391649251 10 20 10
OPEN 391649271 10 20 10
OPEN 391649241 20 20 10
OPEN 391649261 20 20 10
OPEN 391649281 20 20 10
OPEN 391649231 30 20 10
OPEN 391649251 30 20 10
OPEN 391649271 30 20 10
OPEN 391649291 30 20 10
OPEN 391649221 40 20 10
OPEN 391649241 40...

output:

128 window(s):
391649261 249698813 20 10
391649251 249698823 20 10
391649271 249698823 20 10
391649241 249698833 20 10
391649261 249698833 20 10
391649281 249698833 20 10
391649231 249698843 20 10
391649251 249698843 20 10
391649271 249698843 20 10
391649291 249698843 20 10
391649221 249698853 20 10...

result:

ok 129 lines

Test #42:

score: 0
Accepted
time: 5ms
memory: 3824kb

input:

999893418 783298482
OPEN 391649261 783298472 20 10
OPEN 391649251 783298462 20 10
OPEN 391649271 783298462 20 10
OPEN 391649241 783298452 20 10
OPEN 391649261 783298452 20 10
OPEN 391649281 783298452 20 10
OPEN 391649231 783298442 20 10
OPEN 391649251 783298442 20 10
OPEN 391649271 783298442 20 10
O...

output:

128 window(s):
391649261 516070955 20 10
391649251 516070945 20 10
391649271 516070945 20 10
391649241 516070935 20 10
391649261 516070935 20 10
391649281 516070935 20 10
391649231 516070925 20 10
391649251 516070925 20 10
391649271 516070925 20 10
391649291 516070925 20 10
391649221 516070915 20 10...

result:

ok 129 lines

Test #43:

score: 0
Accepted
time: 13ms
memory: 3904kb

input:

1000000000 1000000000
OPEN 484 52 2 3
OPEN 414 50 1 3
OPEN 324 50 1 3
OPEN 364 52 1 3
OPEN 82 52 1 3
OPEN 182 48 1 3
OPEN 160 52 2 3
OPEN 220 52 2 3
OPEN 268 52 2 3
OPEN 418 52 1 3
OPEN 342 50 1 3
OPEN 96 50 1 3
OPEN 60 50 2 3
OPEN 494 48 1 3
OPEN 446 48 1 3
OPEN 206 48 2 3
OPEN 114 50 2 3
OPEN 30 5...

output:

Command 256: MOVE - moved 999999728 instead of 1000000000
255 window(s):
999999984 52 2 3
999999945 50 1 3
999999900 50 1 3
999999917 52 1 3
999999773 52 1 3
999999829 48 1 3
999999816 52 2 3
999999846 52 2 3
999999870 52 2 3
999999946 52 1 3
999999908 50 1 3
999999779 50 1 3
999999761 50 2 3
999999...

result:

ok 257 lines

Test #44:

score: 0
Accepted
time: 16ms
memory: 3836kb

input:

1000000000 1000000000
OPEN 704 48 1 3
OPEN 598 50 1 3
OPEN 692 48 1 3
OPEN 572 48 2 3
OPEN 552 52 2 3
OPEN 1000 50 2 3
OPEN 600 52 2 3
OPEN 784 50 2 3
OPEN 826 50 1 3
OPEN 680 48 2 3
OPEN 956 48 2 3
OPEN 496 50 1 3
OPEN 908 48 2 3
OPEN 546 52 2 3
OPEN 596 48 2 3
OPEN 992 48 1 3
OPEN 536 48 1 3
OPEN ...

output:

Command 256: MOVE - moved 730 instead of 1000000000
255 window(s):
113 48 1 3
53 50 1 3
107 48 1 3
37 48 2 3
29 52 2 3
270 50 2 3
54 52 2 3
152 50 2 3
175 50 1 3
99 48 2 3
245 48 2 3
2 50 1 3
219 48 2 3
26 52 2 3
51 48 2 3
265 48 1 3
21 48 1 3
177 52 1 3
226 52 1 3
72 50 2 3
23 48 1 3
241 52 2 3
47 ...

result:

ok 257 lines

Test #45:

score: 0
Accepted
time: 15ms
memory: 3820kb

input:

1000000000 1000000000
OPEN 48 794 3 2
OPEN 50 652 3 1
OPEN 48 692 3 1
OPEN 52 756 3 1
OPEN 48 638 3 2
OPEN 50 640 3 2
OPEN 50 910 3 1
OPEN 50 604 3 1
OPEN 52 654 3 2
OPEN 50 988 3 1
OPEN 48 596 3 2
OPEN 50 622 3 1
OPEN 52 492 3 1
OPEN 52 828 3 2
OPEN 50 688 3 2
OPEN 48 620 3 1
OPEN 48 782 3 1
OPEN 5...

output:

Command 256: MOVE - moved 733 instead of 1000000000
255 window(s):
48 156 3 2
50 86 3 1
48 106 3 1
52 139 3 1
48 76 3 2
50 78 3 2
50 220 3 1
50 60 3 1
52 87 3 2
50 260 3 1
48 55 3 2
50 69 3 1
52 0 3 1
52 176 3 2
50 104 3 2
48 68 3 1
48 151 3 1
50 250 3 1
52 10 3 1
50 148 3 2
48 172 3 2
50 256 3 2
50...

result:

ok 257 lines

Test #46:

score: 0
Accepted
time: 13ms
memory: 4112kb

input:

1000000000 1000000000
OPEN 48 404 3 2
OPEN 52 502 3 1
OPEN 50 348 3 1
OPEN 52 82 3 1
OPEN 50 390 3 1
OPEN 50 120 3 1
OPEN 50 186 3 2
OPEN 52 34 3 1
OPEN 48 50 3 2
OPEN 50 72 3 2
OPEN 48 128 3 1
OPEN 48 302 3 2
OPEN 50 66 3 1
OPEN 48 68 3 2
OPEN 50 504 3 2
OPEN 52 52 3 1
OPEN 50 294 3 1
OPEN 52 388 3...

output:

Command 256: MOVE - moved 999999725 instead of 1000000000
255 window(s):
48 999999943 3 2
52 999999995 3 1
50 999999910 3 1
52 999999767 3 1
50 999999935 3 1
50 999999788 3 1
50 999999822 3 2
52 999999742 3 1
48 999999752 3 2
50 999999763 3 2
48 999999793 3 1
48 999999887 3 2
50 999999760 3 1
48 999...

result:

ok 257 lines