답안 #70672

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
70672 2018-08-23T08:23:51 Z 김세빈(#2186) Fibonacci representations (CEOI18_fib) C++11
15 / 100
3142 ms 1428 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef __int128 lll;

const ll mod = 1e9 + 7;

lll F[1010];
vector <ll> A;
ll P[10101];
ll n;

ll calc(vector <ll> &V)
{
	ll i, k;
	
	P[0] = 1; P[1] = (V[1] + 1) / 2;
	
	for(i=2; i<V.size(); i++){
		k = V[i] - V[i - 1];
		P[i] = ((k / 2 + 1) * P[i - 1] + (k % 2 - 1) * P[i - 2] + mod) % mod;
	}
	
	return P[i - 1];
}

int main()
{
	ll i, j, a;
	lll s;
	
	F[0] = F[1] = 1;
	for(i=2; i<=120; i++){
		F[i] = F[i - 1] + F[i - 2];
	}
	
	scanf("%lld", &n);
	
	A.push_back(0);
	
	for(i=1; i<=n; i++){
		scanf("%lld", &a);
		
		A.push_back(a); sort(A.begin(), A.end());
		printf("%lld\n", calc(A));
	}
	
	return 0;
}

Compilation message

fib.cpp: In function 'll calc(std::vector<long long int>&)':
fib.cpp:21:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=2; i<V.size(); i++){
           ~^~~~~~~~~
fib.cpp: In function 'int main()':
fib.cpp:31:8: warning: unused variable 'j' [-Wunused-variable]
  ll i, j, a;
        ^
fib.cpp:32:6: warning: unused variable 's' [-Wunused-variable]
  lll s;
      ^
fib.cpp:39:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld", &n);
  ~~~~~^~~~~~~~~~~~
fib.cpp:44:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld", &a);
   ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 488 KB Output is correct
2 Correct 3 ms 488 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 628 KB Output is correct
2 Runtime error 3142 ms 1428 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -