Submission #1061303

# Submission time Handle Problem Language Result Execution time Memory
1061303 2024-08-16T07:55:08 Z vjudge1 Mountains (IOI17_mountains) C++17
20 / 100
130 ms 604 KB
#include "mountains.h"
using namespace std;
int C[2010][2010];
vector<int>adj[2010];
int maximum_deevs(vector<int> y) {
    int n=y.size();
    for(int i=1;i<n;i++){
        int uuu=i-1;
        C[i][i-1]=C[i-1][i]=1;
        for(int j=i-1;j--;) {
            long long ht=y[j]-y[i],dt=i-j;
            long long hb=y[uuu]-y[i],db=i-uuu;
            if(ht*db>=hb*dt)
                C[i][j]=C[j][i]=1,uuu=j;
        }
    }
    int ans=0;
    for(int i=1;i<1<<n;i++){
        vector<int>v;
        for(int j=0;j<n;j++)
            if(i&1<<j)
                v.push_back(j);
        int k=v.size();
        int bad=0;
        for(auto A:v)
            for(auto B:v)
                if(C[A][B])
                    bad=1;
        if(!bad)ans=max(ans,(int)v.size());
    }
    return ans;
}

Compilation message

mountains.cpp: In function 'int maximum_deevs(std::vector<int>)':
mountains.cpp:23:13: warning: unused variable 'k' [-Wunused-variable]
   23 |         int k=v.size();
      |             ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 106 ms 348 KB Output is correct
7 Correct 107 ms 484 KB Output is correct
8 Correct 103 ms 604 KB Output is correct
9 Correct 102 ms 348 KB Output is correct
10 Correct 53 ms 348 KB Output is correct
11 Correct 106 ms 348 KB Output is correct
12 Correct 130 ms 528 KB Output is correct
13 Correct 103 ms 348 KB Output is correct
14 Correct 102 ms 348 KB Output is correct
15 Correct 107 ms 348 KB Output is correct
16 Correct 103 ms 528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 106 ms 348 KB Output is correct
7 Correct 107 ms 484 KB Output is correct
8 Correct 103 ms 604 KB Output is correct
9 Correct 102 ms 348 KB Output is correct
10 Correct 53 ms 348 KB Output is correct
11 Correct 106 ms 348 KB Output is correct
12 Correct 130 ms 528 KB Output is correct
13 Correct 103 ms 348 KB Output is correct
14 Correct 102 ms 348 KB Output is correct
15 Correct 107 ms 348 KB Output is correct
16 Correct 103 ms 528 KB Output is correct
17 Incorrect 0 ms 604 KB Output isn't correct
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 106 ms 348 KB Output is correct
7 Correct 107 ms 484 KB Output is correct
8 Correct 103 ms 604 KB Output is correct
9 Correct 102 ms 348 KB Output is correct
10 Correct 53 ms 348 KB Output is correct
11 Correct 106 ms 348 KB Output is correct
12 Correct 130 ms 528 KB Output is correct
13 Correct 103 ms 348 KB Output is correct
14 Correct 102 ms 348 KB Output is correct
15 Correct 107 ms 348 KB Output is correct
16 Correct 103 ms 528 KB Output is correct
17 Incorrect 0 ms 604 KB Output isn't correct
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 106 ms 348 KB Output is correct
7 Correct 107 ms 484 KB Output is correct
8 Correct 103 ms 604 KB Output is correct
9 Correct 102 ms 348 KB Output is correct
10 Correct 53 ms 348 KB Output is correct
11 Correct 106 ms 348 KB Output is correct
12 Correct 130 ms 528 KB Output is correct
13 Correct 103 ms 348 KB Output is correct
14 Correct 102 ms 348 KB Output is correct
15 Correct 107 ms 348 KB Output is correct
16 Correct 103 ms 528 KB Output is correct
17 Incorrect 0 ms 604 KB Output isn't correct
18 Halted 0 ms 0 KB -