Submission #773567

# Submission time Handle Problem Language Result Execution time Memory
773567 2023-07-05T06:54:34 Z Amylopectin Shortcut (IOI16_shortcut) C++14
0 / 100
1 ms 284 KB
#include "shortcut.h"
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
const int mxn = 3010;
int qsu[mxn] = {},sub[mxn] = {};
int fimi(int l,int r)
{
    if(l < r)
        return l;
    return r;
}
int fima(int l,int r)
{
    if(l > r)
        return l;
    return r;
}
int ab(int l)
{
    if(l < 0)
        return -l;
    return l;
}
long long find_shortcut(int n, std::vector<int> ll, std::vector<int> dd, int c)
{
    int i,j,k,o,m,cn,cm,fn,fm,cmi,ami = 0,cma;
    sub[0] = dd[0];
    for(i=1; i<n; i++)
    {
        qsu[i] = ll[i-1] + qsu[i-1];
        sub[i] = dd[i];
    }
    for(i=0; i<n; i++)
    {
        for(j=i+1; j<n; j++)
        {
            ami = fima(ami,qsu[j] - qsu[i] + sub[i] + sub[j]);
        }
    }
    for(i=0; i<n; i++)
    {
        for(j=i+1; j<n; j++)
        {
            if(qsu[j] - qsu[i] > c)
            {
                cma = 0;
                for(k=0; k<n; k++)
                {
                    for(o=k+1; o<n; o++)
                    {
                        cma = fima(cma,fimi(qsu[o] - qsu[k] + sub[k] + sub[o]
                        ,ab(qsu[k] - qsu[i]) + ab(qsu[o] -qsu[j]) + c + sub[k] + sub[o]));
                    }
                }
                ami = fimi(cma,ami);
            }
        }
    }
    return ami;
}

Compilation message

shortcut.cpp: In function 'long long int find_shortcut(int, std::vector<int>, std::vector<int>, int)':
shortcut.cpp:28:17: warning: unused variable 'm' [-Wunused-variable]
   28 |     int i,j,k,o,m,cn,cm,fn,fm,cmi,ami = 0,cma;
      |                 ^
shortcut.cpp:28:19: warning: unused variable 'cn' [-Wunused-variable]
   28 |     int i,j,k,o,m,cn,cm,fn,fm,cmi,ami = 0,cma;
      |                   ^~
shortcut.cpp:28:22: warning: unused variable 'cm' [-Wunused-variable]
   28 |     int i,j,k,o,m,cn,cm,fn,fm,cmi,ami = 0,cma;
      |                      ^~
shortcut.cpp:28:25: warning: unused variable 'fn' [-Wunused-variable]
   28 |     int i,j,k,o,m,cn,cm,fn,fm,cmi,ami = 0,cma;
      |                         ^~
shortcut.cpp:28:28: warning: unused variable 'fm' [-Wunused-variable]
   28 |     int i,j,k,o,m,cn,cm,fn,fm,cmi,ami = 0,cma;
      |                            ^~
shortcut.cpp:28:31: warning: unused variable 'cmi' [-Wunused-variable]
   28 |     int i,j,k,o,m,cn,cm,fn,fm,cmi,ami = 0,cma;
      |                               ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB n = 4, 80 is a correct answer
2 Correct 0 ms 212 KB n = 9, 110 is a correct answer
3 Correct 0 ms 212 KB n = 4, 21 is a correct answer
4 Correct 0 ms 212 KB n = 3, 4 is a correct answer
5 Correct 1 ms 212 KB n = 2, 62 is a correct answer
6 Correct 0 ms 212 KB n = 2, 3 is a correct answer
7 Correct 0 ms 212 KB n = 3, 29 is a correct answer
8 Correct 0 ms 284 KB n = 2, 3 is a correct answer
9 Correct 0 ms 212 KB n = 2, 3 is a correct answer
10 Incorrect 0 ms 212 KB n = 2, incorrect answer: jury 2000000001 vs contestant 0
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB n = 4, 80 is a correct answer
2 Correct 0 ms 212 KB n = 9, 110 is a correct answer
3 Correct 0 ms 212 KB n = 4, 21 is a correct answer
4 Correct 0 ms 212 KB n = 3, 4 is a correct answer
5 Correct 1 ms 212 KB n = 2, 62 is a correct answer
6 Correct 0 ms 212 KB n = 2, 3 is a correct answer
7 Correct 0 ms 212 KB n = 3, 29 is a correct answer
8 Correct 0 ms 284 KB n = 2, 3 is a correct answer
9 Correct 0 ms 212 KB n = 2, 3 is a correct answer
10 Incorrect 0 ms 212 KB n = 2, incorrect answer: jury 2000000001 vs contestant 0
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB n = 4, 80 is a correct answer
2 Correct 0 ms 212 KB n = 9, 110 is a correct answer
3 Correct 0 ms 212 KB n = 4, 21 is a correct answer
4 Correct 0 ms 212 KB n = 3, 4 is a correct answer
5 Correct 1 ms 212 KB n = 2, 62 is a correct answer
6 Correct 0 ms 212 KB n = 2, 3 is a correct answer
7 Correct 0 ms 212 KB n = 3, 29 is a correct answer
8 Correct 0 ms 284 KB n = 2, 3 is a correct answer
9 Correct 0 ms 212 KB n = 2, 3 is a correct answer
10 Incorrect 0 ms 212 KB n = 2, incorrect answer: jury 2000000001 vs contestant 0
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB n = 4, 80 is a correct answer
2 Correct 0 ms 212 KB n = 9, 110 is a correct answer
3 Correct 0 ms 212 KB n = 4, 21 is a correct answer
4 Correct 0 ms 212 KB n = 3, 4 is a correct answer
5 Correct 1 ms 212 KB n = 2, 62 is a correct answer
6 Correct 0 ms 212 KB n = 2, 3 is a correct answer
7 Correct 0 ms 212 KB n = 3, 29 is a correct answer
8 Correct 0 ms 284 KB n = 2, 3 is a correct answer
9 Correct 0 ms 212 KB n = 2, 3 is a correct answer
10 Incorrect 0 ms 212 KB n = 2, incorrect answer: jury 2000000001 vs contestant 0
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB n = 4, 80 is a correct answer
2 Correct 0 ms 212 KB n = 9, 110 is a correct answer
3 Correct 0 ms 212 KB n = 4, 21 is a correct answer
4 Correct 0 ms 212 KB n = 3, 4 is a correct answer
5 Correct 1 ms 212 KB n = 2, 62 is a correct answer
6 Correct 0 ms 212 KB n = 2, 3 is a correct answer
7 Correct 0 ms 212 KB n = 3, 29 is a correct answer
8 Correct 0 ms 284 KB n = 2, 3 is a correct answer
9 Correct 0 ms 212 KB n = 2, 3 is a correct answer
10 Incorrect 0 ms 212 KB n = 2, incorrect answer: jury 2000000001 vs contestant 0
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB n = 4, 80 is a correct answer
2 Correct 0 ms 212 KB n = 9, 110 is a correct answer
3 Correct 0 ms 212 KB n = 4, 21 is a correct answer
4 Correct 0 ms 212 KB n = 3, 4 is a correct answer
5 Correct 1 ms 212 KB n = 2, 62 is a correct answer
6 Correct 0 ms 212 KB n = 2, 3 is a correct answer
7 Correct 0 ms 212 KB n = 3, 29 is a correct answer
8 Correct 0 ms 284 KB n = 2, 3 is a correct answer
9 Correct 0 ms 212 KB n = 2, 3 is a correct answer
10 Incorrect 0 ms 212 KB n = 2, incorrect answer: jury 2000000001 vs contestant 0
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB n = 4, 80 is a correct answer
2 Correct 0 ms 212 KB n = 9, 110 is a correct answer
3 Correct 0 ms 212 KB n = 4, 21 is a correct answer
4 Correct 0 ms 212 KB n = 3, 4 is a correct answer
5 Correct 1 ms 212 KB n = 2, 62 is a correct answer
6 Correct 0 ms 212 KB n = 2, 3 is a correct answer
7 Correct 0 ms 212 KB n = 3, 29 is a correct answer
8 Correct 0 ms 284 KB n = 2, 3 is a correct answer
9 Correct 0 ms 212 KB n = 2, 3 is a correct answer
10 Incorrect 0 ms 212 KB n = 2, incorrect answer: jury 2000000001 vs contestant 0
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB n = 4, 80 is a correct answer
2 Correct 0 ms 212 KB n = 9, 110 is a correct answer
3 Correct 0 ms 212 KB n = 4, 21 is a correct answer
4 Correct 0 ms 212 KB n = 3, 4 is a correct answer
5 Correct 1 ms 212 KB n = 2, 62 is a correct answer
6 Correct 0 ms 212 KB n = 2, 3 is a correct answer
7 Correct 0 ms 212 KB n = 3, 29 is a correct answer
8 Correct 0 ms 284 KB n = 2, 3 is a correct answer
9 Correct 0 ms 212 KB n = 2, 3 is a correct answer
10 Incorrect 0 ms 212 KB n = 2, incorrect answer: jury 2000000001 vs contestant 0
11 Halted 0 ms 0 KB -