111 - History Grading

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

Moderator: Board moderators

junjieliang
Experienced poster
Posts: 169
Joined: Wed Oct 31, 2001 2:00 am
Location: Singapore

Post by junjieliang »

The sequence in sample input 2 is:
3 1 2 4 9 5 10 6 8 7
Note that the number 1 is in the second position, so it has rank 2.
2 has rank 3.
3 has rank 1, etc etc.
So the rank is
2 3 1 4 6 8 10 9 5 7

Hope I didn't get it wrong...been some time since I solved this problem.
kurnia w
New poster
Posts: 18
Joined: Fri Dec 06, 2002 3:53 pm
Location: Indonesia
Contact:

ANYBODY, HELP ME... Prob 111

Post by kurnia w »

i've got TLE for this problem...is there any way to make it more faster ?? anyway here is my code... thank's
[c]
#include<stdio.h>
#define max 20
int angka[max+1],temp[max+1],temp2[max+1],length[max+1];
int n;
void table() {
int i;
for(i=0; i<n; i++) scanf("%d",&angka);
}
void main() {
int i, j, k,count;

scanf("%d",&n);
table();
while(1) {
count=1;
for(i=0; i<n; i++) {
scanf("%d",&temp);
temp2[temp]=angka;
}
for(i=1; i<=n; i++) {
if(temp2<temp2[i+1]) count++;
}
printf("%d\n",count);
}
}[/c]
turuthok
Experienced poster
Posts: 193
Joined: Thu Sep 19, 2002 6:39 am
Location: Indonesia
Contact:

Post by turuthok »

How did you get out of the while(1) break ?

-turuthok-
The fear of the LORD is the beginning of knowledge (Proverbs 1:7).
kurnia w
New poster
Posts: 18
Joined: Fri Dec 06, 2002 3:53 pm
Location: Indonesia
Contact:

Post by kurnia w »

Yes i see that, but in what condition that i should make it stop ??
i still new in here...last time i'm use this way...i.ve got Output limit exceeded...
[c]for(i=0; i<n; i++) {
if(scanf("%d",&temp)!=1) break;
else temp2[temp]=angka;
}
[/c]

Thank's for the advance...
minskcity
Experienced poster
Posts: 199
Joined: Tue May 14, 2002 10:23 am
Location: Vancouver

111: WA (Can't undestand the problem). please, help

Post by minskcity »

According to problem description:
1 point for each event in the longest (not necessarily contiguous) sequence of events which are in the correct order relative to each other.

One of samples:

Code: Select all

Sample Input 2
10
3 1 2 4 9 5 10 6 8 7
2 10 1 3 8 4 9 5 7 6

Sample Output 2
9
Can anybody tell me where these 9 "events" have place?? :oops:
Where is "longest (not necessarily contiguous) sequence" and how it looks like?? :cry:
kurnia w
New poster
Posts: 18
Joined: Fri Dec 06, 2002 3:53 pm
Location: Indonesia
Contact:

Post by kurnia w »

see this page :
http://acm.uva.es/board/viewtopic.php?t=2241

Hope can help u understand the problem :-?
kurnia w
New poster
Posts: 18
Joined: Fri Dec 06, 2002 3:53 pm
Location: Indonesia
Contact:

Post by kurnia w »

Hi Hisoka...can you give me more test case for this problem...
i've modify my code & got WA for that...
deddy one
Experienced poster
Posts: 120
Joined: Tue Nov 12, 2002 7:36 pm

Post by deddy one »

hi kurnia,

maybe this web page can help you get AC

http://www-2.cs.cmu.edu/~cburch/pgss99/ ... zsoln.html

read the last part of that page :wink:
kurnia w
New poster
Posts: 18
Joined: Fri Dec 06, 2002 3:53 pm
Location: Indonesia
Contact:

Post by kurnia w »

Got it AC, Terima kasih semuanya... :D
deddy one
Experienced poster
Posts: 120
Joined: Tue Nov 12, 2002 7:36 pm

Post by deddy one »

hehe :P

smuanya yg disini dari indo ya, baru sadar..
:D :D :D
turuthok
Experienced poster
Posts: 193
Joined: Thu Sep 19, 2002 6:39 am
Location: Indonesia
Contact:

Post by turuthok »

It's a great feeling to see friends from Indonesia in this forum ... Hisoka, I was also from Binus ... graduated 1997.

By the way, friends, let's follow suit by using English in this public forum ...

Take care and good luck :)

-turuthok-
The fear of the LORD is the beginning of knowledge (Proverbs 1:7).
deddy one
Experienced poster
Posts: 120
Joined: Tue Nov 12, 2002 7:36 pm

Post by deddy one »

BINUSIAN 2006 too
:D
xbeanx
Experienced poster
Posts: 114
Joined: Wed Jul 30, 2003 10:30 pm
Location: Newfoundland, Canada (St. John's)

Post by xbeanx »

Yes, there is a problem with the search. I've been experiencing it for a while.
Master
Learning poster
Posts: 82
Joined: Thu Oct 10, 2002 1:15 pm
Location: St. Johns, Canada
Contact:

111 - Is it LIS or LCS

Post by Master »

Hi everybody,
I have tryed to solve the problem 111 but could not be able to understand the problem. so i have searce the board and others help page like Steven Halim's website and i find that this is a LIS problem. But i feel this is a LCS problem and so i solve this like an LCS problem and got AC.

M H Rasel
acmbeginner.tk
UFP2161
A great helper
Posts: 277
Joined: Mon Jul 21, 2003 7:49 pm
Contact:

Post by UFP2161 »

Since the numbers can't repeat, LCS by treating the list of numbers as characters, or LIS by treating the list of numbers as A<B pairs, amount to the same thing in this particular case.

You can use either method, depending on how you want to interpret that first line.
Post Reply

Return to “Volume 1 (100-199)”