270 - Lining Up
Moderator: Board moderators
270 - Lining Up
Hi,
After a few RE I realized that 700 is not the right limit. I set it to 2000 and I got RE again. Can somebody (who got AC) tell me what limit should I set?
Thanks in advance
yaro
After a few RE I realized that 700 is not the right limit. I set it to 2000 and I got RE again. Can somebody (who got AC) tell me what limit should I set?
Thanks in advance
yaro
My accepted code says 700 is quite enough. May the problem be in the input part of your code? 

7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
There shouldn't be multiple input problems in Vol. II anymore:junbin wrote:I believe this problem has multiple inputs.. so maybe you should look at that.
http://online-judge.uva.es/board/viewtopic.php?t=4820
Ciao!!!
Claudio
-
- New poster
- Posts: 28
- Joined: Mon Mar 01, 2004 11:29 pm
Hi,
I tried to solve the 270 and for the test cases of Waterloo I receive AC but in UVA i got TLE.
Why? the read of data I think that is correct
[cpp]
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000
typedef struct {
int x, y;
} point;
int ccw(point p0, point p1, point p2) {
int dx1, dx2, dy1, dy2;
return (p1.x-p0.x)*(p2.y-p0.y) - (p2.x-p0.x)*(p1.y-p0.y);
}
int max (int a, int b) {
if (a > b) return a;
return b;
}
int main() {
#ifndef ONLINE_JUDGE
freopen("270.in", "r", stdin);
//freopen("270.out", "w", stdout);
#endif
int i, j, k, x, y, inst;
int num_pontos;
char linha[256];
point pontos[MAX];
scanf("%d\n", &inst);
for (; inst > 0; inst--) {
/*scanf("%d", &num_pontos);
if (num_pontos == 0) break;
for (i = 0; i < num_pontos; i++) {
scanf("%d %d", &x, &y);*/
i = 0;
while (gets(linha) != NULL && sscanf(linha, "%d %d", &x, &y) == 2) {
//printf("%d %d\n", x, y);
pontos.x = x;
pontos[i++].y = y;
}
num_pontos = i;
y = 0;
for (i = 0; i < num_pontos; i++) {
for (j = i + 1; j < num_pontos; j++) {
if (i == j) continue;
x = 2;
for (k = 0; k < num_pontos; k++) {
if (k == i || k == j) continue;
if (ccw(pontos, pontos[j], pontos[k]) == 0) {
x++;
}
}
y = max(x, y);
}
}
printf("%d\n\n", y);
}
while(true);
return 0;
}
[/cpp]
Thanks!
I have other problem - 274. it in the same situation!
I tried to solve the 270 and for the test cases of Waterloo I receive AC but in UVA i got TLE.
Why? the read of data I think that is correct

[cpp]
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000
typedef struct {
int x, y;
} point;
int ccw(point p0, point p1, point p2) {
int dx1, dx2, dy1, dy2;
return (p1.x-p0.x)*(p2.y-p0.y) - (p2.x-p0.x)*(p1.y-p0.y);
}
int max (int a, int b) {
if (a > b) return a;
return b;
}
int main() {
#ifndef ONLINE_JUDGE
freopen("270.in", "r", stdin);
//freopen("270.out", "w", stdout);
#endif
int i, j, k, x, y, inst;
int num_pontos;
char linha[256];
point pontos[MAX];
scanf("%d\n", &inst);
for (; inst > 0; inst--) {
/*scanf("%d", &num_pontos);
if (num_pontos == 0) break;
for (i = 0; i < num_pontos; i++) {
scanf("%d %d", &x, &y);*/
i = 0;
while (gets(linha) != NULL && sscanf(linha, "%d %d", &x, &y) == 2) {
//printf("%d %d\n", x, y);
pontos.x = x;
pontos[i++].y = y;
}
num_pontos = i;
y = 0;
for (i = 0; i < num_pontos; i++) {
for (j = i + 1; j < num_pontos; j++) {
if (i == j) continue;
x = 2;
for (k = 0; k < num_pontos; k++) {
if (k == i || k == j) continue;
if (ccw(pontos, pontos[j], pontos[k]) == 0) {
x++;
}
}
y = max(x, y);
}
}
printf("%d\n\n", y);
}
while(true);
return 0;
}
[/cpp]
Thanks!
I have other problem - 274. it in the same situation!

-
- New poster
- Posts: 28
- Joined: Mon Mar 01, 2004 11:29 pm
-
- Learning poster
- Posts: 63
- Joined: Tue Sep 20, 2005 12:31 am
- Location: Dhaka
- Contact:
270 What's the Problem????
I got WA but why???
Here is my code:
Any Problem in my Algorithm????
Thanks in advance
Here is my code:
Code: Select all
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define pi (2*acos(0.0))
int sort_int(const void *a,const void *b)
{
return (*(int*)a-*(int*)b);
}
void main()
{
long x,y,test;
int T[10000],i,j,count,max,first,flag = 0;
char in[100],*p;
double theta;
//freopen("270.in","r",stdin);
scanf("%ld",&test);
gets(in);
gets(in);
while(test--)
{
i = 0;
while(gets(in)!=NULL)
{
if(in[0]=='\0')
break;
p = strtok(in," ");
x = atol(p);
p = strtok(NULL," ");
y = atol(p);
if(x<0.0000001)
T[i++] = 0.0;
else if(y<0.000001)
T[i++] = 90;
else
{
theta = atan((double) y/x);
theta*=180;
theta/=pi;
T[i++] = theta;
}
}
qsort(T,i,sizeof(T[0]),sort_int);
max = 0;
first = T[0];
count = 0;
for(j = 0;j<i;j++)
{
if(first==T[j])
{
count++;
}
else
{
if(count>max)
max = count;
count = 1;
first = T[j];
}
}
if(flag==0)
printf("%d\n",max);
else
printf("\n%d\n",max);
flag = 1;
}
}
Thanks in advance
Amra korbo joy akhdin............................
-
- Learning poster
- Posts: 83
- Joined: Wed Feb 01, 2006 12:59 pm
- Location: (Fci-cu) Egypt
- Contact:
Hi all:
In the past I got AC in this problem using different ways in n^2logn.
Today i found my self getting WA in all of my codes.
Any help/hints/tricky test cases?
Does administrators change the test cases for this problem?
Thanks in advance.
In the past I got AC in this problem using different ways in n^2logn.
Today i found my self getting WA in all of my codes.
Any help/hints/tricky test cases?
Does administrators change the test cases for this problem?
Thanks in advance.
Sleep enough after death, it is the time to work.
Mostafa Saad
Mostafa Saad
perhaps
Hi 898989,
try this.
use the output:
and don't:
perhaps work.
[/quote]
try this.
use the output:
Code: Select all
A\n\n
A\n\n
A\n
Code: Select all
A\n\n
A\n\n
A\n\n <---- \n :o
