111 - History Grading
Moderator: Board moderators
-
- Experienced poster
- Posts: 169
- Joined: Wed Oct 31, 2001 2:00 am
- Location: Singapore
ANYBODY, HELP ME... Prob 111
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]
[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]
111: WA (Can't undestand the problem). please, help
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:
Can anybody tell me where these 9 "events" have place??
Where is "longest (not necessarily contiguous) sequence" and how it looks like??![:cry:](./images/smilies/icon_cry.gif)
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
![:oops:](./images/smilies/icon_redface.gif)
Where is "longest (not necessarily contiguous) sequence" and how it looks like??
![:cry:](./images/smilies/icon_cry.gif)
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:](./images/smilies/icon_wink.gif)
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:](./images/smilies/icon_wink.gif)
-
- Experienced poster
- Posts: 193
- Joined: Thu Sep 19, 2002 6:39 am
- Location: Indonesia
- Contact:
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![:)](./images/smilies/icon_smile.gif)
-turuthok-
By the way, friends, let's follow suit by using English in this public forum ...
Take care and good luck
![:)](./images/smilies/icon_smile.gif)
-turuthok-
The fear of the LORD is the beginning of knowledge (Proverbs 1:7).
-
- Learning poster
- Posts: 82
- Joined: Thu Oct 10, 2002 1:15 pm
- Location: St. Johns, Canada
- Contact:
111 - Is it LIS or LCS
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
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