10703 - Free spots

All about problems in Volume 107. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

D-DY
New poster
Posts: 2
Joined: Wed Sep 08, 2004 7:56 pm
Location: Rouen, France

10703 - Free spots

Post by D-DY »

I can't find out why WA ...
here is some inputs/ouputs I get

Code: Select all

Inputs:
1 1 1
1 1 1 1

2 2 2
1 1 1 2
1 1 2 1

493 182 3
349 148 363 146
241 123 443 147
303 124 293 17

355 299 1
197 25 338 230

395 403 11
228 211 62 260
6 275 279 109
384 291 374 129
22 324 181 108
158 353 150 85
101 358 230 275
88 346 2 128
91 226 312 76
226 273 119 300
224 176 206 28
169 185 187 178

307 231 71
109 126 75 193
125 145 232 117
250 122 261 46
40 8 205 116
82 184 97 202
193 24 86 113
197 140 180 46
119 59 304 91
164 46 218 114
97 155 186 130
196 210 303 213
75 115 60 217
184 77 166 204
240 138 61 62
58 152 46 210
272 178 217 82
254 188 189 50
279 198 184 115
50 95 220 220
266 219 126 134
240 197 77 188
99 18 142 219
61 231 154 101
173 100 12 65
293 42 40 45
87 50 46 2
123 72 53 143
52 35 262 54
56 34 81 36
244 199 109 19
158 75 81 100
303 98 196 169
33 112 201 28
86 119 73 97
218 205 96 149
179 165 299 192
120 199 165 24
63 104 151 224
25 44 92 18
307 169 249 113
136 185 18 60
40 59 269 111
109 104 55 28
126 25 62 206
120 183 108 108
94 179 188 32
13 85 32 166
145 156 72 222
6 179 306 57
141 70 80 197
43 93 31 85
58 4 184 24
98 143 11 223
206 125 230 184
105 96 15 128
262 59 281 200
133 38 116 222
55 146 289 115
3 216 51 198
270 18 33 15
143 211 145 68
86 187 193 140
85 63 233 209
32 112 199 100
29 146 88 89
124 77 247 128
68 115 105 11
213 24 37 182
110 125 20 75
241 77 173 68
45 2 197 54

14 185 55
14 10 8 11
8 113 7 41
1 48 3 107
8 102 5 153
14 161 1 80
9 137 1 35
8 98 9 43
5 132 1 69
7 53 3 49
12 44 5 73
1 15 11 134
4 103 5 8
14 55 13 131
11 55 10 122
10 139 4 39
4 154 12 87
8 83 13 51
6 169 10 81
5 48 11 69
3 5 2 94
7 41 6 73
4 102 7 90
8 83 10 154
1 108 14 161
6 167 9 97
10 182 5 75
10 28 4 123
8 156 6 13
1 135 3 94
1 83 10 97
8 65 3 38
1 172 8 97
14 88 10 37
6 121 8 157
2 15 3 89
5 89 9 85
8 47 7 33
11 123 10 28
13 71 14 29
9 156 4 13
11 66 3 97
11 179 3 185
4 180 12 128
13 70 12 122
7 117 7 54
8 111 4 82
2 4 2 154
8 20 14 94
9 176 10 105
1 134 6 92
5 60 5 91
10 83 6 6
5 69 10 18
2 6 14 124
13 35 8 99

181 482 65
167 11 97 15
49 307 16 44
160 386 105 289
30 118 69 174
41 3 139 67
118 326 107 1
86 221 54 256
77 482 155 271
101 228 66 310
74 192 142 402
173 67 8 230
168 256 64 70
168 46 163 285
87 158 24 275
12 269 70 354
79 384 41 473
16 131 1 325
169 65 118 201
147 433 114 73
75 249 47 408
65 404 50 36
104 457 15 283
95 110 20 229
112 9 116 372
181 461 43 385
150 382 95 181
25 123 153 458
174 455 100 304
163 31 56 420
98 26 35 327
149 447 90 339
82 239 57 116
74 117 111 260
44 108 127 466
175 6 93 36
156 261 111 471
127 330 7 197
72 466 83 8
168 247 94 87
101 107 167 196
31 258 127 363
137 193 157 215
14 47 133 59
67 165 82 123
152 228 68 447
8 357 34 477
43 379 54 327
13 474 119 374
69 124 100 331
47 374 159 174
75 153 15 194
118 140 110 223
157 472 129 144
30 80 173 195
125 35 154 329
71 332 120 60
52 437 78 173
139 113 169 50
57 147 22 472
152 315 112 419
177 170 147 207
133 312 54 461
160 182 145 228
108 329 178 223
171 437 129 266

109 23 33
30 14 24 4
70 15 108 18
32 2 34 12
3 11 9 5
58 3 37 18
99 19 35 12
103 22 6 13
109 23 93 11
82 10 102 11
19 16 21 18
44 10 28 3
58 15 18 3
47 3 43 19
38 5 68 5
77 1 85 1
40 3 58 10
21 19 10 20
14 18 23 6
89 7 100 10
105 15 76 17
67 17 30 19
22 10 92 23
18 21 83 4
103 17 59 5
40 11 6 4
101 8 51 6
10 20 103 3
54 14 108 20
31 16 78 1
76 17 40 9
104 23 79 15
26 10 22 17
35 21 48 20

22 6 81
4 6 8 3
10 3 22 6
11 6 2 5
17 6 9 1
22 6 17 5
11 3 3 4
2 6 22 4
21 5 13 6
7 1 3 1
9 2 9 1
13 6 18 5
22 6 16 3
7 4 16 1
7 1 1 4
7 2 20 1
16 2 19 6
16 4 21 2
6 6 21 5
6 6 18 5
4 6 9 4
11 4 11 2
20 2 17 3
4 4 22 2
12 5 5 1
21 3 13 6
16 5 8 3
13 1 19 6
20 5 7 4
22 6 11 1
16 2 20 4
2 5 13 1
17 2 9 3
21 3 7 1
3 1 1 5
2 5 14 3
13 6 11 6
15 2 18 3
12 3 8 2
2 6 5 1
16 3 1 2
17 4 8 5
21 1 3 5
18 3 12 3
8 6 19 2
15 5 3 5
14 1 8 6
17 4 4 6
2 5 17 1
14 3 15 2
7 1 12 6
2 4 16 4
16 5 21 6
19 1 8 2
17 3 17 6
11 3 7 1
6 2 10 2
16 2 19 6
13 5 20 6
12 2 20 5
14 5 17 1
15 4 11 5
5 1 9 3
12 4 18 5
4 3 1 1
14 3 12 3
19 4 6 3
1 1 11 1
11 4 20 1
21 3 1 2
11 2 9 1
3 2 11 5
18 2 2 1
17 4 1 3
11 2 14 5
6 6 7 4
16 3 18 5
16 1 13 3
5 6 20 2
21 6 8 6
19 3 4 2
18 6 12 6

280 303 72
104 106 185 166
95 235 280 139
53 134 77 274
80 57 228 261
208 40 262 96
82 220 142 149
108 284 224 43
144 36 17 294
260 229 227 156
149 292 167 85
1 67 48 153
222 183 188 76
29 129 217 30
135 115 249 29
37 257 158 207
141 121 201 154
63 261 53 97
82 273 271 297
40 73 138 284
239 93 240 292
275 173 78 6
88 128 154 38
23 264 211 171
149 140 98 209
53 184 276 87
1 10 270 135
206 176 240 63
241 87 229 82
12 36 18 241
66 241 175 253
212 267 185 174
194 76 272 301
266 149 185 180
64 271 162 101
159 67 26 116
93 3 125 23
126 10 50 26
78 258 256 240
70 146 215 119
216 13 261 130
222 290 94 296
199 91 78 138
82 22 173 253
73 259 142 35
96 90 247 126
251 178 55 254
103 212 234 22
30 98 5 196
48 70 125 151
75 299 51 268
8 98 53 203
208 226 137 3
231 228 110 121
48 81 99 201
139 103 189 150
222 258 228 60
192 229 269 187
256 293 3 33
177 17 79 302
239 52 146 132
112 76 168 154
108 45 155 74
140 245 146 130
39 164 14 299
53 131 24 275
20 128 112 12
27 17 138 220
92 185 49 54
104 272 18 244
142 58 221 109
178 105 188 10
140 180 242 258

425 5 71
227 3 304 2
37 1 236 4
196 1 60 1
97 4 6 4
2 3 66 1
109 5 44 5
299 5 226 5
284 3 191 4
364 3 220 1
167 3 27 3
147 3 214 4
54 5 284 1
349 5 382 2
392 5 340 3
71 5 291 2
304 1 4 4
407 1 16 1
309 5 243 1
258 3 148 2
26 5 155 3
123 2 311 2
385 5 87 4
142 5 179 5
95 3 279 3
48 5 207 2
242 1 317 1
390 1 202 2
377 2 395 3
86 5 35 3
297 2 29 4
18 5 43 1
405 2 177 1
36 1 268 2
154 4 186 4
329 2 67 3
227 5 383 5
421 1 121 4
379 5 293 2
201 5 136 5
280 3 331 5
55 1 397 1
81 1 355 3
67 5 51 3
181 1 37 5
107 3 131 5
58 3 343 4
146 2 265 5
158 4 230 4
55 3 75 1
268 1 357 4
78 2 37 4
20 5 136 1
218 3 165 3
62 2 53 1
349 1 130 3
324 1 364 1
347 3 86 4
314 4 77 4
105 4 106 2
31 3 299 2
359 5 23 2
107 5 415 5
41 5 38 4
332 4 105 2
229 2 293 1
229 4 118 2
217 4 395 2
235 2 352 4
201 1 233 1
420 2 84 4
403 2 385 5

364 195 92
137 101 132 40
81 176 340 19
165 67 95 48
291 70 118 190
352 142 200 96
349 149 99 184
308 102 152 185
220 55 23 152
199 30 163 150
256 194 146 145
176 74 82 149
272 36 141 158
40 2 40 66
47 23 76 155
350 18 188 37
154 32 89 193
65 53 133 75
64 16 190 102
101 56 317 61
121 64 339 95
157 188 11 2
359 95 216 96
132 41 150 133
304 11 267 158
348 68 351 31
341 9 75 187
154 9 89 108
346 141 84 3
63 48 262 103
224 116 27 78
103 6 171 128
327 114 127 172
352 155 52 101
342 72 44 45
324 93 282 8
360 108 289 162
1 118 295 165
312 99 338 164
95 118 70 81
47 175 20 53
361 136 127 146
82 103 55 107
31 27 309 151
58 186 195 94
250 131 34 108
308 131 313 3
310 123 325 139
327 17 232 170
149 20 66 124
119 94 353 168
219 148 29 48
130 116 326 139
71 95 234 186
295 59 186 17
126 91 48 158
311 62 351 84
318 30 204 115
357 20 89 86
111 154 349 75
159 125 192 78
267 117 44 105
342 164 141 92
59 48 9 99
67 63 325 69
63 66 289 35
4 116 333 13
339 71 205 170
150 166 257 61
298 128 6 177
96 181 200 66
4 32 97 130
192 115 66 17
125 28 351 171
153 147 325 58
207 55 240 64
351 63 315 5
44 36 299 121
262 150 285 117
344 153 163 195
304 142 122 151
329 129 312 60
43 119 228 149
288 90 196 140
195 117 299 124
156 88 44 89
58 189 144 20
248 20 324 43
244 147 306 70
51 35 111 28
74 37 219 94
309 160 178 85
304 41 362 121

0 0 0

Code: Select all

Outputs
There is no empty spots.
There is one empty spot.
There are 83470 empty spots.
There are 76893 empty spots.
There are 81286 empty spots.
There are 9532 empty spots.
There are 161 empty spots.
There are 7368 empty spots.
There are 271 empty spots.
There is one empty spot.
There are 3643 empty spots.
There are 49 empty spots.
There are 3095 empty spots.
note: there is no spaces at end of lines in my real files

Ghust_omega
Experienced poster
Posts: 115
Joined: Tue Apr 06, 2004 7:04 pm
Location: Venezuela

Post by Ghust_omega »

Hi!! D-DY this is your firts post, welcome, mi output is like yours :o, the diferences is this

Code: Select all

There is no empty spots.

There is one empty spot.

There are 83470 empty spots.

There are 76893 empty spots.
the newline betwen the answers the bug maybe is in your code if you posted here maybe I can help you
Hope it helps
Keep posting!!!

D-DY
New poster
Posts: 2
Joined: Wed Sep 08, 2004 7:56 pm
Location: Rouen, France

Post by D-DY »

thanks a lot for your answer :wink:
I added '\n' s and now I'm accepted (P.E.)

This is strange as I don't see double \n here: http://online-judge.uva.es/p/v107/10703.html

I also think my problem was a P.E. since the beginning and I got lots of W.A. !!

I still try to eliminate the remaining P.E. ... I think there should be a more precise description of formating the output in the problems description as all I can do is to guess and submit until it's good :-?

Ghust_omega
Experienced poster
Posts: 115
Joined: Tue Apr 06, 2004 7:04 pm
Location: Venezuela

Post by Ghust_omega »

Hi!! D-DY I scan the inputs before do a printf(' \n'); like this

Code: Select all

#include <stdio.h>

int main(){
	int i,j,W,H,N,X1,Y1,X2,Y2,count=0,min_x,max_x,min_y,max_y;
	
	scanf("%d %d %d",&W,&H,&N);  <----- firts scanf 
	
	while(1){	
.....
		while(N--){
			scanf("%d %d %d %d",&X1,&Y1,&X2,&Y2); <---- second scanf 
..................Many things..................
		if(count == 0){
			printf("There is no empty spots.\n");
		}else{ 
			if(count == 1)
				printf("There is one empty spot.\n");
			else
				printf("There are %d empty spots.\n",count);
		
		}
		scanf("%d %d %d",&W,&H,&N); <----- first scanf (again )
		if(W== 0 && H == 0 && N== 0)
			break;
		else
			printf("\n");
	}
	return 0;
}
this is how i avoid the P.E. maybe this can help you, there are many problems that give you P.E. because this, and refered to the lot WA Posting here I/O is a good choice to begin.
Hope its Helps :)
Keep posting!!

nibbler
New poster
Posts: 22
Joined: Fri Jun 04, 2004 10:30 pm

Post by nibbler »

i got accepted without the additional newlines, like D-DY first output.

Frostina
New poster
Posts: 23
Joined: Mon Dec 15, 2003 5:21 am

Post by Frostina »

Could anyone please explain what this problem asks?
I can't understand what it wants :-?
Thanks for your help ! ;)

Ghust_omega
Experienced poster
Posts: 115
Joined: Tue Apr 06, 2004 7:04 pm
Location: Venezuela

Post by Ghust_omega »

Hi !! Frostina they want that you count the numbers of free spot, they give you a range of spot that are ocupated and you have to return how many are free easy problem
Hope it Helps
Keep Posting !! :D

deusparanoia
New poster
Posts: 3
Joined: Wed Oct 13, 2004 10:43 am

10703 WA

Post by deusparanoia »

pls help me ...

some of my codes is this

[java] void Begin()
{
StringTokenizer data;
String line;
int w, h, n, x1, y1, x2, y2, res;
while ((line = Main.ReadLn(255).trim()) != null)
{
if (line.equals("0 0 0"))
break;
else if (line.length() == 0)
continue;
data = new StringTokenizer(line);
w = Integer.parseInt(data.nextToken());
h = Integer.parseInt(data.nextToken());
n = Integer.parseInt(data.nextToken());
initBoard(w, h); // initializes the board
for (int i = 0; i < n; i ++)
{
data = new StringTokenizer (Main.ReadLn(255).trim());
setBoard (Integer.parseInt(data.nextToken()), Integer.parseInt(data.nextToken()), Integer.parseInt(data.nextToken()), Integer.parseInt(data.nextToken())); /* marks the portion of the board if it is in the scope of the given rectangle */
}
res = countEmptySpots(w, h);
if (res == 0)
System.out.println("There is no empty spots.");
else if (res == 1)
System.out.println("There is one empty spot.");
else
System.out.println("There are " + res + " empty spots.");
System.out.println();
}
}
[/java]

my input ...

Code: Select all

1 1 1 
1 1 1 1 

2 2 2 
1 1 1 2 
1 1 2 1 

493 182 3 
349 148 363 146 
241 123 443 147 
303 124 293 17 

355 299 1 
197 25 338 230 

395 403 11 
228 211 62 260 
6 275 279 109 
384 291 374 129 
22 324 181 108 
158 353 150 85 
101 358 230 275 
88 346 2 128 
91 226 312 76 
226 273 119 300 
224 176 206 28 
169 185 187 178 

307 231 71 
109 126 75 193 
125 145 232 117 
250 122 261 46 
40 8 205 116 
82 184 97 202 
193 24 86 113 
197 140 180 46 
119 59 304 91 
164 46 218 114 
97 155 186 130 
196 210 303 213 
75 115 60 217 
184 77 166 204 
240 138 61 62 
58 152 46 210 
272 178 217 82 
254 188 189 50 
279 198 184 115 
50 95 220 220 
266 219 126 134 
240 197 77 188 
99 18 142 219 
61 231 154 101 
173 100 12 65 
293 42 40 45 
87 50 46 2 
123 72 53 143 
52 35 262 54 
56 34 81 36 
244 199 109 19 
158 75 81 100 
303 98 196 169 
33 112 201 28 
86 119 73 97 
218 205 96 149 
179 165 299 192 
120 199 165 24 
63 104 151 224 
25 44 92 18 
307 169 249 113 
136 185 18 60 
40 59 269 111 
109 104 55 28 
126 25 62 206 
120 183 108 108 
94 179 188 32 
13 85 32 166 
145 156 72 222 
6 179 306 57 
141 70 80 197 
43 93 31 85 
58 4 184 24 
98 143 11 223 
206 125 230 184 
105 96 15 128 
262 59 281 200 
133 38 116 222 
55 146 289 115 
3 216 51 198 
270 18 33 15 
143 211 145 68 
86 187 193 140 
85 63 233 209 
32 112 199 100 
29 146 88 89 
124 77 247 128 
68 115 105 11 
213 24 37 182 
110 125 20 75 
241 77 173 68 
45 2 197 54

0 0 0
and then outputs ...

Code: Select all

There is no empty spots.

There is one empty spot.

There are 83470 empty spots.

There are 76893 empty spots.

There are 81286 empty spots.

There are 9532 empty spots.

please help me . . .

Arm.Turbo
New poster
Posts: 21
Joined: Wed Aug 11, 2004 1:20 pm

Post by Arm.Turbo »

Code: Select all

There is no empty spots.
There is one empty spot.
There are 83470 empty spots.
There are 76893 empty spots.
There are 81286 empty spots.
There are 9532 empty spots.

deusparanoia
New poster
Posts: 3
Joined: Wed Oct 13, 2004 10:43 am

Post by deusparanoia »

i already tried that output .. but still WA :(

Arm.Turbo
New poster
Posts: 21
Joined: Wed Aug 11, 2004 1:20 pm

Post by Arm.Turbo »

deusparanoia wrote:i already tried that output .. but still WA :(
Try to remove System.out.println(); at the end

deusparanoia
New poster
Posts: 3
Joined: Wed Oct 13, 2004 10:43 am

Post by deusparanoia »

still WA :( wats wrong ... i think i solved the problem because the algorithm is jst easy ... maybe there is something wrong in my output format?? ... :( please help me

Arm.Turbo
New poster
Posts: 21
Joined: Wed Aug 11, 2004 1:20 pm

Post by Arm.Turbo »


WR
Experienced poster
Posts: 145
Joined: Thu Nov 27, 2003 9:46 am

Post by WR »

nibbler's correct!

Empty lines between results lead to p.e.

Output should be like D-DYs.

murkho
New poster
Posts: 33
Joined: Mon Mar 28, 2005 6:41 pm

10703 need help....

Post by murkho »

Could anyone please explain what this problem asks?
I can't understand what it wants

Post Reply

Return to “Volume 107 (10700-10799)”