Submission #142825

# Submission time Handle Problem Language Result Execution time Memory
142825 2019-08-11T11:19:07 Z daniel920712 Boxes with souvenirs (IOI15_boxes) C++14
10 / 100
2 ms 380 KB
#include "boxes.h"
#include <stdio.h>

using namespace std;

long long delivery(int N, int K, int L, int p[])
{
    long long ans=0;
    int l=N+1,r=-1,i;
    for(i=0;i<N;i++)
    {
        if(p[i]<=L/2)
        {
            if(p[i+1]>L/2||(i+1)%K==0||i+1==N)
            {
                ans+=p[i]*2;
                //printf("%lld\n",ans);
            }
        }
        else break;
    }
    for(i=N-1;i>=0;i--)
    {
        if(p[i]>L/2)
        {
            if(i==0||p[i-1]<=L/2||(N-i)%K==0)
            {
                ans+=(L-p[i])*2;
                //printf("%lld\n",ans);
            }
        }
        else break;
    }
    return ans;

}

Compilation message

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:9:9: warning: unused variable 'l' [-Wunused-variable]
     int l=N+1,r=-1,i;
         ^
boxes.cpp:9:15: warning: unused variable 'r' [-Wunused-variable]
     int l=N+1,r=-1,i;
               ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 380 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 252 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 380 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Incorrect 2 ms 252 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 380 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Incorrect 2 ms 252 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 380 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Incorrect 2 ms 252 KB Output isn't correct
9 Halted 0 ms 0 KB -