답안 #40375

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
40375 2018-01-31T12:40:40 Z model_code Mountains (IOI17_mountains) C++11
0 / 100
175 ms 684 KB
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstring>
#include "mountains.h"

using namespace std;

const int maxn=20;

int ans,a[maxn];
bool mark[20];

int maximum_deevs(vector<int> a){
	int n = a.size();
	vector<int> perm;
	for(int i=0;i<n;i++)perm.push_back(i);
	for(int t=0;t<10000;t++){
		memset(mark,0,sizeof(mark));
		random_shuffle(perm.begin(),perm.end());
		int cur=0;
		for(int i=0;i<n;i++){
			bool can=true;
			for(int j=0;j<i;j++)if(mark[j]){
				bool find=false;
				for(int k=0;k<n;k++)if(perm[k] > min(perm[i],perm[j]) && perm[k] < max(perm[i],perm[j])){
					int m = (a[perm[i]] - a[perm[j]]) / (abs(perm[i] - perm[j]));
					long long h = a[perm[j]] + 1LL * m * abs(perm[j]-perm[k]);
					if(h < a[perm[k]])find=true;
				}
				if(!find)can=false;
			}
			if(can){
				cur++;
				mark[i]=true;
			}
		}
		ans=max(ans,cur);
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 248 KB Output is correct
2 Correct 2 ms 352 KB Output is correct
3 Correct 2 ms 424 KB Output is correct
4 Correct 3 ms 560 KB Output is correct
5 Correct 32 ms 560 KB Output is correct
6 Correct 154 ms 560 KB Output is correct
7 Correct 135 ms 628 KB Output is correct
8 Correct 146 ms 684 KB Output is correct
9 Correct 145 ms 684 KB Output is correct
10 Correct 110 ms 684 KB Output is correct
11 Incorrect 175 ms 684 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 248 KB Output is correct
2 Correct 2 ms 352 KB Output is correct
3 Correct 2 ms 424 KB Output is correct
4 Correct 3 ms 560 KB Output is correct
5 Correct 32 ms 560 KB Output is correct
6 Correct 154 ms 560 KB Output is correct
7 Correct 135 ms 628 KB Output is correct
8 Correct 146 ms 684 KB Output is correct
9 Correct 145 ms 684 KB Output is correct
10 Correct 110 ms 684 KB Output is correct
11 Incorrect 175 ms 684 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 248 KB Output is correct
2 Correct 2 ms 352 KB Output is correct
3 Correct 2 ms 424 KB Output is correct
4 Correct 3 ms 560 KB Output is correct
5 Correct 32 ms 560 KB Output is correct
6 Correct 154 ms 560 KB Output is correct
7 Correct 135 ms 628 KB Output is correct
8 Correct 146 ms 684 KB Output is correct
9 Correct 145 ms 684 KB Output is correct
10 Correct 110 ms 684 KB Output is correct
11 Incorrect 175 ms 684 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 248 KB Output is correct
2 Correct 2 ms 352 KB Output is correct
3 Correct 2 ms 424 KB Output is correct
4 Correct 3 ms 560 KB Output is correct
5 Correct 32 ms 560 KB Output is correct
6 Correct 154 ms 560 KB Output is correct
7 Correct 135 ms 628 KB Output is correct
8 Correct 146 ms 684 KB Output is correct
9 Correct 145 ms 684 KB Output is correct
10 Correct 110 ms 684 KB Output is correct
11 Incorrect 175 ms 684 KB Output isn't correct
12 Halted 0 ms 0 KB -