You are not logged in. Please login at www.codechef.com to post your questions!

×

what is ioi style grading??

I am trying to solve problems from past ico's in ICO online judge.i solved a problem(NEXTPERM). After submission the solution was accepted but i scored only 20 out of 100.The judge is showing that my solution has given correct answer to all the test cases. What can be the cause of scoring so bad??how can i improve my score?? link to the problem:http://opc.iarcs.org.in/index.php/problems/NEXTPERM my answer:

#include<stdio.h>
int main()
{
 long int n,p[1001],a[1001],b,c,d,e=0,f,g=1,h,i,j,k;
 scanf("%ld %ld",&n,&k);
 for (j=1;j<=k;j++)
 {
  for (b=0;b<n;b++)
  {
    scanf("%ld",&a[b]);
  }
  //printf("\n");
  if (a[n-1]>a[n-2])
  {
    c=a[n-1];
    a[n-1]=a[n-2];
    a[n-2]=c;
    for(b=0;b<n;b++)
    {
     if (b!=n-1)
     printf("%ld ",a[b]);
     else
     printf("%ld",a[b]);
    }
  }
 else
 {
  for (b=n-2;b>1;b--)
  {
     if (a[b]>a[b-1])
     break;
  }
  c=a[b-1];
  for (d=b;d<n;d++)
  {
    if (c>a[d])
    break;
  }
  a[b-1]=a[d-1];
  a[d-1]=c;
  for (d=0;d<b;d++)
  p[d]=a[d];
  i=b;
  for (d=n-1;d>=b;d--)
  {
    p[i]=a[d];
    i++;
  }
  for (d=0;d<=n-1;d++)
  {
    a[d]=p[d];
    if (d!=n-1)
    printf("%ld ",a[d]);
    else
    printf("%ld",a[d]);
  }
 }
 printf("\n");
}
return 0;
}
This question is marked "community wiki".

asked 26 Nov '13, 10:19

buro's gravatar image

2★buro
21137
accept rate: 0%

edited 26 Nov '13, 10:43

kunal361's gravatar image

4★kunal361
6.0k133272


For Your Information, the maximum score for that problem is 20

link

answered 07 Dec '14, 11:43

p00r's gravatar image

3★p00r
13916
accept rate: 10%

perhaps you should look for a better and efficient algorithm..:) happy coding..:)

link

answered 26 Nov '13, 10:21

bipin2's gravatar image

3★bipin2
3.1k254671
accept rate: 8%

In IOI style grading even if u get a few test files correct then u get partial marking...each test file is assigned a particular weight-age...so even if 1-2 test files out of the predefined number of test files are correct while the others are giving a WA or RE or TLE...it shows AC status and gives u a partial score...hope this helps...:)

EDIT: can u provide a link to the problem and the link to ur solution...!!!

EDIT 2: to increase ur score maybe u should check if u may be missing a few corner cases...or maybe some overflow maybe taking place or maybe some divide by zero(which may give RE) or maybe RE due to some segmentation fault(large array size) or maybe ur algo may not be efficient enough giving a TLE for the remaining test files so u may need to rethink on ur approach...!!!

link

answered 26 Nov '13, 10:26

kunal361's gravatar image

4★kunal361
6.0k133272
accept rate: 21%

edited 26 Nov '13, 10:32

1

i have added my answer and the problem link

(26 Nov '13, 10:44) buro2★

A simpler solution!

m=map(int,raw_input().split())
n=m[0]
k=m[1]
for i in xrange(k):
    l=map(int,raw_input().split())
    for i in xrange(n-1):
    ii=n-1-i
    if l[ii]>l[ii-1]:
        for j in xrange(ii,n):
        k=n-1+ii-j
        if l[k]>l[ii-1]:
            l[ii-1],l[k]=l[k],l[ii-1]
            l[ii:]=sorted(l[ii:])
            break
        break
    ans=''
    for i in xrange(n):
    ans+=str(l[i])
    ans+=' '
    print ans

Algorithm explained here . Hope this helps

link

answered 08 Jan '15, 23:48

mjnovice's gravatar image

3★mjnovice
1343513
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×424
×242
×177
×5
×2

question asked: 26 Nov '13, 10:19

question was seen: 3,663 times

last updated: 08 Jan '15, 23:48