# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
231236 | 2020-05-13T06:02:09 Z | mohamedsobhi777 | Mountains (IOI17_mountains) | C++14 | 160 ms | 504 KB |
/* Pure bruteforce */ #include "mountains.h" #include <bits/stdc++.h> using namespace std ; int maximum_deevs(std::vector<int> y) { int ret = 0 ; int n = y.size() ; for(int i = 1 ; i < (1<<n) ; i++){ vector<pair<int , int> > prs ; for(int j = 0 ;j < n ;j++){ if(i &(1<<j)){ prs.push_back({j , y[j]}) ; } } if(prs.size() < ret) continue ; bool okk = 1 ; for(int j = 0 ; j < prs.size() ; j++){ for(int k = j +1 ; k < prs.size() && k < j+2; k++){ bool ok = 0 ; double slp = 1.0 * (prs[j].second - prs[k].second) /( prs[j].first - prs[k].first) ; double o = -1 ; double c = prs[j].second - slp * prs[j].first ; for(int l = prs[j].first +1 ; l < prs[k].first ; l++){ if(l * slp + y[l] * o + c < 0){ ok =1 ; } } if(!ok){ okk = 0 ; j = prs.size() ; break ; } } } if(okk){ ret = max(ret , (int) prs.size()) ; } } return ret; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 4 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 160 ms | 256 KB | Output is correct |
7 | Correct | 153 ms | 384 KB | Output is correct |
8 | Correct | 156 ms | 376 KB | Output is correct |
9 | Correct | 159 ms | 356 KB | Output is correct |
10 | Correct | 76 ms | 504 KB | Output is correct |
11 | Correct | 152 ms | 256 KB | Output is correct |
12 | Correct | 160 ms | 504 KB | Output is correct |
13 | Correct | 155 ms | 256 KB | Output is correct |
14 | Correct | 151 ms | 356 KB | Output is correct |
15 | Correct | 147 ms | 376 KB | Output is correct |
16 | Correct | 148 ms | 360 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 4 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 160 ms | 256 KB | Output is correct |
7 | Correct | 153 ms | 384 KB | Output is correct |
8 | Correct | 156 ms | 376 KB | Output is correct |
9 | Correct | 159 ms | 356 KB | Output is correct |
10 | Correct | 76 ms | 504 KB | Output is correct |
11 | Correct | 152 ms | 256 KB | Output is correct |
12 | Correct | 160 ms | 504 KB | Output is correct |
13 | Correct | 155 ms | 256 KB | Output is correct |
14 | Correct | 151 ms | 356 KB | Output is correct |
15 | Correct | 147 ms | 376 KB | Output is correct |
16 | Correct | 148 ms | 360 KB | Output is correct |
17 | Incorrect | 5 ms | 256 KB | Output isn't correct |
18 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 4 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 160 ms | 256 KB | Output is correct |
7 | Correct | 153 ms | 384 KB | Output is correct |
8 | Correct | 156 ms | 376 KB | Output is correct |
9 | Correct | 159 ms | 356 KB | Output is correct |
10 | Correct | 76 ms | 504 KB | Output is correct |
11 | Correct | 152 ms | 256 KB | Output is correct |
12 | Correct | 160 ms | 504 KB | Output is correct |
13 | Correct | 155 ms | 256 KB | Output is correct |
14 | Correct | 151 ms | 356 KB | Output is correct |
15 | Correct | 147 ms | 376 KB | Output is correct |
16 | Correct | 148 ms | 360 KB | Output is correct |
17 | Incorrect | 5 ms | 256 KB | Output isn't correct |
18 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 4 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 160 ms | 256 KB | Output is correct |
7 | Correct | 153 ms | 384 KB | Output is correct |
8 | Correct | 156 ms | 376 KB | Output is correct |
9 | Correct | 159 ms | 356 KB | Output is correct |
10 | Correct | 76 ms | 504 KB | Output is correct |
11 | Correct | 152 ms | 256 KB | Output is correct |
12 | Correct | 160 ms | 504 KB | Output is correct |
13 | Correct | 155 ms | 256 KB | Output is correct |
14 | Correct | 151 ms | 356 KB | Output is correct |
15 | Correct | 147 ms | 376 KB | Output is correct |
16 | Correct | 148 ms | 360 KB | Output is correct |
17 | Incorrect | 5 ms | 256 KB | Output isn't correct |
18 | Halted | 0 ms | 0 KB | - |