답안 #51871

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
51871 2018-06-22T09:43:13 Z zetapi Aliens (IOI16_aliens) C++14
12 / 100
192 ms 3124 KB
#include "aliens.h"
#include "bits/stdc++.h"
using namespace std;

#define pb  push_back
#define mp  make_pair
#define ll 	long long
#define itr ::iterator

typedef pair<int,int>  pii;

const ll INF=1e12;

vector<int> vec,lol;

ll cost(int X,int Y)
{
//	cout<<X<<" "<<Y<<" "<<vec[X-1]<<" "<<vec[Y-1]<<" "<<(-vec[X-1]+vec[Y-1]+1)*(-vec[X-1]+vec[Y-1]+1)<<"\n";
	return (-vec[X-1]+vec[Y-1]+1)*(-vec[X-1]+vec[Y-1]+1);
}

ll take_photos(int n=4, int m=6, int k=2, std::vector<int> r={1,1,4,5}, std::vector<int> c={0,0,0,0}) 
{
	ll N=n,M=m,K=k,dp[n+99][k+99];
	for(int A=0;A<N;A++)
		lol.pb(r[A]);
	sort(lol.begin(),lol.end());
	vec.pb(lol[0]);
	for(int A=1;A<lol.size();A++)
	{
		if(lol[A]==vec.back())
			continue;
		vec.pb(lol[A]);
	}
	for(int A=0;A<=N;A++)
		for(int B=0;B<=K;B++)
			dp[A][B]=INF;
	dp[0][0]=0;
	for(int A=1;A<=vec.size();A++)
	{
		for(int B=1;B<=K;B++)
		{
			for(int C=0;C<A;C++)
				dp[A][B]=min(dp[A][B],dp[C][B-1]+cost(C+1,A));
		}
	}
	ll res=INF;
	for(int B=1;B<=K;B++)
		res=min(res,dp[vec.size()][B]);
    return res;
}

/*int main()
{
	ios_base::sync_with_stdio(false);
	cout<<take_photos();
	return 0;
}*/

Compilation message

aliens.cpp: In function 'long long int take_photos(int, int, int, std::vector<int>, std::vector<int>)':
aliens.cpp:29:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int A=1;A<lol.size();A++)
              ~^~~~~~~~~~~
aliens.cpp:39:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int A=1;A<=vec.size();A++)
              ~^~~~~~~~~~~~
aliens.cpp:24:9: warning: unused variable 'M' [-Wunused-variable]
  ll N=n,M=m,K=k,dp[n+99][k+99];
         ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 248 KB Wrong answer: output = 1, expected = 4
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 356 KB Correct answer: answer = 1
2 Correct 2 ms 440 KB Correct answer: answer = 4
3 Correct 2 ms 440 KB Correct answer: answer = 1
4 Correct 2 ms 440 KB Correct answer: answer = 5
5 Correct 2 ms 492 KB Correct answer: answer = 41
6 Correct 3 ms 528 KB Correct answer: answer = 71923
7 Correct 2 ms 836 KB Correct answer: answer = 77137
8 Correct 58 ms 1920 KB Correct answer: answer = 764
9 Correct 3 ms 1920 KB Correct answer: answer = 250000
10 Correct 192 ms 3044 KB Correct answer: answer = 500
11 Correct 2 ms 3044 KB Correct answer: answer = 32
12 Correct 3 ms 3044 KB Correct answer: answer = 130050
13 Correct 16 ms 3044 KB Correct answer: answer = 5110
14 Correct 4 ms 3044 KB Correct answer: answer = 2626
15 Correct 8 ms 3044 KB Correct answer: answer = 796
16 Correct 12 ms 3044 KB Correct answer: answer = 7580
17 Correct 42 ms 3044 KB Correct answer: answer = 1904
18 Correct 2 ms 3044 KB Correct answer: answer = 996004
19 Correct 6 ms 3044 KB Correct answer: answer = 38817
20 Correct 22 ms 3044 KB Correct answer: answer = 4096
21 Correct 2 ms 3044 KB Correct answer: answer = 1
22 Correct 3 ms 3116 KB Correct answer: answer = 1
23 Correct 44 ms 3116 KB Correct answer: answer = 2040
24 Correct 4 ms 3124 KB Correct answer: answer = 2
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 248 KB Wrong answer: output = 1, expected = 4
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 248 KB Wrong answer: output = 1, expected = 4
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 248 KB Wrong answer: output = 1, expected = 4
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 248 KB Wrong answer: output = 1, expected = 4
2 Halted 0 ms 0 KB -